Lines 955-960
sub BuildSummary {
Link Here
|
955 |
'f' => 'musical', |
955 |
'f' => 'musical', |
956 |
'g' => 'broader', |
956 |
'g' => 'broader', |
957 |
'h' => 'narrower', |
957 |
'h' => 'narrower', |
|
|
958 |
'n' => 'notapplicable', |
958 |
'i' => 'subfi', |
959 |
'i' => 'subfi', |
959 |
't' => 'parent' |
960 |
't' => 'parent' |
960 |
); |
961 |
); |
Lines 1014-1048
sub BuildSummary {
Link Here
|
1014 |
# construct UNIMARC summary, that is quite different from MARC21 one |
1015 |
# construct UNIMARC summary, that is quite different from MARC21 one |
1015 |
# accepted form |
1016 |
# accepted form |
1016 |
foreach my $field ($record->field('2..')) { |
1017 |
foreach my $field ($record->field('2..')) { |
1017 |
push @authorized, $field->as_string('abcdefghijlmnopqrstuvwxyz'); |
1018 |
push @authorized, { heading => $field->as_string('abcdefghijlmnopqrstuvwxyz'), field => $field->tag() }; |
1018 |
} |
1019 |
} |
1019 |
# rejected form(s) |
1020 |
# rejected form(s) |
1020 |
foreach my $field ($record->field('3..')) { |
1021 |
foreach my $field ($record->field('3..')) { |
1021 |
push @notes, $field->subfield('a'); |
1022 |
push @notes, { note => $field->subfield('a'), field => $field->tag() }; |
1022 |
} |
1023 |
} |
1023 |
foreach my $field ($record->field('4..')) { |
1024 |
foreach my $field ($record->field('4..')) { |
1024 |
my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : ''; |
1025 |
my $thesaurus = $field->subfield('2') ? "thes. : ".$thesaurus{"$field->subfield('2')"}." : " : ''; |
1025 |
push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom' }; |
1026 |
push @seefrom, { heading => $thesaurus . $field->as_string('abcdefghijlmnopqrstuvwxyz'), type => 'seefrom', field => $field->tag() }; |
1026 |
} |
1027 |
} |
1027 |
# see : |
1028 |
# see : |
1028 |
foreach my $field ($record->field('5..')) { |
1029 |
foreach my $field ($record->field('5..')) { |
1029 |
if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) { |
1030 |
if (($field->subfield('5')) && ($field->subfield('a')) && ($field->subfield('5') eq 'g')) { |
1030 |
push @seealso, { $field->as_string('abcdefgjxyz'), type => 'broader' }; |
1031 |
push @seealso, { $field->as_string('abcdefgjxyz'), type => 'broader', field => $field->tag() }; |
1031 |
} elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){ |
1032 |
} elsif (($field->subfield('5')) && ($field->as_string) && ($field->subfield('5') eq 'h')){ |
1032 |
push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower' }; |
1033 |
push @seealso, { heading => $field->as_string('abcdefgjxyz'), type => 'narrower', field => $field->tag() }; |
1033 |
} elsif ($field->subfield('a')) { |
1034 |
} elsif ($field->subfield('a')) { |
1034 |
push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso' }; |
1035 |
push @seealso, { heading => $field->as_string('abcdefgxyz'), type => 'seealso', field => $field->tag() }; |
1035 |
} |
1036 |
} |
1036 |
} |
1037 |
} |
1037 |
# // form |
1038 |
# // form |
1038 |
foreach my $field ($record->field('7..')) { |
1039 |
foreach my $field ($record->field('7..')) { |
1039 |
my $lang = substr($field->subfield('8'),3,3); |
1040 |
my $lang = substr($field->subfield('8'),3,3); |
1040 |
push @otherscript, { lang => $lang, term => $field->subfield('a') }; |
1041 |
push @otherscript, { lang => $lang, term => $field->subfield('a'), direction => 'ltr', field => $field->tag() }; |
1041 |
} |
1042 |
} |
1042 |
} else { |
1043 |
} else { |
1043 |
# construct MARC21 summary |
1044 |
# construct MARC21 summary |
1044 |
# FIXME - looping over 1XX is questionable |
1045 |
# FIXME - looping over 1XX is questionable |
1045 |
# since MARC21 authority should have only one 1XX |
1046 |
# since MARC21 authority should have only one 1XX |
|
|
1047 |
my $subfields_to_report; |
1046 |
foreach my $field ($record->field('1..')) { |
1048 |
foreach my $field ($record->field('1..')) { |
1047 |
my $tag = $field->tag(); |
1049 |
my $tag = $field->tag(); |
1048 |
next if "152" eq $tag; |
1050 |
next if "152" eq $tag; |
Lines 1050-1104
sub BuildSummary {
Link Here
|
1050 |
# in MARC21 -- purely local tags really ought to be |
1052 |
# in MARC21 -- purely local tags really ought to be |
1051 |
# 9XX |
1053 |
# 9XX |
1052 |
if ($tag eq '100') { |
1054 |
if ($tag eq '100') { |
1053 |
push @authorized, $field->as_string('abcdefghjklmnopqrstvxyz68'); |
1055 |
$subfields_to_report = 'abcdefghjklmnopqrstvxyz'; |
1054 |
} elsif ($tag eq '110') { |
1056 |
} elsif ($tag eq '110') { |
1055 |
push @authorized, $field->as_string('abcdefghklmnoprstvxyz68'); |
1057 |
$subfields_to_report = 'abcdefghklmnoprstvxyz'; |
1056 |
} elsif ($tag eq '111') { |
1058 |
} elsif ($tag eq '111') { |
1057 |
push @authorized, $field->as_string('acdefghklnpqstvxyz68'); |
1059 |
$subfields_to_report = 'acdefghklnpqstvxyz'; |
1058 |
} elsif ($tag eq '130') { |
1060 |
} elsif ($tag eq '130') { |
1059 |
push @authorized, $field->as_string('adfghklmnoprstvxyz68'); |
1061 |
$subfields_to_report = 'adfghklmnoprstvxyz'; |
1060 |
} elsif ($tag eq '148') { |
1062 |
} elsif ($tag eq '148') { |
1061 |
push @authorized, $field->as_string('abvxyz68'); |
1063 |
$subfields_to_report = 'abvxyz'; |
1062 |
} elsif ($tag eq '150') { |
1064 |
} elsif ($tag eq '150') { |
1063 |
push @authorized, $field->as_string('abvxyz68'); |
1065 |
$subfields_to_report = 'abvxyz'; |
1064 |
} elsif ($tag eq '151') { |
1066 |
} elsif ($tag eq '151') { |
1065 |
push @authorized, $field->as_string('avxyz68'); |
1067 |
$subfields_to_report = 'avxyz'; |
1066 |
} elsif ($tag eq '155') { |
1068 |
} elsif ($tag eq '155') { |
1067 |
push @authorized, $field->as_string('abvxyz68'); |
1069 |
$subfields_to_report = 'abvxyz'; |
1068 |
} elsif ($tag eq '180') { |
1070 |
} elsif ($tag eq '180') { |
1069 |
push @authorized, $field->as_string('vxyz68'); |
1071 |
$subfields_to_report = 'vxyz'; |
1070 |
} elsif ($tag eq '181') { |
1072 |
} elsif ($tag eq '181') { |
1071 |
push @authorized, $field->as_string('vxyz68'); |
1073 |
$subfields_to_report = 'vxyz'; |
1072 |
} elsif ($tag eq '182') { |
1074 |
} elsif ($tag eq '182') { |
1073 |
push @authorized, $field->as_string('vxyz68'); |
1075 |
$subfields_to_report = 'vxyz'; |
1074 |
} elsif ($tag eq '185') { |
1076 |
} elsif ($tag eq '185') { |
1075 |
push @authorized, $field->as_string('vxyz68'); |
1077 |
$subfields_to_report = 'vxyz'; |
|
|
1078 |
} |
1079 |
if ($subfields_to_report) { |
1080 |
push @authorized, { heading => $field->as_string($subfields_to_report), field => $tag }; |
1076 |
} else { |
1081 |
} else { |
1077 |
push @authorized, $field->as_string(); |
1082 |
push @authorized, { heading => $field->as_string(), field => $tag }; |
1078 |
} |
1083 |
} |
1079 |
} #See From |
1084 |
} |
1080 |
foreach my $field ($record->field('4..')) { |
1085 |
foreach my $field ($record->field('4..')) { #See From |
1081 |
my $type = 'seefrom'; |
1086 |
my $type = 'seefrom'; |
1082 |
$type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w')); |
1087 |
$type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w')); |
|
|
1088 |
if ($type eq 'notapplicable') { |
1089 |
substr $field->subfield('w'), 2, 1; |
1090 |
$type = 'earlier' if $type && $type ne 'n'; |
1091 |
} |
1083 |
if ($type eq 'subfi') { |
1092 |
if ($type eq 'subfi') { |
1084 |
push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') }; |
1093 |
push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() }; |
1085 |
} else { |
1094 |
} else { |
1086 |
push @seefrom, { heading => $field->as_string($marc21subfields), type => $type }; |
1095 |
push @seefrom, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() }; |
1087 |
} |
1096 |
} |
1088 |
} #See Also |
1097 |
} |
1089 |
foreach my $field ($record->field('5..')) { |
1098 |
foreach my $field ($record->field('5..')) { #See Also |
1090 |
my $type = 'seealso'; |
1099 |
my $type = 'seealso'; |
1091 |
$type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w')); |
1100 |
$type = $marc21controlrefs{substr $field->subfield('w'), 0, 1} if ($field->subfield('w')); |
|
|
1101 |
if ($type eq 'notapplicable') { |
1102 |
substr $field->subfield('w'), 2, 1; |
1103 |
$type = 'earlier' if $type && $type ne 'n'; |
1104 |
} |
1092 |
if ($type eq 'subfi') { |
1105 |
if ($type eq 'subfi') { |
1093 |
push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') }; |
1106 |
push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i'), field => $field->tag() }; |
1094 |
} else { |
1107 |
} else { |
1095 |
push @seealso, { heading => $field->as_string($marc21subfields), type => $type }; |
1108 |
push @seealso, { heading => $field->as_string($marc21subfields), type => $type, field => $field->tag() }; |
1096 |
} |
1109 |
} |
1097 |
} |
1110 |
} |
1098 |
foreach my $field ($record->field('6..')) { |
1111 |
foreach my $field ($record->field('6..')) { |
1099 |
push @notes, $field->as_string(); |
1112 |
push @notes, { note => $field->as_string(), field => $field->tag() }; |
|
|
1113 |
} |
1114 |
foreach my $field ($record->field('880')) { |
1115 |
my $linkage = $field->subfield('6'); |
1116 |
my $category = substr $linkage, 0, 1; |
1117 |
if ($category eq '1') { |
1118 |
$category = 'preferred'; |
1119 |
} elsif ($category eq '4') { |
1120 |
$category = 'seefrom'; |
1121 |
} elsif ($category eq '5') { |
1122 |
$category = 'seealso'; |
1123 |
} |
1124 |
my $type; |
1125 |
if ($field->subfield('w')) { |
1126 |
$type = $marc21controlrefs{substr $field->subfield('w'), '0'}; |
1127 |
} else { |
1128 |
$type = $category; |
1129 |
} |
1130 |
my $direction = $linkage =~ m#/r$# ? 'rtl' : 'ltr'; |
1131 |
push @otherscript, { term => $field->as_string($subfields_to_report), category => $category, type => $type, direction => $direction, linkage => $linkage }; |
1100 |
} |
1132 |
} |
1101 |
} |
1133 |
} |
|
|
1134 |
$summary{mainentry} = $authorized[0]->{heading}; |
1102 |
$summary{authorized} = \@authorized; |
1135 |
$summary{authorized} = \@authorized; |
1103 |
$summary{notes} = \@notes; |
1136 |
$summary{notes} = \@notes; |
1104 |
$summary{seefrom} = \@seefrom; |
1137 |
$summary{seefrom} = \@seefrom; |