pennmarc 1.0.12.pre1 → 1.0.14
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/.gitlab-ci.yml +0 -1
- data/.rubocop_todo.yml +13 -5
- data/lib/pennmarc/enriched.rb +93 -0
- data/lib/pennmarc/helpers/access.rb +2 -2
- data/lib/pennmarc/helpers/classification.rb +6 -6
- data/lib/pennmarc/helpers/creator.rb +59 -64
- data/lib/pennmarc/helpers/date.rb +3 -3
- data/lib/pennmarc/helpers/format.rb +7 -7
- data/lib/pennmarc/helpers/helper.rb +1 -1
- data/lib/pennmarc/helpers/inventory.rb +92 -0
- data/lib/pennmarc/helpers/inventory_entry/base.rb +23 -0
- data/lib/pennmarc/helpers/inventory_entry/electronic.rb +20 -0
- data/lib/pennmarc/helpers/inventory_entry/physical.rb +38 -0
- data/lib/pennmarc/helpers/location.rb +19 -14
- data/lib/pennmarc/helpers/subject.rb +6 -6
- data/lib/pennmarc/mappings/locations.yml +4 -0
- data/lib/pennmarc/util.rb +16 -1
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/access_spec.rb +5 -5
- data/spec/lib/pennmarc/helpers/classification_spec.rb +6 -6
- data/spec/lib/pennmarc/helpers/creator_spec.rb +41 -7
- data/spec/lib/pennmarc/helpers/format_spec.rb +4 -4
- data/spec/lib/pennmarc/helpers/inventory_spec.rb +129 -0
- data/spec/lib/pennmarc/helpers/location_spec.rb +40 -9
- data/spec/lib/pennmarc/helpers/subject_spec.rb +37 -13
- metadata +10 -5
- data/lib/pennmarc/enriched_marc.rb +0 -49
@@ -101,13 +101,14 @@ describe 'PennMARC::Subject' do
|
|
101
101
|
let(:fields) do
|
102
102
|
[marc_field(tag: '650', indicator2: '7',
|
103
103
|
subfields: {
|
104
|
-
a: 'Libraries',
|
104
|
+
a: 'Libraries', d: '22nd Century', x: 'History', e: 'relator',
|
105
105
|
'2': 'fast', '0': 'http://fast.org/libraries'
|
106
106
|
})]
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'properly concatenates heading components' do
|
110
|
-
expect(values.first).to
|
110
|
+
expect(values.first).to start_with 'Libraries'
|
111
|
+
expect(values.first).to end_with '--History'
|
111
112
|
end
|
112
113
|
|
113
114
|
it 'excludes URI values from ǂ0 or ǂ1' do
|
@@ -123,14 +124,14 @@ describe 'PennMARC::Subject' do
|
|
123
124
|
end
|
124
125
|
|
125
126
|
it 'joins all values in the expected way' do
|
126
|
-
expect(values.first).to eq 'Libraries
|
127
|
+
expect(values.first).to eq 'Libraries, 22nd Century--History'
|
127
128
|
end
|
128
129
|
end
|
129
130
|
end
|
130
131
|
|
131
132
|
describe '.show' do
|
132
133
|
let(:record) { marc_record fields: fields }
|
133
|
-
let(:values) { helper.
|
134
|
+
let(:values) { helper.show(record) }
|
134
135
|
|
135
136
|
context 'with a variety of headings' do
|
136
137
|
let(:fields) do
|
@@ -162,8 +163,28 @@ describe 'PennMARC::Subject' do
|
|
162
163
|
end
|
163
164
|
|
164
165
|
it 'properly formats the heading parts' do
|
165
|
-
expect(values.first).to eq 'Subways--Pennsylvania--Philadelphia Metropolitan Area--Maps--1989'
|
166
|
-
|
166
|
+
expect(values.first).to eq 'Subways--Pennsylvania--Philadelphia Metropolitan Area--Maps--1989 relator'
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context 'with the record including trailing punctuation in the parts' do
|
171
|
+
let(:fields) do
|
172
|
+
[marc_field(tag: '600', indicator2: '7', subfields: {
|
173
|
+
a: 'Franklin, Benjamin,',
|
174
|
+
d: '1706-1790',
|
175
|
+
'2': 'fast',
|
176
|
+
'0': 'http://id.worldcat.org/fast/34115'
|
177
|
+
}),
|
178
|
+
marc_field(tag: '600', indicator1: '1', indicator2: '0', subfields: {
|
179
|
+
a: 'Franklin, Benjamin,',
|
180
|
+
d: '1706-1790.',
|
181
|
+
x: 'As inventor.'
|
182
|
+
})]
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'returns what Franklin shows', pending: 'proper handling of punctuation in subject parts' do
|
186
|
+
expect(values).to contain_exactly 'Franklin, Benjamin, 1706-1790.',
|
187
|
+
'Franklin, Benjamin, 1706-1790--As inventor.'
|
167
188
|
end
|
168
189
|
end
|
169
190
|
|
@@ -187,14 +208,14 @@ describe 'PennMARC::Subject' do
|
|
187
208
|
let(:fields) do
|
188
209
|
[marc_field(tag: '611', indicator2: '0', subfields: {
|
189
210
|
a: 'Conference',
|
190
|
-
|
191
|
-
|
192
|
-
|
211
|
+
c: ['(Johannesburg, South Africa', 'Cape Town, South Africa'],
|
212
|
+
d: '2002)',
|
213
|
+
n: '2nd'
|
193
214
|
})]
|
194
215
|
end
|
195
216
|
|
196
217
|
it 'properly formats the heading parts' do
|
197
|
-
expect(values.first).to eq 'Conference
|
218
|
+
expect(values.first).to eq 'Conference, (Johannesburg, South Africa, Cape Town, South Africa, 2002)--2nd'
|
198
219
|
end
|
199
220
|
end
|
200
221
|
|
@@ -202,14 +223,17 @@ describe 'PennMARC::Subject' do
|
|
202
223
|
let(:fields) do
|
203
224
|
[marc_field(tag: '600', indicator2: '0', subfields: {
|
204
225
|
a: 'Person, Significant Author',
|
226
|
+
b: 'Numerator',
|
227
|
+
c: %w[Title Rank],
|
205
228
|
d: '1899-1971',
|
206
|
-
|
207
|
-
|
229
|
+
t: 'Collection',
|
230
|
+
v: 'Early works to 1950'
|
208
231
|
})]
|
209
232
|
end
|
210
233
|
|
211
234
|
it 'properly formats the heading parts' do
|
212
|
-
expect(values.first).to eq
|
235
|
+
expect(values.first).to eq('Person, Significant Author, Numerator, Title, Rank, 1899-1971, Collection--' \
|
236
|
+
'Early works to 1950')
|
213
237
|
end
|
214
238
|
end
|
215
239
|
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.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kanning
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-01-
|
13
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -88,7 +88,7 @@ files:
|
|
88
88
|
- README.md
|
89
89
|
- lib/pennmarc.rb
|
90
90
|
- lib/pennmarc/encoding_level.rb
|
91
|
-
- lib/pennmarc/
|
91
|
+
- lib/pennmarc/enriched.rb
|
92
92
|
- lib/pennmarc/heading_control.rb
|
93
93
|
- lib/pennmarc/helpers/access.rb
|
94
94
|
- lib/pennmarc/helpers/citation.rb
|
@@ -101,6 +101,10 @@ files:
|
|
101
101
|
- lib/pennmarc/helpers/genre.rb
|
102
102
|
- lib/pennmarc/helpers/helper.rb
|
103
103
|
- lib/pennmarc/helpers/identifier.rb
|
104
|
+
- lib/pennmarc/helpers/inventory.rb
|
105
|
+
- lib/pennmarc/helpers/inventory_entry/base.rb
|
106
|
+
- lib/pennmarc/helpers/inventory_entry/electronic.rb
|
107
|
+
- lib/pennmarc/helpers/inventory_entry/physical.rb
|
104
108
|
- lib/pennmarc/helpers/language.rb
|
105
109
|
- lib/pennmarc/helpers/link.rb
|
106
110
|
- lib/pennmarc/helpers/location.rb
|
@@ -132,6 +136,7 @@ files:
|
|
132
136
|
- spec/lib/pennmarc/helpers/format_spec.rb
|
133
137
|
- spec/lib/pennmarc/helpers/genre_spec.rb
|
134
138
|
- spec/lib/pennmarc/helpers/identifer_spec.rb
|
139
|
+
- spec/lib/pennmarc/helpers/inventory_spec.rb
|
135
140
|
- spec/lib/pennmarc/helpers/language_spec.rb
|
136
141
|
- spec/lib/pennmarc/helpers/link_spec.rb
|
137
142
|
- spec/lib/pennmarc/helpers/location_spec.rb
|
@@ -161,9 +166,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
166
|
version: '3.2'
|
162
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
168
|
requirements:
|
164
|
-
- - "
|
169
|
+
- - ">="
|
165
170
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
171
|
+
version: '0'
|
167
172
|
requirements: []
|
168
173
|
rubygems_version: 3.4.10
|
169
174
|
signing_key:
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Constants for Alma's MARC enrichment
|
4
|
-
# MARC enrichment is performed during the Alma Publishing process
|
5
|
-
# @see https://developers.exlibrisgroup.com/alma/apis/docs/bibs/R0VUIC9hbG1hd3MvdjEvYmlicy97bW1zX2lkfQ==/
|
6
|
-
# Alma documentation for these added fields
|
7
|
-
module PennMARC
|
8
|
-
module EnrichedMarc
|
9
|
-
# terminology follows the Publishing Profile screen
|
10
|
-
TAG_HOLDING = 'hld'
|
11
|
-
TAG_ITEM = 'itm'
|
12
|
-
TAG_ELECTRONIC_INVENTORY = 'prt'
|
13
|
-
TAG_DIGITAL_INVENTORY = 'dig'
|
14
|
-
|
15
|
-
# these are 852 subfield codes; terminology comes from MARC spec
|
16
|
-
SUB_HOLDING_SHELVING_LOCATION = 'c'
|
17
|
-
SUB_HOLDING_SEQUENCE_NUMBER = '8'
|
18
|
-
SUB_HOLDING_CLASSIFICATION_PART = 'h'
|
19
|
-
SUB_HOLDING_ITEM_PART = 'i'
|
20
|
-
|
21
|
-
SUB_ITEM_CURRENT_LOCATION = 'g'
|
22
|
-
SUB_ITEM_CALL_NUMBER_TYPE = 'h'
|
23
|
-
SUB_ITEM_CALL_NUMBER = 'i'
|
24
|
-
SUB_ITEM_DATE_CREATED = 'q'
|
25
|
-
|
26
|
-
SUB_ELEC_PORTFOLIO_PID = 'a'
|
27
|
-
SUB_ELEC_ACCESS_URL = 'b'
|
28
|
-
SUB_ELEC_COLLECTION_NAME = 'c'
|
29
|
-
SUB_ELEC_COVERAGE = 'g'
|
30
|
-
|
31
|
-
# TODO: evaluate this in context of changed boundwiths processing
|
32
|
-
# a subfield code NOT used by the MARC 21 spec for 852 holdings records.
|
33
|
-
# we add this subfield during preprocessing to store boundwith record IDs.
|
34
|
-
SUB_BOUND_WITH_ID = 'y'
|
35
|
-
|
36
|
-
# MARC enrichment originating from Alma Api
|
37
|
-
# @see https://developers.exlibrisgroup.com/alma/apis/docs/bibs/R0VUIC9hbG1hd3MvdjEvYmlicy97bW1zX2lkfQ==/ Alma docs
|
38
|
-
module AlmaApi
|
39
|
-
TAG_PHYSICAL_INVENTORY = 'AVA'
|
40
|
-
TAG_DIGITAL_INVENTORY = 'AVA'
|
41
|
-
TAG_ELECTRONIC_INVENTORY = 'AVE'
|
42
|
-
|
43
|
-
SUB_PHYSICAL_CALL_NUMBER = 'd'
|
44
|
-
SUB_PHYSICAL_CALL_NUMBER_TYPE = 'k'
|
45
|
-
|
46
|
-
SUB_HOLDING_LOCATION_CODE = 'j'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|