@@ -363,7 +363,8 @@ def do_language(data, marc21):
363
363
def do_abbreviated_title (data , marc21 , key , value ):
364
364
"""Get abbreviated title data.
365
365
366
- * bf:Title = 210|222
366
+ * bf:AbbreviatedTitle = 210
367
+ * bf:KeyTitle = 222
367
368
* mainTitle = $a
368
369
* subtitle = $e
369
370
* responsibilityStatement = $f|$g
@@ -376,8 +377,11 @@ def do_abbreviated_title(data, marc21, key, value):
376
377
if value .get ('a' ):
377
378
main_title = not_repetitive (
378
379
marc21 .bib_id , marc21 .bib_id , key , value , 'a' )
380
+ title_type = 'bf:AbbreviatedTitle'
381
+ if key [:3 ] == '222' :
382
+ title_type = 'bf:KeyTitle'
379
383
title = {
380
- 'type' : 'bf:AbbreviatedTitle' ,
384
+ 'type' : title_type ,
381
385
'mainTitle' : [{'value' : main_title }]
382
386
}
383
387
if value .get ('b' ):
@@ -595,6 +599,10 @@ def build_agent():
595
599
596
600
# exclude work access points
597
601
if key [:3 ] in ['700' , '710' ] and value .get ('t' ):
602
+ work_access_point = do_work_access_point (marc21 , key , value )
603
+ if work_access_point :
604
+ data .setdefault ('work_access_point' , [])
605
+ data ['work_access_point' ].append (work_access_point )
598
606
return None
599
607
600
608
agent = {}
@@ -614,23 +622,22 @@ def build_agent():
614
622
agent = build_agent ()
615
623
616
624
if value .get ('4' ):
617
- roles = []
625
+ roles = set ()
618
626
for role in utils .force_list (value .get ('4' )):
619
- if len (role ) != 3 and 'http' not in role :
627
+ role = role .split ('/' )[- 1 ].lower ()
628
+ if len (role ) != 3 :
620
629
error_print ('WARNING CONTRIBUTION ROLE LENGTH:' ,
621
630
marc21 .bib_id , marc21 .rero_id , role )
622
- role = role [:3 ]
623
631
if role == 'sce' :
624
632
error_print ('WARNING CONTRIBUTION ROLE SCE:' ,
625
633
marc21 .bib_id , marc21 .rero_id ,
626
634
'sce --> aus' )
627
635
role = 'aus'
628
- role = role .lower ()
629
- if role not in _CONTRIBUTION_ROLE and 'http' not in role :
636
+ if role not in _CONTRIBUTION_ROLE :
630
637
error_print ('WARNING CONTRIBUTION ROLE DEFINITION:' ,
631
638
marc21 .bib_id , marc21 .rero_id , role )
632
639
role = 'ctb'
633
- roles .append (role )
640
+ roles .add (role )
634
641
else :
635
642
if key [:3 ] == '100' :
636
643
roles = ['cre' ]
@@ -641,7 +648,7 @@ def build_agent():
641
648
if agent :
642
649
return {
643
650
'agent' : agent ,
644
- 'role' : list (set ( roles ) )
651
+ 'role' : list (roles )
645
652
}
646
653
return None
647
654
@@ -1647,20 +1654,17 @@ def do_work_access_point(marc21, key, value):
1647
1654
not_repetitive (marc21 .bib_id , marc21 .bib_id , key , value , 'b' ))
1648
1655
dates = not_repetitive (marc21 .bib_id , marc21 .bib_id , key , value , 'd' )
1649
1656
if dates :
1650
- dates = dates .rstrip (',' )
1651
- dates = remove_trailing_punctuation (dates ).split ('-' )
1657
+ split_dates = dates .split ('-' )
1658
+ date_of_birth = split_dates [0 ].strip ()
1659
+ if date_of_birth :
1660
+ agent ['date_of_birth' ] = date_of_birth
1652
1661
try :
1653
- date_of_birth = dates [0 ].strip ()
1654
- if date_of_birth :
1655
- agent ['date_of_birth' ] = date_of_birth
1656
- except Exception :
1657
- pass
1658
- try :
1659
- date_of_death = dates [1 ].strip ()
1662
+ date_of_death = split_dates [1 ].strip ()
1660
1663
if date_of_death :
1661
1664
agent ['date_of_death' ] = date_of_death
1662
1665
except Exception :
1663
1666
pass
1667
+
1664
1668
if value .get ('c' ):
1665
1669
agent ['qualifier' ] = remove_trailing_punctuation (
1666
1670
not_repetitive (marc21 .bib_id , marc21 .bib_id , key , value , 'c' ))
@@ -1672,8 +1676,7 @@ def do_work_access_point(marc21, key, value):
1672
1676
agent ['preferred_name' ] = not_repetitive (
1673
1677
marc21 .bib_id , marc21 .bib_id , key , value , 'a' )
1674
1678
if value .get ('b' ):
1675
- agent ['subordinate_unit' ] = not_repetitive (
1676
- marc21 .bib_id , marc21 .bib_id , key , value , 'b' )
1679
+ agent ['subordinate_unit' ] = list (utils .force_list (value .get ('b' )))
1677
1680
if agent :
1678
1681
work_access_point ['agent' ] = agent
1679
1682
if value .get (title_tag ):
0 commit comments