pennmarc 1.0.8 → 1.0.10
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/enriched_marc.rb +11 -0
- data/lib/pennmarc/helpers/classification.rb +95 -0
- data/lib/pennmarc/helpers/database.rb +3 -3
- data/lib/pennmarc/helpers/link.rb +2 -2
- data/lib/pennmarc/helpers/note.rb +5 -4
- data/lib/pennmarc/helpers/series.rb +2 -2
- data/lib/pennmarc/helpers/title.rb +3 -3
- data/lib/pennmarc/mappers.rb +10 -0
- data/lib/pennmarc/mappings/dewey_classification.yml +11 -0
- data/lib/pennmarc/mappings/loc_classification.yml +22 -0
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/classification_spec.rb +41 -0
- data/spec/lib/pennmarc/helpers/database_spec.rb +10 -10
- data/spec/lib/pennmarc/helpers/link_spec.rb +6 -6
- data/spec/lib/pennmarc/helpers/note_spec.rb +2 -0
- data/spec/lib/pennmarc/helpers/series_spec.rb +8 -8
- data/spec/lib/pennmarc/helpers/title_spec.rb +6 -6
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27d9b9618c0824c62064d486d486850948dd079dd9667c2955cc7c04556e4656
|
|
4
|
+
data.tar.gz: d741e303841db97060e8747e751ebfa79e3b37b9391eec6ab072d71cb560267a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36b165a655fc431225d39004be0470e35760a41d62693455a63c2e6b6f346391803fdd7955b418b890a7531eb45b3a687fb5f9a5cd0a8aecce884ae3f8d2b82f
|
|
7
|
+
data.tar.gz: 01cfac580c76988881af4b639957f6351db48f6998947b84e68aa3450c9c905bef9c04c5895489db063296d8e7810c332218fb5cf36ff42b3f4bb5cb519ea098
|
|
@@ -32,5 +32,16 @@ module PennMARC
|
|
|
32
32
|
# a subfield code NOT used by the MARC 21 spec for 852 holdings records.
|
|
33
33
|
# we add this subfield during preprocessing to store boundwith record IDs.
|
|
34
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
|
+
end
|
|
35
46
|
end
|
|
36
47
|
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PennMARC
|
|
4
|
+
# Generates library of congress and dewey classifications using call number data.
|
|
5
|
+
class Classification < Helper
|
|
6
|
+
# Subfield value that identifies Library of Congress call number
|
|
7
|
+
LOC_CALL_NUMBER_TYPE = '0'
|
|
8
|
+
|
|
9
|
+
# Subfield value that identifies Dewey call number
|
|
10
|
+
DEWEY_CALL_NUMBER_TYPE = '1'
|
|
11
|
+
|
|
12
|
+
# Hash that maps call number type to the appropriate mapper
|
|
13
|
+
CLASSIFICATION_MAPS = {
|
|
14
|
+
LOC_CALL_NUMBER_TYPE => Mappers.loc_classification,
|
|
15
|
+
DEWEY_CALL_NUMBER_TYPE => Mappers.dewey_classification
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
18
|
+
# Enriched MARC tags that hold classification data
|
|
19
|
+
TAGS = [EnrichedMarc::TAG_ITEM, EnrichedMarc::AlmaApi::TAG_PHYSICAL_INVENTORY].freeze
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
# Parse classification values for faceting. We retrieve classification values from enriched MARC fields 'itm' or
|
|
23
|
+
# 'AVA' originating respectively from the Alma publishing process or from the Alma Api. We return the
|
|
24
|
+
# highest level LOC or Dewey classifications from each available call number, joining the class code with
|
|
25
|
+
# its title in a single string. See {PennMARC::EnrichedMarc} and {PennMARC::EnrichedMarc::AlmaApi} for more
|
|
26
|
+
# information on the enriched MARC fields.
|
|
27
|
+
# @see https://developers.exlibrisgroup.com/alma/apis/docs/bibs/R0VUIC9hbG1hd3MvdjEvYmlicy97bW1zX2lkfQ==/ AVA docs
|
|
28
|
+
# @param [MARC::Record] record
|
|
29
|
+
# @return [Array<String>] array of classifications
|
|
30
|
+
def facet(record)
|
|
31
|
+
record.fields(TAGS).flat_map do |field|
|
|
32
|
+
call_number_type = subfield_values(field, call_number_type_sf(field))&.first
|
|
33
|
+
call_numbers = subfield_values(field, call_number_sf(field))
|
|
34
|
+
|
|
35
|
+
call_numbers.filter_map do |call_number|
|
|
36
|
+
class_code = call_number[0]
|
|
37
|
+
title = translate_classification(class_code, call_number_type)
|
|
38
|
+
next if title.blank?
|
|
39
|
+
|
|
40
|
+
format_facet(class_code, call_number_type, title)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
# Retrieve subfield code that stores the call number on enriched marc field
|
|
48
|
+
# @param [MARC::DataField] field
|
|
49
|
+
# @return [String]
|
|
50
|
+
def call_number_sf(field)
|
|
51
|
+
return EnrichedMarc::SUB_ITEM_CALL_NUMBER if field.tag == EnrichedMarc::TAG_ITEM
|
|
52
|
+
|
|
53
|
+
EnrichedMarc::AlmaApi::SUB_PHYSICAL_CALL_NUMBER
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Retrieve subfield code that stores call number type on enriched marc field
|
|
57
|
+
# @param [MARC::DataField] field
|
|
58
|
+
# @return [String]
|
|
59
|
+
def call_number_type_sf(field)
|
|
60
|
+
return EnrichedMarc::SUB_ITEM_CALL_NUMBER_TYPE if field.tag == EnrichedMarc::TAG_ITEM
|
|
61
|
+
|
|
62
|
+
EnrichedMarc::AlmaApi::SUB_PHYSICAL_CALL_NUMBER_TYPE
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# retrieve title of classification based on single char classification code and call number type
|
|
66
|
+
# @param[String] class_code classification code
|
|
67
|
+
# @param[String] call_number_type value from call number type subfield
|
|
68
|
+
# @return [String, NilClass]
|
|
69
|
+
def translate_classification(class_code, call_number_type)
|
|
70
|
+
map = CLASSIFICATION_MAPS[call_number_type]
|
|
71
|
+
|
|
72
|
+
return if map.blank?
|
|
73
|
+
|
|
74
|
+
translate_relator(class_code, map)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# format classification facet by joining single character classification code with its corresponding title.
|
|
78
|
+
# Our Dewey mapping codes are single digit, so we must concatenate '00' to the class code to accurately reflect
|
|
79
|
+
# Dewey class codes.
|
|
80
|
+
# @return [String]
|
|
81
|
+
def format_facet(class_code, call_number_type, title)
|
|
82
|
+
return [class_code, title].join(' - ') if loc_call_number_type?(call_number_type)
|
|
83
|
+
|
|
84
|
+
["#{class_code}00", title].join(' - ')
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Determine whether call number type is library of congress
|
|
88
|
+
# @param [String] call_number_type value from call number type subfield
|
|
89
|
+
# @return [Boolean]
|
|
90
|
+
def loc_call_number_type?(call_number_type)
|
|
91
|
+
call_number_type == '0'
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -18,7 +18,7 @@ module PennMARC
|
|
|
18
18
|
# local field 944}. Only returns database subtype if Penn's Database facet value is present in subfield 'a'.
|
|
19
19
|
# @param [Marc::Record]
|
|
20
20
|
# @return [Array<string>] Array of types
|
|
21
|
-
def
|
|
21
|
+
def type_facet(record)
|
|
22
22
|
record.fields('944').filter_map do |field|
|
|
23
23
|
# skip unless specified database format type present
|
|
24
24
|
next unless subfield_value?(field, 'a', /#{DATABASES_FACET_VALUE}/o)
|
|
@@ -34,7 +34,7 @@ module PennMARC
|
|
|
34
34
|
# subfield '2'.
|
|
35
35
|
# @param [Marc::Record]
|
|
36
36
|
# @return [Array<string>] Array of categories
|
|
37
|
-
def
|
|
37
|
+
def category_facet(record)
|
|
38
38
|
return [] unless curated_db?(record)
|
|
39
39
|
|
|
40
40
|
record.fields('943').filter_map do |field|
|
|
@@ -55,7 +55,7 @@ module PennMARC
|
|
|
55
55
|
# an empty array.
|
|
56
56
|
# @param [Marc::Record]
|
|
57
57
|
# @return [Array<string>] Array of "category--subcategory"
|
|
58
|
-
def
|
|
58
|
+
def subcategory_facet(record)
|
|
59
59
|
return [] unless curated_db?(record)
|
|
60
60
|
|
|
61
61
|
record.fields('943').filter_map do |field|
|
|
@@ -13,7 +13,7 @@ module PennMARC
|
|
|
13
13
|
# Full text links from MARC 856 fields.
|
|
14
14
|
# @param [MARC::Record] record
|
|
15
15
|
# @return [Array] array of hashes
|
|
16
|
-
def
|
|
16
|
+
def full_text_links(record)
|
|
17
17
|
indicator2_options = %w[0 1]
|
|
18
18
|
links_from_record(record, indicator2_options)
|
|
19
19
|
end
|
|
@@ -21,7 +21,7 @@ module PennMARC
|
|
|
21
21
|
# Web text links from MARC 856 fields.
|
|
22
22
|
# @param [MARC::Record] record
|
|
23
23
|
# @return [Array] array of hashes
|
|
24
|
-
def
|
|
24
|
+
def web_links(record)
|
|
25
25
|
indicator2_options = ['2', ' ', '']
|
|
26
26
|
links_from_record(record, indicator2_options)
|
|
27
27
|
end
|
|
@@ -6,15 +6,16 @@ module PennMARC
|
|
|
6
6
|
class << self
|
|
7
7
|
# Retrieve notes for display from fields {https://www.oclc.org/bibformats/en/5xx/500.html 500},
|
|
8
8
|
# {https://www.oclc.org/bibformats/en/5xx/502.html 502}, {https://www.oclc.org/bibformats/en/5xx/504.html 504},
|
|
9
|
-
# {https://www.oclc.org/bibformats/en/5xx/515.html 515}, {https://www.oclc.org/bibformats/en/5xx/518.html 518}
|
|
9
|
+
# {https://www.oclc.org/bibformats/en/5xx/515.html 515}, {https://www.oclc.org/bibformats/en/5xx/518.html 518},
|
|
10
10
|
# {https://www.oclc.org/bibformats/en/5xx/525.html 525}, {https://www.oclc.org/bibformats/en/5xx/533.html 533},
|
|
11
|
-
# {https://www.oclc.org/bibformats/en/5xx/
|
|
12
|
-
# {https://www.oclc.org/bibformats/en/5xx/
|
|
11
|
+
# {https://www.oclc.org/bibformats/en/5xx/540.html 540}, {https://www.oclc.org/bibformats/en/5xx/550.html 550},
|
|
12
|
+
# {https://www.oclc.org/bibformats/en/5xx/580.html 580}, {https://www.oclc.org/bibformats/en/5xx/586.html 586},
|
|
13
|
+
# {https://www.oclc.org/bibformats/en/5xx/588.html 588}
|
|
13
14
|
# and their linked alternates.
|
|
14
15
|
# @param [MARC::Record] record
|
|
15
16
|
# @return [Array<String>]
|
|
16
17
|
def notes_show(record)
|
|
17
|
-
notes_fields = %w[500 502 504 515 518 525 533 550 580 586 588]
|
|
18
|
+
notes_fields = %w[500 502 504 515 518 525 533 540 550 580 586 588]
|
|
18
19
|
record.fields(notes_fields + ['880']).filter_map do |field|
|
|
19
20
|
next if field.tag == '880' && subfield_value_not_in?(field, '6', notes_fields)
|
|
20
21
|
|
|
@@ -84,7 +84,7 @@ module PennMARC
|
|
|
84
84
|
# https://www.loc.gov/marc/bibliographic/bd780.html
|
|
85
85
|
# @param [MARC::Record] record
|
|
86
86
|
# @return [String] continues fields string
|
|
87
|
-
def
|
|
87
|
+
def get_continues_show(record)
|
|
88
88
|
continues(record, '780')
|
|
89
89
|
end
|
|
90
90
|
|
|
@@ -94,7 +94,7 @@ module PennMARC
|
|
|
94
94
|
# https://www.loc.gov/marc/bibliographic/bd785.html
|
|
95
95
|
# @param [MARC::Record] record
|
|
96
96
|
# @return [String] continued by fields string
|
|
97
|
-
def
|
|
97
|
+
def get_continued_by_show(record)
|
|
98
98
|
continues(record, '785')
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -149,7 +149,7 @@ module PennMARC
|
|
|
149
149
|
# title browse and we will not be supporting that at this time
|
|
150
150
|
# @param [MARC::Record] record
|
|
151
151
|
# @return [Array<String>] Array of standardized titles as strings
|
|
152
|
-
def
|
|
152
|
+
def standardized_show(record)
|
|
153
153
|
standardized_titles = record.fields(%w[130 240]).map do |field|
|
|
154
154
|
join_subfields(field, &subfield_not_in?(%w[0 6 8 e w]))
|
|
155
155
|
end
|
|
@@ -177,7 +177,7 @@ module PennMARC
|
|
|
177
177
|
#
|
|
178
178
|
# @param [MARC::Record] record
|
|
179
179
|
# @return [Array<String>] Array of other titles as strings
|
|
180
|
-
def
|
|
180
|
+
def other_show(record)
|
|
181
181
|
other_titles = record.fields('246').map do |field|
|
|
182
182
|
join_subfields(field, &subfield_not_in?(%w[6 8]))
|
|
183
183
|
end
|
|
@@ -202,7 +202,7 @@ module PennMARC
|
|
|
202
202
|
# @todo what are e and w subfields?
|
|
203
203
|
# @param [MARC::Record] record
|
|
204
204
|
# @return [Array<String>] array of former titles
|
|
205
|
-
def
|
|
205
|
+
def former_show(record)
|
|
206
206
|
record.fields
|
|
207
207
|
.filter_map do |field|
|
|
208
208
|
next unless field.tag == '247' || (field.tag == '880' && subfield_value?(field, '6', /^247/))
|
data/lib/pennmarc/mappers.rb
CHANGED
|
@@ -23,6 +23,16 @@ module PennMARC
|
|
|
23
23
|
@relator ||= load_map('relator.yml')
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
# @return [Hash]
|
|
27
|
+
def loc_classification
|
|
28
|
+
@loc_classification ||= load_map('loc_classification.yml')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @return [Hash]
|
|
32
|
+
def dewey_classification
|
|
33
|
+
@dewey_classification ||= load_map('dewey_classification.yml')
|
|
34
|
+
end
|
|
35
|
+
|
|
26
36
|
# @param [String] filename of mapping file in config directory, with file extension
|
|
27
37
|
# @return [Hash] mapping as hash
|
|
28
38
|
def load_map(filename)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
A: General Works
|
|
3
|
+
B: Philosophy, Psychology, Religion
|
|
4
|
+
C: 'History: Auxiliary Sciences'
|
|
5
|
+
D: 'History: General & European'
|
|
6
|
+
E: 'History: United States'
|
|
7
|
+
F: 'History: Western Hemisphere'
|
|
8
|
+
G: Geography, Anthropology, Recreation
|
|
9
|
+
H: Social Science, Economics, Sociology
|
|
10
|
+
J: Political Science
|
|
11
|
+
K: Law
|
|
12
|
+
L: Education
|
|
13
|
+
M: Music
|
|
14
|
+
N: Fine Arts
|
|
15
|
+
P: Literature & Languages
|
|
16
|
+
Q: Science
|
|
17
|
+
R: Medicine
|
|
18
|
+
S: Agriculture
|
|
19
|
+
T: Technology
|
|
20
|
+
U: Military Science
|
|
21
|
+
V: Naval Science
|
|
22
|
+
Z: Bibliography & Library Science
|
data/lib/pennmarc/version.rb
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe 'PennMARC::Classification' do
|
|
4
|
+
include MarcSpecHelpers
|
|
5
|
+
|
|
6
|
+
let(:helper) { PennMARC::Classification }
|
|
7
|
+
let(:record) do
|
|
8
|
+
marc_record fields: [marc_field(tag: tag,
|
|
9
|
+
subfields: { call_number_type_sf => '0', call_number_sf => 'TA683 .B3 1909b' }),
|
|
10
|
+
marc_field(tag: tag,
|
|
11
|
+
subfields: { call_number_type_sf => '0', call_number_sf => 'QL756 .S643' }),
|
|
12
|
+
marc_field(tag: tag,
|
|
13
|
+
subfields: { call_number_type_sf => '1', call_number_sf => '691.3 B2141' }),
|
|
14
|
+
marc_field(tag: tag,
|
|
15
|
+
subfields: { call_number_type_sf => '1', call_number_sf => '378.748 POS1952.29' })]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '.facet' do
|
|
19
|
+
context 'with enrichment via the Alma publishing process' do
|
|
20
|
+
let(:tag) { PennMARC::EnrichedMarc::TAG_ITEM }
|
|
21
|
+
let(:call_number_type_sf) { PennMARC::EnrichedMarc::SUB_ITEM_CALL_NUMBER_TYPE }
|
|
22
|
+
let(:call_number_sf) { PennMARC::EnrichedMarc::SUB_ITEM_CALL_NUMBER }
|
|
23
|
+
|
|
24
|
+
it 'returns expected values' do
|
|
25
|
+
expect(helper.facet(record)).to contain_exactly('T - Technology', '600 - Technology',
|
|
26
|
+
'300 - Social sciences', 'Q - Science')
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'with enrichment with availability info via Alma Api' do
|
|
31
|
+
let(:tag) { PennMARC::EnrichedMarc::AlmaApi::TAG_PHYSICAL_INVENTORY }
|
|
32
|
+
let(:call_number_type_sf) { PennMARC::EnrichedMarc::AlmaApi::SUB_PHYSICAL_CALL_NUMBER_TYPE }
|
|
33
|
+
let(:call_number_sf) { PennMARC::EnrichedMarc::AlmaApi::SUB_PHYSICAL_CALL_NUMBER }
|
|
34
|
+
|
|
35
|
+
it 'returns expected values' do
|
|
36
|
+
expect(helper.facet(record)).to contain_exactly('T - Technology', '600 - Technology',
|
|
37
|
+
'300 - Social sciences', 'Q - Science')
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -21,39 +21,39 @@ describe 'PennMARC::Database' do
|
|
|
21
21
|
])
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
describe '.
|
|
24
|
+
describe '.type_facet' do
|
|
25
25
|
it 'returns database types' do
|
|
26
|
-
expect(helper.
|
|
27
|
-
|
|
26
|
+
expect(helper.type_facet(record)).to contain_exactly('Dictionaries and Thesauri (language based)',
|
|
27
|
+
'Reference and Handbooks')
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
context 'with uncurated database' do
|
|
31
31
|
it 'returns empty array' do
|
|
32
|
-
expect(helper.
|
|
32
|
+
expect(helper.type_facet(record_uncurated_db)).to be_empty
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
describe '.
|
|
37
|
+
describe '.category_facet' do
|
|
38
38
|
it 'returns database categories' do
|
|
39
|
-
expect(helper.
|
|
39
|
+
expect(helper.category_facet(record)).to contain_exactly('Humanities', 'Social Sciences')
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
context 'with uncurated database' do
|
|
43
43
|
it 'returns empty array' do
|
|
44
|
-
expect(helper.
|
|
44
|
+
expect(helper.category_facet(record_uncurated_db)).to be_empty
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
describe '.
|
|
49
|
+
describe '.subcategory_facet' do
|
|
50
50
|
it 'returns database subcategories' do
|
|
51
|
-
expect(helper.
|
|
51
|
+
expect(helper.subcategory_facet(record)).to contain_exactly('Social Sciences--Linguistics')
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
context 'with uncurated database' do
|
|
55
55
|
it 'returns empty array' do
|
|
56
|
-
expect(helper.
|
|
56
|
+
expect(helper.subcategory_facet(record_uncurated_db)).to be_empty
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -5,7 +5,7 @@ describe 'PennMARC::Link' do
|
|
|
5
5
|
|
|
6
6
|
let(:helper) { PennMARC::Link }
|
|
7
7
|
|
|
8
|
-
describe '.
|
|
8
|
+
describe '.full_text_link' do
|
|
9
9
|
let(:record) do
|
|
10
10
|
marc_record fields: [marc_field(tag: '856', subfields: { '3': 'Materials specified',
|
|
11
11
|
z: 'Public note',
|
|
@@ -15,12 +15,12 @@ describe 'PennMARC::Link' do
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it 'returns full text link text and url' do
|
|
18
|
-
expect(helper.
|
|
19
|
-
|
|
18
|
+
expect(helper.full_text_link(record)).to contain_exactly({ link_text: 'Materials specified Public note',
|
|
19
|
+
link_url: 'https://www.test-uri.com/' })
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
describe '.
|
|
23
|
+
describe '.web_link' do
|
|
24
24
|
let(:record) do
|
|
25
25
|
marc_record fields: [marc_field(tag: '856', subfields: { '3': 'Materials specified',
|
|
26
26
|
z: 'Public note',
|
|
@@ -30,8 +30,8 @@ describe 'PennMARC::Link' do
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it 'returns web link text and url' do
|
|
33
|
-
expect(helper.
|
|
34
|
-
|
|
33
|
+
expect(helper.web_link(record)).to contain_exactly({ link_text: 'Materials specified Public note',
|
|
34
|
+
link_url: 'https://www.test-uri.com/' })
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -18,6 +18,7 @@ describe 'PennMARC::Note' do
|
|
|
18
18
|
b: 'UK', c: 'Historical Association',
|
|
19
19
|
d: '1917', e: '434 reels',
|
|
20
20
|
f: '(Seized records)' }),
|
|
21
|
+
marc_field(tag: '540', subfields: { a: 'Restricted: Copying allowed only for nonprofit organizations' }),
|
|
21
22
|
marc_field(tag: '588', subfields: { a: 'Print version record', '5': 'LoC' }),
|
|
22
23
|
marc_field(tag: '880', subfields: { b: 'Alt PhD', c: 'Alt UPenn', d: 'Alt 2021', '6': '502' }),
|
|
23
24
|
marc_field(tag: '880', subfields: { b: 'Ignore Note', '6': '501' })
|
|
@@ -32,6 +33,7 @@ describe 'PennMARC::Note' do
|
|
|
32
33
|
'PhD University of Pennsylvania 2021',
|
|
33
34
|
'Includes bibliographical references (pages 329-[342]) and index.',
|
|
34
35
|
'Archives Microfilm UK Historical Association 1917 434 reels (Seized records)',
|
|
36
|
+
'Restricted: Copying allowed only for nonprofit organizations',
|
|
35
37
|
'Print version record', 'Alt PhD Alt UPenn Alt 2021')
|
|
36
38
|
end
|
|
37
39
|
end
|
|
@@ -18,7 +18,7 @@ describe 'PennMARC::Series' do
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
describe '.show' do
|
|
21
|
-
it 'returns the series' do
|
|
21
|
+
it 'returns the series values for display' do
|
|
22
22
|
expect(helper.show(record, relator_map: mapping)).to contain_exactly(
|
|
23
23
|
'Bean Bagatolvski 1997- bk. 1',
|
|
24
24
|
'Teachings of the feathered pillow',
|
|
@@ -28,7 +28,7 @@ describe 'PennMARC::Series' do
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
describe '.values' do
|
|
31
|
-
it 'returns the values' do
|
|
31
|
+
it 'returns the series values' do
|
|
32
32
|
expect(helper.values(record, relator_map: mapping)).to contain_exactly('Bean Bagatolvski 1997- bk. 1.')
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -43,15 +43,15 @@ describe 'PennMARC::Series' do
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
describe '.
|
|
47
|
-
it 'gets continues for display' do
|
|
48
|
-
expect(helper.
|
|
46
|
+
describe '.get_continues_show' do
|
|
47
|
+
it 'gets continues values for display' do
|
|
48
|
+
expect(helper.get_continues_show(record)).to contain_exactly('National Comfort Association')
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
describe '.
|
|
53
|
-
it 'gets continued by display' do
|
|
54
|
-
expect(helper.
|
|
52
|
+
describe '.get_continued_by_show' do
|
|
53
|
+
it 'gets continued by values for display' do
|
|
54
|
+
expect(helper.get_continued_by_show(record)).to contain_exactly('NCA quarterly comfortology bulletin')
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
end
|
|
@@ -195,7 +195,7 @@ describe 'PennMARC::Title' do
|
|
|
195
195
|
end
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
-
describe '.
|
|
198
|
+
describe '.standardized_show' do
|
|
199
199
|
let(:record) do
|
|
200
200
|
marc_record fields: [
|
|
201
201
|
marc_field(tag: '130', subfields: { a: 'Uniform Title', f: '2000', '8': 'Not Included' }),
|
|
@@ -208,7 +208,7 @@ describe 'PennMARC::Title' do
|
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
it 'returns the expected standardized title display values' do
|
|
211
|
-
values = helper.
|
|
211
|
+
values = helper.standardized_show(record)
|
|
212
212
|
expect(values).to contain_exactly(
|
|
213
213
|
'Another Uniform Title', 'Translated Uniform Title', 'Uniform Title 2000', 'Yet Another Uniform Title'
|
|
214
214
|
)
|
|
@@ -216,7 +216,7 @@ describe 'PennMARC::Title' do
|
|
|
216
216
|
end
|
|
217
217
|
end
|
|
218
218
|
|
|
219
|
-
describe '.
|
|
219
|
+
describe '.other_show' do
|
|
220
220
|
let(:record) do
|
|
221
221
|
marc_record fields: [
|
|
222
222
|
marc_field(tag: '246', subfields: { a: 'Varied Title', f: '2000', '8': 'Not Included' }),
|
|
@@ -227,13 +227,13 @@ describe 'PennMARC::Title' do
|
|
|
227
227
|
end
|
|
228
228
|
|
|
229
229
|
it 'returns the expected other title display values' do
|
|
230
|
-
expect(helper.
|
|
230
|
+
expect(helper.other_show(record)).to contain_exactly(
|
|
231
231
|
'Alternate Varied Title', 'Uncontrolled Title', 'Varied Title 2000'
|
|
232
232
|
)
|
|
233
233
|
end
|
|
234
234
|
end
|
|
235
235
|
|
|
236
|
-
describe '.
|
|
236
|
+
describe '.former_show' do
|
|
237
237
|
let(:record) do
|
|
238
238
|
marc_record fields: [
|
|
239
239
|
marc_field(tag: '247', subfields: { a: 'Former Title', n: 'Part', '6': 'Linkage', e: 'Append' }),
|
|
@@ -242,7 +242,7 @@ describe 'PennMARC::Title' do
|
|
|
242
242
|
end
|
|
243
243
|
|
|
244
244
|
it 'returns the expected former title value' do
|
|
245
|
-
values = helper.
|
|
245
|
+
values = helper.former_show(record)
|
|
246
246
|
expect(values).to contain_exactly 'Former Title Part Append', 'Alt Title Part'
|
|
247
247
|
expect(values).not_to include 'Linkage', '247'
|
|
248
248
|
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.10
|
|
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: 2023-12-
|
|
13
|
+
date: 2023-12-20 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activesupport
|
|
@@ -91,6 +91,7 @@ files:
|
|
|
91
91
|
- lib/pennmarc/heading_control.rb
|
|
92
92
|
- lib/pennmarc/helpers/access.rb
|
|
93
93
|
- lib/pennmarc/helpers/citation.rb
|
|
94
|
+
- lib/pennmarc/helpers/classification.rb
|
|
94
95
|
- lib/pennmarc/helpers/creator.rb
|
|
95
96
|
- lib/pennmarc/helpers/database.rb
|
|
96
97
|
- lib/pennmarc/helpers/date.rb
|
|
@@ -109,8 +110,10 @@ files:
|
|
|
109
110
|
- lib/pennmarc/helpers/subject.rb
|
|
110
111
|
- lib/pennmarc/helpers/title.rb
|
|
111
112
|
- lib/pennmarc/mappers.rb
|
|
113
|
+
- lib/pennmarc/mappings/dewey_classification.yml
|
|
112
114
|
- lib/pennmarc/mappings/iso639-2-languages.yml
|
|
113
115
|
- lib/pennmarc/mappings/iso639-3-languages.yml
|
|
116
|
+
- lib/pennmarc/mappings/loc_classification.yml
|
|
114
117
|
- lib/pennmarc/mappings/locations.yml
|
|
115
118
|
- lib/pennmarc/mappings/relator.yml
|
|
116
119
|
- lib/pennmarc/parser.rb
|
|
@@ -120,6 +123,7 @@ files:
|
|
|
120
123
|
- spec/fixtures/marcxml/test.xml
|
|
121
124
|
- spec/lib/pennmarc/helpers/access_spec.rb
|
|
122
125
|
- spec/lib/pennmarc/helpers/citation_spec.rb
|
|
126
|
+
- spec/lib/pennmarc/helpers/classification_spec.rb
|
|
123
127
|
- spec/lib/pennmarc/helpers/creator_spec.rb
|
|
124
128
|
- spec/lib/pennmarc/helpers/database_spec.rb
|
|
125
129
|
- spec/lib/pennmarc/helpers/date_spec.rb
|