loc_mods 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +11 -3
- data/lib/loc_mods/copy_information.rb +2 -1
- data/lib/loc_mods/date_other.rb +1 -1
- data/lib/loc_mods/non_sort.rb +19 -0
- data/lib/loc_mods/note.rb +3 -1
- data/lib/loc_mods/origin_info.rb +2 -1
- data/lib/loc_mods/record.rb +2 -2
- data/lib/loc_mods/related_item.rb +6 -1
- data/lib/loc_mods/subject.rb +3 -2
- data/lib/loc_mods/title_info.rb +4 -2
- data/lib/loc_mods/version.rb +1 -1
- metadata +14 -29
- data/lib/loc_mods/origin_info_definition.rb +0 -56
- data/lib/loc_mods/subject_definition.rb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b15a4efe6f5c0bf6287f01e8f3b9d14bf4611f0ec80c50a94eaf01aea0d27b0
|
4
|
+
data.tar.gz: 7c1c47497f88abc231351b6a19703641e8b7f910a8c119222872208dc339fe97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb267c94c7de7b895ccf168ca9b0a37133afce833981a332e43f3f82822aeec27ada4b4becedb1b7196ebcaab97bd5c90c68ee8fd23ab463b82500b0a72f7b7a
|
7
|
+
data.tar.gz: 49f9d610121df295c904cede6245d4dd907bbba9c919879ccf8e44211b095bd23700452b4d4d6a670f2e5e579a6fc3e06ad70d1fa450f1c9de35ff1f01ff6144
|
data/README.adoc
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= Library of Congress MODS in Ruby
|
2
2
|
|
3
|
-
image:https://img.shields.io/gem/v/
|
4
|
-
image:https://github.com/relaton/
|
5
|
-
image:https://codeclimate.com/github/relaton/
|
3
|
+
image:https://img.shields.io/gem/v/loc_mods.svg["Gem Version", link="https://rubygems.org/gems/loc_mods"]
|
4
|
+
image:https://github.com/relaton/loc_mods/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/loc_mods/actions?workflow=rake"]
|
5
|
+
image:https://codeclimate.com/github/relaton/loc_mods/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/loc_mods"]
|
6
6
|
|
7
7
|
== Purpose
|
8
8
|
|
@@ -24,6 +24,14 @@ LocMods::Collection.from_xml(File.read("spec/fixtures/record_1.xml"))
|
|
24
24
|
LocMods::Collection.from_xml(File.read("reference/allrecords-MODS.xml"))
|
25
25
|
----
|
26
26
|
|
27
|
+
== Testing
|
28
|
+
|
29
|
+
[source,sh]
|
30
|
+
----
|
31
|
+
bin/update-nist-mods
|
32
|
+
|
33
|
+
----
|
34
|
+
|
27
35
|
== License
|
28
36
|
|
29
37
|
Copyright Ribose.
|
@@ -14,7 +14,8 @@ module LocMods
|
|
14
14
|
attribute :shelf_locator, Shale::Type::String, collection: true
|
15
15
|
attribute :electronic_locator, Shale::Type::String, collection: true
|
16
16
|
attribute :note, Note, collection: true
|
17
|
-
attribute :enumeration_and_chronology, EnumerationAndChronology,
|
17
|
+
attribute :enumeration_and_chronology, EnumerationAndChronology,
|
18
|
+
collection: true
|
18
19
|
attribute :item_identifier, ItemIdentifier, collection: true
|
19
20
|
|
20
21
|
xml do
|
data/lib/loc_mods/date_other.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "shale"
|
4
|
+
|
5
|
+
module LocMods
|
6
|
+
class NonSort < Shale::Mapper
|
7
|
+
attribute :content, Shale::Type::String
|
8
|
+
attribute :space, Shale::Type::String
|
9
|
+
|
10
|
+
xml do
|
11
|
+
root "nonSort"
|
12
|
+
namespace "http://www.loc.gov/mods/v3", nil
|
13
|
+
|
14
|
+
map_content to: :content
|
15
|
+
map_attribute "space", to: :space,
|
16
|
+
namespace: "http://www.w3.org/XML/1998/namespace", prefix: "xml"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/loc_mods/note.rb
CHANGED
@@ -7,7 +7,8 @@ module LocMods
|
|
7
7
|
attribute :content, Shale::Type::String
|
8
8
|
attribute :display_label, Shale::Type::String
|
9
9
|
attribute :type, Shale::Type::String
|
10
|
-
attribute :id, Shale::Type::
|
10
|
+
attribute :id, Shale::Type::String
|
11
|
+
attribute :script, Shale::Type::String
|
11
12
|
|
12
13
|
xml do
|
13
14
|
root "note"
|
@@ -17,6 +18,7 @@ module LocMods
|
|
17
18
|
map_attribute "displayLabel", to: :display_label
|
18
19
|
map_attribute "type", to: :type
|
19
20
|
map_attribute "ID", to: :id
|
21
|
+
map_attribute "script", to: :script
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
data/lib/loc_mods/origin_info.rb
CHANGED
@@ -39,6 +39,7 @@ module LocMods
|
|
39
39
|
map_attribute "displayLabel", to: :display_label
|
40
40
|
map_attribute "altRepGroup", to: :alt_rep_group
|
41
41
|
map_attribute "eventType", to: :event_type
|
42
|
+
|
42
43
|
map_element "place", to: :place
|
43
44
|
map_element "publisher", to: :publisher
|
44
45
|
map_element "dateIssued", to: :date_issued
|
@@ -48,8 +49,8 @@ module LocMods
|
|
48
49
|
map_element "dateModified", to: :date_modified
|
49
50
|
map_element "copyrightDate", to: :copyright_date
|
50
51
|
map_element "dateOther", to: :date_other
|
51
|
-
map_element "edition", to: :edition
|
52
52
|
map_element "issuance", to: :issuance
|
53
|
+
map_element "edition", to: :edition
|
53
54
|
map_element "frequency", to: :frequency
|
54
55
|
end
|
55
56
|
end
|
data/lib/loc_mods/record.rb
CHANGED
@@ -36,7 +36,7 @@ module LocMods
|
|
36
36
|
attribute :language, Language, collection: true
|
37
37
|
attribute :location, Location, collection: true
|
38
38
|
attribute :name, Name, collection: true
|
39
|
-
attribute :note,
|
39
|
+
attribute :note, Note, collection: true
|
40
40
|
attribute :origin_info, OriginInfo, collection: true
|
41
41
|
attribute :part, Part, collection: true
|
42
42
|
attribute :physical_description, PhysicalDescription, collection: true
|
@@ -62,12 +62,12 @@ module LocMods
|
|
62
62
|
map_element "originInfo", to: :origin_info
|
63
63
|
map_element "part", to: :part
|
64
64
|
map_element "physicalDescription", to: :physical_description
|
65
|
+
map_element "abstract", to: :abstract
|
65
66
|
map_element "note", to: :note
|
66
67
|
map_element "subject", to: :subject
|
67
68
|
map_element "location", to: :location
|
68
69
|
map_element "relatedItem", to: :related_item
|
69
70
|
map_element "identifier", to: :identifier
|
70
|
-
map_element "abstract", to: :abstract
|
71
71
|
map_element "accessCondition", to: :access_condition
|
72
72
|
map_element "classification", to: :classification
|
73
73
|
map_element "extension", to: :extension
|
@@ -40,7 +40,7 @@ module LocMods
|
|
40
40
|
attribute :language, Language, collection: true
|
41
41
|
attribute :location, Location, collection: true
|
42
42
|
attribute :name, SubjectName, collection: true
|
43
|
-
attribute :note,
|
43
|
+
attribute :note, Note, collection: true
|
44
44
|
attribute :origin_info, OriginInfo, collection: true
|
45
45
|
attribute :part, Part, collection: true
|
46
46
|
attribute :physical_description, PhysicalDescription, collection: true
|
@@ -51,6 +51,7 @@ module LocMods
|
|
51
51
|
attribute :target_audience, TargetAudience, collection: true
|
52
52
|
attribute :title_info, TitleInfo, collection: true
|
53
53
|
attribute :type_of_resource, TypeOfResource, collection: true
|
54
|
+
attribute :href, Shale::Type::String
|
54
55
|
|
55
56
|
xml do
|
56
57
|
root "relatedItem"
|
@@ -63,6 +64,10 @@ module LocMods
|
|
63
64
|
map_attribute "otherTypeURI", to: :other_type_uri
|
64
65
|
map_attribute "displayLabel", to: :display_label
|
65
66
|
map_attribute "ID", to: :id
|
67
|
+
map_attribute "href", to: :href,
|
68
|
+
namespace: "http://www.w3.org/1999/xlink",
|
69
|
+
prefix: "xlink"
|
70
|
+
|
66
71
|
map_element "abstract", to: :abstract
|
67
72
|
map_element "accessCondition", to: :access_condition
|
68
73
|
map_element "classification", to: :classification
|
data/lib/loc_mods/subject.rb
CHANGED
@@ -53,11 +53,12 @@ module LocMods
|
|
53
53
|
map_attribute "displayLabel", to: :display_label
|
54
54
|
map_attribute "altRepGroup", to: :alt_rep_group
|
55
55
|
map_attribute "usage", to: :usage
|
56
|
+
|
57
|
+
map_element "name", to: :name
|
58
|
+
map_element "titleInfo", to: :title_info
|
56
59
|
map_element "topic", to: :topic
|
57
60
|
map_element "geographic", to: :geographic
|
58
61
|
map_element "temporal", to: :temporal
|
59
|
-
map_element "titleInfo", to: :title_info
|
60
|
-
map_element "name", to: :name
|
61
62
|
map_element "geographicCode", to: :geographic_code
|
62
63
|
map_element "hierarchicalGeographic", to: :hierarchical_geographic
|
63
64
|
map_element "cartographics", to: :cartographics
|
data/lib/loc_mods/title_info.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "shale"
|
4
|
+
require_relative "non_sort"
|
4
5
|
|
5
6
|
module LocMods
|
6
7
|
class TitleInfo < Shale::Mapper
|
@@ -24,7 +25,7 @@ module LocMods
|
|
24
25
|
attribute :sub_title, Shale::Type::String, collection: true
|
25
26
|
attribute :part_number, Shale::Type::String, collection: true
|
26
27
|
attribute :part_name, Shale::Type::String, collection: true
|
27
|
-
attribute :non_sort,
|
28
|
+
attribute :non_sort, NonSort, collection: true
|
28
29
|
|
29
30
|
xml do
|
30
31
|
root "titleInfo"
|
@@ -46,11 +47,12 @@ module LocMods
|
|
46
47
|
map_attribute "script", to: :script
|
47
48
|
map_attribute "transliteration", to: :transliteration
|
48
49
|
map_attribute "displayLabel", to: :display_label
|
50
|
+
|
51
|
+
map_element "nonSort", to: :non_sort
|
49
52
|
map_element "title", to: :title
|
50
53
|
map_element "subTitle", to: :sub_title
|
51
54
|
map_element "partNumber", to: :part_number
|
52
55
|
map_element "partName", to: :part_name
|
53
|
-
map_element "nonSort", to: :non_sort
|
54
56
|
end
|
55
57
|
end
|
56
58
|
end
|
data/lib/loc_mods/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loc_mods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-05-14 00:00:00.000000000 Z
|
@@ -39,21 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: equivalent-xml
|
42
|
+
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
@@ -67,7 +53,7 @@ dependencies:
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: rspec
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
@@ -81,7 +67,7 @@ dependencies:
|
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: rubocop
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - ">="
|
@@ -95,7 +81,7 @@ dependencies:
|
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop
|
84
|
+
name: rubocop-performance
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - ">="
|
@@ -165,10 +151,10 @@ files:
|
|
165
151
|
- lib/loc_mods/location.rb
|
166
152
|
- lib/loc_mods/name.rb
|
167
153
|
- lib/loc_mods/name_part.rb
|
154
|
+
- lib/loc_mods/non_sort.rb
|
168
155
|
- lib/loc_mods/note.rb
|
169
156
|
- lib/loc_mods/occupation.rb
|
170
157
|
- lib/loc_mods/origin_info.rb
|
171
|
-
- lib/loc_mods/origin_info_definition.rb
|
172
158
|
- lib/loc_mods/part.rb
|
173
159
|
- lib/loc_mods/physical_description.rb
|
174
160
|
- lib/loc_mods/physical_description_note.rb
|
@@ -190,7 +176,6 @@ files:
|
|
190
176
|
- lib/loc_mods/string_plus_language_plus_authority.rb
|
191
177
|
- lib/loc_mods/string_plus_language_plus_supplied.rb
|
192
178
|
- lib/loc_mods/subject.rb
|
193
|
-
- lib/loc_mods/subject_definition.rb
|
194
179
|
- lib/loc_mods/subject_name.rb
|
195
180
|
- lib/loc_mods/subject_title_info.rb
|
196
181
|
- lib/loc_mods/table_of_contents.rb
|
@@ -204,14 +189,14 @@ files:
|
|
204
189
|
- references/allrecords-MODS.xml
|
205
190
|
- references/mods-3-7.xsd
|
206
191
|
- sig/mods.rbs
|
207
|
-
homepage: https://github.com/relaton/
|
192
|
+
homepage: https://github.com/relaton/loc_mods
|
208
193
|
licenses:
|
209
194
|
- BSD-2-Clause
|
210
195
|
metadata:
|
211
|
-
homepage_uri: https://github.com/relaton/
|
212
|
-
source_code_uri: https://github.com/relaton/
|
213
|
-
changelog_uri: https://github.com/relaton/
|
214
|
-
post_install_message:
|
196
|
+
homepage_uri: https://github.com/relaton/loc_mods
|
197
|
+
source_code_uri: https://github.com/relaton/loc_mods
|
198
|
+
changelog_uri: https://github.com/relaton/loc_mods
|
199
|
+
post_install_message:
|
215
200
|
rdoc_options: []
|
216
201
|
require_paths:
|
217
202
|
- lib
|
@@ -226,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
211
|
- !ruby/object:Gem::Version
|
227
212
|
version: '0'
|
228
213
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
-
signing_key:
|
214
|
+
rubygems_version: 3.3.27
|
215
|
+
signing_key:
|
231
216
|
specification_version: 4
|
232
217
|
summary: Library of Congress MODS / MADS parser
|
233
218
|
test_files: []
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "shale"
|
4
|
-
|
5
|
-
require_relative "date"
|
6
|
-
require_relative "date_other"
|
7
|
-
require_relative "place"
|
8
|
-
require_relative "publisher"
|
9
|
-
require_relative "edition"
|
10
|
-
|
11
|
-
module LocMods
|
12
|
-
class OriginInfo < Shale::Mapper
|
13
|
-
attribute :lang, Shale::Type::String
|
14
|
-
attribute :script, Shale::Type::String
|
15
|
-
attribute :transliteration, Shale::Type::String
|
16
|
-
attribute :display_label, Shale::Type::String
|
17
|
-
attribute :alt_rep_group, Shale::Type::String
|
18
|
-
attribute :event_type, Shale::Type::String
|
19
|
-
attribute :place, Place, collection: true
|
20
|
-
attribute :publisher, Publisher, collection: true
|
21
|
-
attribute :date_issued, Date, collection: true
|
22
|
-
attribute :date_created, Date, collection: true
|
23
|
-
attribute :date_captured, Date, collection: true
|
24
|
-
attribute :date_valid, Date, collection: true
|
25
|
-
attribute :date_modified, Date, collection: true
|
26
|
-
attribute :copyright_date, Date, collection: true
|
27
|
-
attribute :date_other, DateOther, collection: true
|
28
|
-
attribute :edition, Edition, collection: true
|
29
|
-
attribute :issuance, Shale::Type::String, collection: true
|
30
|
-
attribute :frequency, Shale::Type::String, collection: true
|
31
|
-
|
32
|
-
xml do
|
33
|
-
root "originInfo"
|
34
|
-
namespace "http://www.loc.gov/mods/v3", nil
|
35
|
-
|
36
|
-
map_attribute "lang", to: :lang
|
37
|
-
map_attribute "script", to: :script
|
38
|
-
map_attribute "transliteration", to: :transliteration
|
39
|
-
map_attribute "displayLabel", to: :display_label
|
40
|
-
map_attribute "altRepGroup", to: :alt_rep_group
|
41
|
-
map_attribute "eventType", to: :event_type
|
42
|
-
map_element "place", to: :place
|
43
|
-
map_element "publisher", to: :publisher
|
44
|
-
map_element "dateIssued", to: :date_issued
|
45
|
-
map_element "dateCreated", to: :date_created
|
46
|
-
map_element "dateCaptured", to: :date_captured
|
47
|
-
map_element "dateValid", to: :date_valid
|
48
|
-
map_element "dateModified", to: :date_modified
|
49
|
-
map_element "copyrightDate", to: :copyright_date
|
50
|
-
map_element "dateOther", to: :date_other
|
51
|
-
map_element "edition", to: :edition
|
52
|
-
map_element "issuance", to: :issuance
|
53
|
-
map_element "frequency", to: :frequency
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "shale"
|
4
|
-
|
5
|
-
require_relative "cartographics"
|
6
|
-
require_relative "genre"
|
7
|
-
require_relative "geographic_code"
|
8
|
-
require_relative "hierarchical_geographic"
|
9
|
-
require_relative "subject_name"
|
10
|
-
require_relative "subject_title_info"
|
11
|
-
require_relative "temporal"
|
12
|
-
require_relative "occupation"
|
13
|
-
|
14
|
-
module LocMods
|
15
|
-
class Subject < Shale::Mapper
|
16
|
-
attribute :id, Shale::Type::Value
|
17
|
-
attribute :authority, Shale::Type::String
|
18
|
-
attribute :authority_uri, Shale::Type::Value
|
19
|
-
attribute :value_uri, Shale::Type::Value
|
20
|
-
attribute :lang, Shale::Type::String
|
21
|
-
attribute :script, Shale::Type::String
|
22
|
-
attribute :transliteration, Shale::Type::String
|
23
|
-
attribute :display_label, Shale::Type::String
|
24
|
-
attribute :alt_rep_group, Shale::Type::String
|
25
|
-
attribute :usage, Shale::Type::Value
|
26
|
-
attribute :topic, Shale::Type::String, collection: true
|
27
|
-
attribute :geographic, Shale::Type::String, collection: true
|
28
|
-
attribute :temporal, Temporal, collection: true
|
29
|
-
attribute :title_info, SubjectTitleInfo, collection: true
|
30
|
-
attribute :name, SubjectName, collection: true
|
31
|
-
attribute :geographic_code, GeographicCode, collection: true
|
32
|
-
attribute :hierarchical_geographic, HierarchicalGeographic, collection: true
|
33
|
-
attribute :cartographics, Cartographics, collection: true
|
34
|
-
attribute :occupation, Occupation, collection: true
|
35
|
-
attribute :genre, Genre, collection: true
|
36
|
-
|
37
|
-
xml do
|
38
|
-
root "subject"
|
39
|
-
namespace "http://www.loc.gov/mods/v3", nil
|
40
|
-
|
41
|
-
map_attribute "ID", to: :id
|
42
|
-
map_attribute "authority", to: :authority
|
43
|
-
map_attribute "authorityURI", to: :authority_uri
|
44
|
-
map_attribute "valueURI", to: :value_uri
|
45
|
-
map_attribute "lang", to: :lang
|
46
|
-
map_attribute "script", to: :script
|
47
|
-
map_attribute "transliteration", to: :transliteration
|
48
|
-
map_attribute "displayLabel", to: :display_label
|
49
|
-
map_attribute "altRepGroup", to: :alt_rep_group
|
50
|
-
map_attribute "usage", to: :usage
|
51
|
-
map_element "topic", to: :topic
|
52
|
-
map_element "geographic", to: :geographic
|
53
|
-
map_element "temporal", to: :temporal
|
54
|
-
map_element "titleInfo", to: :title_info
|
55
|
-
map_element "name", to: :name
|
56
|
-
map_element "geographicCode", to: :geographic_code
|
57
|
-
map_element "hierarchicalGeographic", to: :hierarchical_geographic
|
58
|
-
map_element "cartographics", to: :cartographics
|
59
|
-
map_element "occupation", to: :occupation
|
60
|
-
map_element "genre", to: :genre
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|