record.add_ordered_field(note)
add_marc_source(record, options) # 598
- add_rda_fields(record, options) # 336,337,338
+ if record.get_fields('336') is None:
+ add_rda_fields(record, options) # 336,337,338
publisher = add_publisher(record, options) # 710
add_restriction(record, options, publisher) # 506
add_platform(record, options) # 710
# Strip out 300 fields that only contain placeholders
elif field.tag == '300' and field['a'] == 'p. cm.':
pass
+ # Add relator URIs
+ elif field.tag.startswith('33') and field['0'] is None:
+ field = add_relator_uri(field)
+ new_record.add_ordered_field(field)
# Strip out useless fields
elif 'cut-field' in options and field.tag in options['cut-field']:
pass
munge_publisher = True
for rel in sten.get_subfields('4'):
if rel == 'pbl':
+ uri_for_relator = True
need_publisher = False
need_relator = False
- if munge_publisher and need_relator:
- sten.add_subfield('4', 'pbl')
+ if munge_publisher:
+ if need_relator:
+ sten.add_subfield('4', 'http://id.loc.gov/vocabulary/relators/pbl')
+ elif uri_for_relator:
+ sten['4'] = 'http://id.loc.gov/vocabulary/relators/pbl'
need_publisher = False
if need_publisher:
indicators = ['2', ' '],
subfields = [
'a', publisher,
- '4', 'pbl'
+ '4', 'http://id.loc.gov/vocabulary/relators/pbl'
]
)
record.add_ordered_field(seven_ten)
)
record.add_ordered_field(forty)
-def add_rda_fields(record, options):
+def add_relator_uri(field):
+ """
+ Add URIs to RDA 33x fields
+ """
+
+ if 'b' not in field:
+ pass
+ elif field.tag == '336':
+ field.add_subfield('0', 'http://id.loc.gov/vocabulary/contentTypes/' + field['b'])
+ elif field.tag == '337':
+ field.add_subfield('0', 'http://id.loc.gov/vocabulary/mediaTypes/' + field['b'])
+ elif field.tag == '338':
+ field.add_subfield('0', 'http://id.loc.gov/vocabulary/carriers/' + field['b'])
+
+ return field
+
+def add_rda_fields(record):
"""
Add 336,337,338 fields identifying the content as an ebook
"""