pennmarc 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pennmarc/helpers/access.rb +14 -9
- data/lib/pennmarc/helpers/creator.rb +42 -6
- data/lib/pennmarc/mappings/locations.yml +44 -44
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/access_spec.rb +24 -2
- data/spec/lib/pennmarc/helpers/creator_spec.rb +187 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb5991760f2f82ed299e5602451881e8b71a88fec9cae1f570afe8e5c90d56f9
|
4
|
+
data.tar.gz: d0fa00068ed63eb1ea9de2127f706c4076b56eb567ac29fc0e88c77a74b5605d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edff4fba2a3e3edf56b7e7fb79992f595becf46e588fa81cb4ed327153deacc6a4bf2c8b040808830f5963e2c64db8a6165bfbdcb04698884ac5ebe4b997d4f0
|
7
|
+
data.tar.gz: f3024891d0d48b13e18b3d25ec09e33c134cb77a152bb3849079589b893f99eef9489b8a81307cab14d941467d36242f829c0a9120d42b24064e862c9411fe80
|
@@ -5,7 +5,8 @@ module PennMARC
|
|
5
5
|
class Access < Helper
|
6
6
|
ONLINE = 'Online'
|
7
7
|
AT_THE_LIBRARY = 'At the library'
|
8
|
-
|
8
|
+
HANDLE_BASE_URL = 'hdl.library.upenn.edu'
|
9
|
+
COLENDA_BASE_URL = 'colenda.library.upenn.edu'
|
9
10
|
|
10
11
|
class << self
|
11
12
|
# Based on enhanced metadata fields added by Alma publishing process or API, determine if the record has
|
@@ -46,7 +47,7 @@ module PennMARC
|
|
46
47
|
# Check if a record contains an 856 entry with a Penn Handle server link meeting these criteria:
|
47
48
|
# 1. Indicator 1 is 4 (HTTP resource)
|
48
49
|
# 2. Indicator 2 is NOT 2 (indicating the linkage is to a "related" thing)
|
49
|
-
# 3. The URL specified in subfield u (URI) is a Penn Handle link
|
50
|
+
# 3. The URL specified in subfield u (URI) is a Penn Handle link or Penn Colenda link
|
50
51
|
# 4. The subfield z does NOT include the string 'Finding aid'
|
51
52
|
# See: https://www.loc.gov/marc/bibliographic/bd856.html
|
52
53
|
# @note Some electronic records do not have Portfolios in Alma, so we rely upon the Resource Link in the 856 to
|
@@ -54,15 +55,19 @@ module PennMARC
|
|
54
55
|
# @param record [MARC::Record]
|
55
56
|
# @return [Boolean]
|
56
57
|
def resource_link?(record)
|
57
|
-
record.fields('856').
|
58
|
-
|
58
|
+
record.fields('856').any? { |field| valid_resource_field?(field) }
|
59
|
+
end
|
60
|
+
|
61
|
+
# Check if a field contains valid resource
|
62
|
+
# @param field [MARC::Field]
|
63
|
+
# @return [Boolean]
|
64
|
+
def valid_resource_field?(field)
|
65
|
+
return false if field.indicator2 == '2' || field.indicator1 != '4'
|
66
|
+
return false if subfield_values(field, 'z')&.include?('Finding aid')
|
59
67
|
|
60
|
-
|
61
|
-
|
62
|
-
return true if subz.exclude?('Finding aid') && value.include?(RESOURCE_LINK_BASE_URL)
|
63
|
-
end
|
68
|
+
subfield_values(field, 'u').any? do |value|
|
69
|
+
[HANDLE_BASE_URL, COLENDA_BASE_URL].any? { |url| value.include?(url) }
|
64
70
|
end
|
65
|
-
false
|
66
71
|
end
|
67
72
|
end
|
68
73
|
end
|
@@ -85,28 +85,28 @@ module PennMARC
|
|
85
85
|
creators.to_h { |h| [h[:show], h[:facet]] }
|
86
86
|
end
|
87
87
|
|
88
|
-
# Show more credited authors - both 100 field and 700 entries where the relator
|
88
|
+
# Show more credited authors - both 100 field and 700 entries where the relator (codes e or 4) is author/aut
|
89
89
|
# @param record [MARC::Record]
|
90
90
|
# @return [Array<String>] array of author/creator values for display
|
91
91
|
def extended_show(record, relator_map: Mappers.relator)
|
92
92
|
fields = record.fields(%w[100 700])
|
93
93
|
fields.filter_map { |field|
|
94
|
-
# for 700 entries, only include ones with relator code
|
95
|
-
next if
|
94
|
+
# for 700 entries, only include ones with relator code ('4') = aut, or code 'e' = 'author'
|
95
|
+
next if field.tag == '700' && !(field['4']&.downcase == 'aut' || field['e']&.downcase&.start_with?('author'))
|
96
96
|
|
97
97
|
parse_show_value(field, relator_map: relator_map)
|
98
98
|
}.uniq
|
99
99
|
end
|
100
100
|
|
101
101
|
# Hash with extended creators show values as the fields and the corresponding facet as the values.
|
102
|
-
# Only include 100, and 700 with relator of aut
|
102
|
+
# Only include 100, and 700 with relator (codes e or 4) of author/aut
|
103
103
|
# @param record [MARC::Record]
|
104
104
|
# @param relator_map [Hash]
|
105
105
|
# @return [Hash]
|
106
106
|
def extended_show_facet_map(record, relator_map: Mappers.relator)
|
107
107
|
creators = record.fields(%w[100 700]).filter_map do |field|
|
108
|
-
# for 700 entries, only include ones with relator code
|
109
|
-
next if
|
108
|
+
# for 700 entries, only include ones with relator code ('4') = aut, or code 'e' = 'author'
|
109
|
+
next if field.tag == '700' && !(field['4']&.downcase == 'aut' || field['e']&.downcase&.start_with?('author'))
|
110
110
|
|
111
111
|
show = parse_show_value(field, relator_map: relator_map)
|
112
112
|
facet = parse_facet_value(field, FACET_SOURCE_MAP[field.tag.to_i].chars)
|
@@ -313,6 +313,42 @@ module PennMARC
|
|
313
313
|
}.uniq
|
314
314
|
end
|
315
315
|
|
316
|
+
# Similar to contributor_show, excluding the authors included in extended_show
|
317
|
+
# @param record [MARC::Record]
|
318
|
+
# @param relator_map [Hash]
|
319
|
+
# @param name_only [Boolean]
|
320
|
+
# @param vernacular [Boolean]
|
321
|
+
# @return [Array<String>]
|
322
|
+
def contributor_noauthor_show(record, relator_map: Mappers.relator, name_only: false, vernacular: true)
|
323
|
+
contributor_fields = record.fields(CONTRIBUTOR_TAGS)
|
324
|
+
|
325
|
+
# Exclude the 700 authors and collect their linkages
|
326
|
+
excluded_linkages = []
|
327
|
+
filtered_fields = contributor_fields.reject do |f|
|
328
|
+
is_author = f.tag == '700' && (f['4']&.downcase == 'aut' || f['e']&.downcase&.start_with?('author'))
|
329
|
+
excluded_linkages << "700-#{f['6'].split('-').last}" if is_author && f['6']
|
330
|
+
is_author
|
331
|
+
end
|
332
|
+
|
333
|
+
# Add vernacular fields that are not excluded by checking the linkages
|
334
|
+
if vernacular
|
335
|
+
vernacular_fields = record.fields('880').select do |f|
|
336
|
+
CONTRIBUTOR_TAGS.any? { |tag| f['6']&.start_with?(tag) } && !excluded_linkages.include?(f['6'])
|
337
|
+
end
|
338
|
+
filtered_fields.concat(vernacular_fields)
|
339
|
+
end
|
340
|
+
|
341
|
+
sf = name_only ? %w[a] : CONTRIBUTOR_DISPLAY_SUBFIELDS
|
342
|
+
|
343
|
+
filtered_fields.filter_map { |field|
|
344
|
+
next if ['', ' ', '0'].exclude?(field.indicator2) && field.tag.in?(CONTRIBUTOR_TAGS)
|
345
|
+
next if subfield_defined? field, 'i'
|
346
|
+
|
347
|
+
contributor = join_subfields(field, &subfield_in?(sf))
|
348
|
+
append_relator(field: field, joined_subfields: contributor, relator_term_sf: 'e', relator_map: relator_map)
|
349
|
+
}.uniq
|
350
|
+
end
|
351
|
+
|
316
352
|
private
|
317
353
|
|
318
354
|
# @param record [MARC::Record]
|
@@ -101,6 +101,10 @@ litaward:
|
|
101
101
|
library: Athenaeum of Philadelphia
|
102
102
|
display: Athenaeum of Philadelphia - Literary Award
|
103
103
|
aeon: true
|
104
|
+
lounge:
|
105
|
+
specific_location: Athenaeum of Philadelphia - Member Lounge
|
106
|
+
library: Athenaeum of Philadelphia
|
107
|
+
display: Athenaeum of Philadelphia - Member Lounge
|
104
108
|
microfilm:
|
105
109
|
specific_location: Athenaeum of Philadelphia - Microfilm
|
106
110
|
library: Athenaeum of Philadelphia
|
@@ -970,12 +974,11 @@ newbofc:
|
|
970
974
|
- 'Veterinary: du Pont Library (New Bolton)'
|
971
975
|
display: 'Veterinary: du Pont Library (New Bolton) - Office'
|
972
976
|
newbrare:
|
973
|
-
specific_location:
|
977
|
+
specific_location: LIBRA - Fairman Rogers Collection
|
974
978
|
library:
|
975
979
|
- Special Collections
|
976
|
-
-
|
977
|
-
|
978
|
-
display: Kislak Center for Special Collections - Fairman Rogers Coll.
|
980
|
+
- LIBRA
|
981
|
+
display: LIBRA - Fairman Rogers Collection
|
979
982
|
aeon: true
|
980
983
|
newbrefe:
|
981
984
|
specific_location: 'Veterinary: du Pont Library (New Bolton) - Reference'
|
@@ -1085,20 +1088,18 @@ scg123:
|
|
1085
1088
|
display: Kislak Center for Special Collections - Rare Book Collection 123
|
1086
1089
|
aeon: true
|
1087
1090
|
sc1100c:
|
1088
|
-
specific_location:
|
1091
|
+
specific_location: LIBRA - 1100C Collection
|
1089
1092
|
library:
|
1090
1093
|
- Special Collections
|
1091
|
-
-
|
1092
|
-
|
1093
|
-
display: Kislak Center for Special Collections - 1100C Collection
|
1094
|
+
- LIBRA
|
1095
|
+
display: LIBRA - 1100C Collection
|
1094
1096
|
aeon: true
|
1095
1097
|
scadams:
|
1096
|
-
specific_location:
|
1098
|
+
specific_location: LIBRA - Adams Collection
|
1097
1099
|
library:
|
1098
1100
|
- Special Collections
|
1099
|
-
-
|
1100
|
-
|
1101
|
-
display: Kislak Center for Special Collections - Adams Collection
|
1101
|
+
- LIBRA
|
1102
|
+
display: LIBRA - Adams Collection
|
1102
1103
|
aeon: true
|
1103
1104
|
scartbk:
|
1104
1105
|
specific_location: Kislak Center for Special Collections - Artists' Books
|
@@ -1117,12 +1118,11 @@ scbanks:
|
|
1117
1118
|
display: Kislak Center for Special Collections - Joanna Banks Collection
|
1118
1119
|
aeon: true
|
1119
1120
|
scblank:
|
1120
|
-
specific_location:
|
1121
|
+
specific_location: LIBRA - Blank Collection
|
1121
1122
|
library:
|
1122
1123
|
- Special Collections
|
1123
|
-
-
|
1124
|
-
|
1125
|
-
display: Kislak Center for Special Collections - Blank Collection
|
1124
|
+
- LIBRA
|
1125
|
+
display: LIBRA - Blank Collection
|
1126
1126
|
aeon: true
|
1127
1127
|
scbyron:
|
1128
1128
|
specific_location: Kislak Center for Special Collections - Byron Collection
|
@@ -1205,12 +1205,11 @@ scelz:
|
|
1205
1205
|
display: Kislak Center for Special Collections - Elzevier Collection
|
1206
1206
|
aeon: true
|
1207
1207
|
scfast:
|
1208
|
-
specific_location:
|
1208
|
+
specific_location: LIBRA - Fast Collection
|
1209
1209
|
library:
|
1210
1210
|
- Special Collections
|
1211
|
-
-
|
1212
|
-
|
1213
|
-
display: Kislak Center for Special Collections - Fast Collection
|
1211
|
+
- LIBRA
|
1212
|
+
display: LIBRA - Fast Collection
|
1214
1213
|
aeon: true
|
1215
1214
|
scforr:
|
1216
1215
|
specific_location: Kislak Center for Special Collections - Forrest Collection
|
@@ -1253,20 +1252,18 @@ scfurnlib:
|
|
1253
1252
|
display: Kislak Center for Special Collections - Furness Shakespeare Library (Van
|
1254
1253
|
Pelt 628)
|
1255
1254
|
scfurnst:
|
1256
|
-
specific_location:
|
1255
|
+
specific_location: LIBRA - Furness Collection
|
1257
1256
|
library:
|
1258
1257
|
- Special Collections
|
1259
|
-
-
|
1260
|
-
|
1261
|
-
display: Kislak Center for Special Collections - Furness Storage
|
1258
|
+
- LIBRA
|
1259
|
+
display: LIBRA - Furness Storage
|
1262
1260
|
aeon: true
|
1263
1261
|
scgull:
|
1264
|
-
specific_location:
|
1262
|
+
specific_location: LIBRA - Gulliver's Travels Collection
|
1265
1263
|
library:
|
1266
1264
|
- Special Collections
|
1267
|
-
-
|
1268
|
-
|
1269
|
-
display: Kislak Center for Special Collections - Gulliver's Travels Collection
|
1265
|
+
- LIBRA
|
1266
|
+
display: LIBRA - Gulliver's Travels Collection
|
1270
1267
|
aeon: true
|
1271
1268
|
scinc:
|
1272
1269
|
specific_location: Kislak Center for Special Collections - Incunables
|
@@ -1309,12 +1306,11 @@ scmss:
|
|
1309
1306
|
display: Kislak Center for Special Collections - Manuscripts
|
1310
1307
|
aeon: true
|
1311
1308
|
scmst:
|
1312
|
-
specific_location:
|
1309
|
+
specific_location: LIBRA - Manuscripts Storage
|
1313
1310
|
library:
|
1314
1311
|
- Special Collections
|
1315
|
-
-
|
1316
|
-
|
1317
|
-
display: Kislak Center for Special Collections - Manuscripts Storage
|
1312
|
+
- LIBRA
|
1313
|
+
display: LIBRA - Manuscripts Storage
|
1318
1314
|
aeon: true
|
1319
1315
|
scmsw:
|
1320
1316
|
specific_location: Kislak Center for Special Collections - Web
|
@@ -1367,12 +1363,11 @@ screfe:
|
|
1367
1363
|
display: Kislak Center for Special Collections - Reference Collection
|
1368
1364
|
aeon: true
|
1369
1365
|
screfestor:
|
1370
|
-
specific_location:
|
1366
|
+
specific_location: LIBRA - Reference Storage
|
1371
1367
|
library:
|
1372
1368
|
- Special Collections
|
1373
|
-
-
|
1374
|
-
|
1375
|
-
display: Kislak Center for Special Collections Reference Storage
|
1369
|
+
- LIBRA
|
1370
|
+
display: LIBRA - Reference Storage
|
1376
1371
|
aeon: true
|
1377
1372
|
scschimmel:
|
1378
1373
|
specific_location: Kislak Center for Special Collections - Schimmel Collection
|
@@ -1399,12 +1394,11 @@ scsmith:
|
|
1399
1394
|
display: Kislak Center for Special Collections - E.F. Smith Collection
|
1400
1395
|
aeon: true
|
1401
1396
|
scsmithst:
|
1402
|
-
specific_location:
|
1397
|
+
specific_location: LIBRA - E.F. Smith Collection
|
1403
1398
|
library:
|
1404
1399
|
- Special Collections
|
1405
|
-
-
|
1406
|
-
|
1407
|
-
display: Kislak Center for Special Collections - E.F. Smith Collection Storage
|
1400
|
+
- LIBRA
|
1401
|
+
display: LIBRA - E.F. Smith Collection Storage
|
1408
1402
|
aeon: true
|
1409
1403
|
scsterne:
|
1410
1404
|
specific_location: Kislak Center for Special Collections - Day Sterne Collection
|
@@ -1415,12 +1409,11 @@ scsterne:
|
|
1415
1409
|
display: Kislak Center for Special Collections - Day Sterne Collection
|
1416
1410
|
aeon: true
|
1417
1411
|
scstor:
|
1418
|
-
specific_location:
|
1412
|
+
specific_location: LIBRA - Rare Book Collection
|
1419
1413
|
library:
|
1420
1414
|
- Special Collections
|
1421
|
-
-
|
1422
|
-
|
1423
|
-
display: Kislak Center for Special Collections - Rare Book Collection Storage
|
1415
|
+
- LIBRA
|
1416
|
+
display: LIBRA - Rare Book Collection Storage
|
1424
1417
|
aeon: true
|
1425
1418
|
scstorvil:
|
1426
1419
|
specific_location: LIBRA Vilain-Wieck Collection
|
@@ -1649,6 +1642,13 @@ veteresov:
|
|
1649
1642
|
- 'Veterinary: Atwood Library (Campus)'
|
1650
1643
|
- Reserve
|
1651
1644
|
display: 'Veterinary: Atwood Library (Campus) - Reserve Oversize'
|
1645
|
+
vetewellrm:
|
1646
|
+
specific_location: 'Veterinary: Atwood Library (Campus)- Wellness Room'
|
1647
|
+
library:
|
1648
|
+
- Health Sciences Libraries
|
1649
|
+
- Veterinary
|
1650
|
+
- 'Veterinary: Atwood Library (Campus)'
|
1651
|
+
display: 'Veterinary: Atwood Library (Campus)- Wellness Room'
|
1652
1652
|
vpexhibit:
|
1653
1653
|
specific location: Van Pelt - Exhibits and Events
|
1654
1654
|
library: Van Pelt-Dietrich Library Center
|
data/lib/pennmarc/version.rb
CHANGED
@@ -44,7 +44,7 @@ describe 'PennMARC::Access' do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
context 'with a record containing a link to
|
47
|
+
context 'with a record containing a link to an online resource' do
|
48
48
|
let(:record) do
|
49
49
|
marc_record fields: [marc_field(tag: PennMARC::Enriched::Pub::PHYS_INVENTORY_TAG),
|
50
50
|
marc_field(tag: '856', subfields: location_and_access_subfields, **indicators)]
|
@@ -72,7 +72,7 @@ describe 'PennMARC::Access' do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
context 'with an 856 describing a resource link' do
|
75
|
+
context 'with an 856 describing a handle resource link' do
|
76
76
|
let(:indicators) { { indicator1: '4', indicator2: '1' } }
|
77
77
|
let(:location_and_access_subfields) do
|
78
78
|
{ z: 'Connect to resource', u: 'http://hdl.library.upenn.edu/1234' }
|
@@ -82,6 +82,28 @@ describe 'PennMARC::Access' do
|
|
82
82
|
expect(helper.facet(record)).to contain_exactly(PennMARC::Access::ONLINE, PennMARC::Access::AT_THE_LIBRARY)
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
86
|
+
context 'with an 856 describing a colenda resource link' do
|
87
|
+
let(:indicators) { { indicator1: '4', indicator2: '1' } }
|
88
|
+
let(:location_and_access_subfields) do
|
89
|
+
{ z: 'Connect to resource', u: 'http://colenda.library.upenn.edu/1234' }
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'includes online access' do
|
93
|
+
expect(helper.facet(record)).to contain_exactly(PennMARC::Access::ONLINE, PennMARC::Access::AT_THE_LIBRARY)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'with an 856 describing some other resource link' do
|
98
|
+
let(:indicators) { { indicator1: '4', indicator2: '1' } }
|
99
|
+
let(:location_and_access_subfields) do
|
100
|
+
{ z: 'Connect to resource', u: 'http://vanpelt.upenn.edu/something' }
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'does not includes online access' do
|
104
|
+
expect(helper.facet(record)).not_to include PennMARC::Access::ONLINE
|
105
|
+
end
|
106
|
+
end
|
85
107
|
end
|
86
108
|
end
|
87
109
|
end
|
@@ -114,13 +114,16 @@ describe 'PennMARC::Creator' do
|
|
114
114
|
let(:fields) do
|
115
115
|
[marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
|
116
116
|
e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
|
117
|
-
marc_field(tag: '700', subfields: { a: 'Surname, Alternative',
|
117
|
+
marc_field(tag: '700', subfields: { a: 'Surname, Alternative', '6': '100', '4': 'aut' }),
|
118
|
+
marc_field(tag: '700', subfields: { a: 'Surname, Third', e: 'author.', '6': '100' }),
|
119
|
+
marc_field(tag: '700', subfields: { a: 'Surname, Ignore', e: 'editor.', '6': '100' }),
|
118
120
|
marc_field(tag: '700', subfields: { a: 'Surname, Not Included', '6': '100', '4': 'edt' })]
|
119
121
|
end
|
120
122
|
|
121
|
-
it 'returns
|
123
|
+
it 'returns three authors' do
|
122
124
|
values = helper.extended_show(record)
|
123
|
-
expect(values).to contain_exactly 'Surname, Name 1900-2000, author.',
|
125
|
+
expect(values).to contain_exactly 'Surname, Name 1900-2000, author.',
|
126
|
+
'Surname, Alternative, Author.', 'Surname, Third, author.'
|
124
127
|
expect(values.join.downcase).not_to include 'http'
|
125
128
|
end
|
126
129
|
end
|
@@ -475,7 +478,7 @@ describe 'PennMARC::Creator' do
|
|
475
478
|
describe '.contributor_show' do
|
476
479
|
let(:record) { marc_record fields: fields }
|
477
480
|
|
478
|
-
context 'when
|
481
|
+
context 'when indicator2 is "1"' do
|
479
482
|
let(:fields) do
|
480
483
|
[marc_field(tag: '700', subfields: { a: 'Ignore' }, indicator2: '1')]
|
481
484
|
end
|
@@ -551,4 +554,184 @@ describe 'PennMARC::Creator' do
|
|
551
554
|
end
|
552
555
|
end
|
553
556
|
end
|
557
|
+
|
558
|
+
describe '.contributor_noauthor_show' do
|
559
|
+
let(:record) { marc_record fields: fields }
|
560
|
+
|
561
|
+
context 'when indicator2 is "1"' do
|
562
|
+
let(:fields) do
|
563
|
+
[marc_field(tag: '700', subfields: { a: 'Ignore' }, indicator2: '1')]
|
564
|
+
end
|
565
|
+
|
566
|
+
it 'ignores the field' do
|
567
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping)
|
568
|
+
expect(values).to be_empty
|
569
|
+
end
|
570
|
+
end
|
571
|
+
|
572
|
+
context 'with subfield "i"' do
|
573
|
+
let(:fields) do
|
574
|
+
[
|
575
|
+
marc_field(tag: '700', subfields: { i: 'Ignore', e: 'author' }),
|
576
|
+
marc_field(tag: '880', subfields: { i: 'Ignore', '6': '700' })
|
577
|
+
]
|
578
|
+
end
|
579
|
+
|
580
|
+
it 'ignores the field' do
|
581
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping)
|
582
|
+
expect(values).to be_empty
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
context 'with a single contributor and linked alternate' do
|
587
|
+
let(:fields) do
|
588
|
+
[
|
589
|
+
marc_field(tag: '700', subfields: { a: 'Name', b: 'I', c: 'laureate', d: '1968', e: 'author',
|
590
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
591
|
+
'4': 'aut' }),
|
592
|
+
marc_field(tag: '880', subfields: { '6': '700', a: 'Alt Name', b: 'Alt num', c: 'Alt title',
|
593
|
+
d: 'Alt date', e: 'Alt relator', j: 'Alt qualifier',
|
594
|
+
q: 'Alt Fuller Name', u: 'Alt affiliation', '3': 'Alt material' })
|
595
|
+
]
|
596
|
+
end
|
597
|
+
|
598
|
+
it 'returns the non-author contributor only' do
|
599
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping)
|
600
|
+
expect(values).to contain_exactly(
|
601
|
+
'Alt Name Alt num Alt title Alt date Alt qualifier Alt Fuller Name Alt affiliation Alt material, Alt relator.'
|
602
|
+
)
|
603
|
+
end
|
604
|
+
|
605
|
+
it 'returns the non-author contributor name only when called with name_only as true' do
|
606
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping, name_only: true)
|
607
|
+
expect(values).to contain_exactly 'Alt Name, Alt relator.'
|
608
|
+
end
|
609
|
+
|
610
|
+
it 'returns empty when called with vernacular as false' do
|
611
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping, vernacular: false)
|
612
|
+
expect(values).to be_empty
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
context 'with four contributors two of which are authors' do
|
617
|
+
let(:fields) do
|
618
|
+
[
|
619
|
+
marc_field(tag: '700', subfields: { a: '01 (Ignore)', b: 'I', c: 'laureate',
|
620
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
621
|
+
'4': 'aut', '6': '880-01' }),
|
622
|
+
marc_field(tag: '700', subfields: { a: '02 (Ignore)', d: '1968', e: 'author',
|
623
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
624
|
+
'6': '880-02' }),
|
625
|
+
marc_field(tag: '700', subfields: { a: '03 (Show)', b: 'J', c: 'laureate',
|
626
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
627
|
+
'4': 'edt', '6': '880-03' }),
|
628
|
+
marc_field(tag: '700', subfields: { a: '04 (Show)', d: '1968', e: 'editor',
|
629
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
630
|
+
'6': '880-04' })
|
631
|
+
]
|
632
|
+
end
|
633
|
+
|
634
|
+
it 'returns two non-author contributors' do
|
635
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping)
|
636
|
+
expect(values).to contain_exactly(
|
637
|
+
'03 (Show) J laureate pseud Fuller Name affiliation materials',
|
638
|
+
'04 (Show) 1968 pseud Fuller Name affiliation materials, editor.'
|
639
|
+
)
|
640
|
+
end
|
641
|
+
|
642
|
+
it 'returns contributor name only when called with name_only as true' do
|
643
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping, name_only: true)
|
644
|
+
expect(values).to contain_exactly('03 (Show)', '04 (Show), editor.')
|
645
|
+
end
|
646
|
+
|
647
|
+
it 'returns contributor values without alternatives when called with vernacular as false' do
|
648
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping, vernacular: false)
|
649
|
+
expect(values).to contain_exactly(
|
650
|
+
'03 (Show) J laureate pseud Fuller Name affiliation materials',
|
651
|
+
'04 (Show) 1968 pseud Fuller Name affiliation materials, editor.'
|
652
|
+
)
|
653
|
+
end
|
654
|
+
end
|
655
|
+
|
656
|
+
context 'with four contributors having respective alternatives, two of the contributors are authors' do
|
657
|
+
let(:fields) do
|
658
|
+
[
|
659
|
+
marc_field(tag: '700', subfields: { a: '01 (Ignore)', b: 'I', c: 'laureate',
|
660
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
661
|
+
'4': 'aut', '6': '880-01' }),
|
662
|
+
marc_field(tag: '700', subfields: { a: '02 (Ignore)', d: '1968', e: 'author',
|
663
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
664
|
+
'6': '880-02' }),
|
665
|
+
marc_field(tag: '700', subfields: { a: '03 (Show)', b: 'J', c: 'laureate',
|
666
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
667
|
+
'4': 'edt', '6': '880-03' }),
|
668
|
+
marc_field(tag: '700', subfields: { a: '04 (Show)', d: '1968', e: 'editor',
|
669
|
+
j: 'pseud', q: 'Fuller Name', u: 'affiliation', '3': 'materials',
|
670
|
+
'6': '880-04' }),
|
671
|
+
marc_field(tag: '880', subfields: { a: 'Alt Name 01 (Ignore)', '6': '700-01', b: 'Alt num 01',
|
672
|
+
c: 'Alt title 01', d: 'Alt date 01', e: 'Alt relator 01',
|
673
|
+
j: 'Alt qualifier 01', q: 'Alt Fuller Name 01', u: 'Alt affiliation 01',
|
674
|
+
'3': 'Alt material 01' }),
|
675
|
+
marc_field(tag: '880', subfields: { a: 'Alt Name 02 (Ignore)', '6': '700-02', b: 'Alt num 02',
|
676
|
+
c: 'Alt title 02', d: 'Alt date 02', e: 'Alt relator 02',
|
677
|
+
j: 'Alt qualifier 02', q: 'Alt Fuller Name 02', u: 'Alt affiliation 02',
|
678
|
+
'3': 'Alt material 02' }),
|
679
|
+
marc_field(tag: '880', subfields: { a: 'Alt Name 03 (Show)', '6': '700-03', b: 'Alt num 03',
|
680
|
+
c: 'Alt title 03', d: 'Alt date 03', e: 'Alt relator 03',
|
681
|
+
j: 'Alt qualifier 03', q: 'Alt Fuller Name 03', u: 'Alt affiliation 03',
|
682
|
+
'3': 'Alt material 03' }),
|
683
|
+
marc_field(tag: '880', subfields: { a: 'Alt Name 04 (Show)', '6': '700-04', b: 'Alt num 04',
|
684
|
+
c: 'Alt title 04', d: 'Alt date 04', e: 'Alt relator 04',
|
685
|
+
j: 'Alt qualifier 04', q: 'Alt Fuller Name 04', u: 'Alt affiliation 04',
|
686
|
+
'3': 'Alt material 04' })
|
687
|
+
]
|
688
|
+
end
|
689
|
+
|
690
|
+
it 'returns two non-author contributors with their alternatives' do
|
691
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping)
|
692
|
+
expect(values).to contain_exactly(
|
693
|
+
'03 (Show) J laureate pseud Fuller Name affiliation materials',
|
694
|
+
'04 (Show) 1968 pseud Fuller Name affiliation materials, editor.',
|
695
|
+
'Alt Name 03 (Show) Alt num 03 Alt title 03 Alt date 03 Alt qualifier 03 Alt Fuller Name 03 '\
|
696
|
+
'Alt affiliation 03 Alt material 03, Alt relator 03.',
|
697
|
+
'Alt Name 04 (Show) Alt num 04 Alt title 04 Alt date 04 Alt qualifier 04 Alt Fuller Name 04 '\
|
698
|
+
'Alt affiliation 04 Alt material 04, Alt relator 04.'
|
699
|
+
)
|
700
|
+
end
|
701
|
+
|
702
|
+
it 'returns two non-author contributors name and alternative names only when called with name_only as true' do
|
703
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping, name_only: true)
|
704
|
+
expect(values).to contain_exactly('03 (Show)', 'Alt Name 03 (Show), Alt relator 03.',
|
705
|
+
'04 (Show), editor.', 'Alt Name 04 (Show), Alt relator 04.')
|
706
|
+
end
|
707
|
+
|
708
|
+
it 'returns two non-author contributors without alternatives when called with vernacular as false' do
|
709
|
+
values = helper.contributor_noauthor_show(record, relator_map: mapping, vernacular: false)
|
710
|
+
expect(values).to contain_exactly(
|
711
|
+
'03 (Show) J laureate pseud Fuller Name affiliation materials',
|
712
|
+
'04 (Show) 1968 pseud Fuller Name affiliation materials, editor.'
|
713
|
+
)
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
context 'with a corporate contributor and linked alternate' do
|
718
|
+
let(:fields) do
|
719
|
+
[
|
720
|
+
marc_field(tag: '710', subfields: { a: 'Corporation', b: 'A division', c: 'Office', d: '1968', e: 'author',
|
721
|
+
u: 'affiliation', '3': 'materials', '4': 'aut' }),
|
722
|
+
marc_field(tag: '880', subfields: { '6': '710', a: 'Alt Corp Name', b: 'Alt unit', c: 'Alt location',
|
723
|
+
d: 'Alt date', e: ['Alt relator', 'another'], u: 'Alt Affiliation',
|
724
|
+
'3': 'Alt materials' })
|
725
|
+
]
|
726
|
+
end
|
727
|
+
|
728
|
+
it 'returns expected contributor values' do
|
729
|
+
values = helper.contributor_noauthor_show(record)
|
730
|
+
expect(values).to contain_exactly(
|
731
|
+
'Corporation A division Office 1968 affiliation materials, Author.',
|
732
|
+
'Alt Corp Name Alt unit Alt location Alt date Alt Affiliation Alt materials, Alt relator, another.'
|
733
|
+
)
|
734
|
+
end
|
735
|
+
end
|
736
|
+
end
|
554
737
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pennmarc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kanning
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2025-
|
15
|
+
date: 2025-09-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|