cocina-models 0.126.0 → 0.128.0
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/AGENTS.md +2 -2
- data/Gemfile.lock +12 -12
- data/bin/validate-data +4 -4
- data/lib/cocina/models/admin_policy_access_template.rb +11 -11
- data/lib/cocina/models/applies_to.rb +37 -3
- data/lib/cocina/models/descriptive_basic_value.rb +1 -3
- data/lib/cocina/models/descriptive_identifier.rb +2 -3
- data/lib/cocina/models/descriptive_value.rb +3 -3
- data/lib/cocina/models/dro_access.rb +11 -11
- data/lib/cocina/models/language.rb +1 -1
- data/lib/cocina/models/mapping/from_mods/description_builder.rb +5 -2
- data/lib/cocina/models/mapping/from_mods/related_resource.rb +2 -1
- data/lib/cocina/models/related_resource.rb +0 -2
- data/lib/cocina/models/request_admin_policy.rb +1 -1
- data/lib/cocina/models/request_collection.rb +1 -1
- data/lib/cocina/models/request_dro.rb +1 -1
- data/lib/cocina/models/title.rb +3 -3
- data/lib/cocina/models/validators/composite_description_validator.rb +2 -2
- data/lib/cocina/models/validators/description_location_visitor_validator.rb +59 -0
- data/lib/cocina/models/version.rb +1 -1
- data/lib/cocina/rspec/factories.rb +3 -9
- data/schema.json +73 -206
- metadata +3 -3
- data/lib/cocina/models/validators/description_location_source_code_visitor_validator.rb +0 -43
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e36b1b2a099fed16e2cc7c49b46479b80ce03f2ee65ef5a87ef49e9d74379ac6
|
|
4
|
+
data.tar.gz: 878705f40ff9598207bcee6a2e8ff0c89f5dbcc8e9bc9fc5c755642c93c30440
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ea6f8363bb8a487a0670c8c062859ee1c16f618f6a12e5224ee0eb4ee30ebb6165a124c2d478f4e34250e9b3655a95b8d9f503e38f6afea4c130dfd9d4b3de8
|
|
7
|
+
data.tar.gz: c0de7bb6610cfa67a118a4c847add1da3a4d395fb0b8325e9bd2020a88a9a8555afa04fabce3e860b21569e9741d38b5e89f0e64c47e32a7dec22165791b7261
|
data/AGENTS.md
CHANGED
|
@@ -167,7 +167,7 @@ Generate a short kebab-case slug summarizing the query (e.g., `invalid-encoding`
|
|
|
167
167
|
|
|
168
168
|
The comment lines must use `#` so the file remains valid jq syntax. When resuming (Step 2 resume path), parse these comment sections by their labels to reconstruct the inputs.
|
|
169
169
|
|
|
170
|
-
Find the most recent `.jsonl.
|
|
170
|
+
Find the most recent `.jsonl.zst` file in the project root by listing `*.jsonl.zst` files sorted by name descending and taking the first result.
|
|
171
171
|
|
|
172
172
|
### Step 8 — Output
|
|
173
173
|
|
|
@@ -178,7 +178,7 @@ Present:
|
|
|
178
178
|
4. A ready-to-run shell snippet:
|
|
179
179
|
|
|
180
180
|
```
|
|
181
|
-
|
|
181
|
+
zstdcat <most-recent .jsonl.zst filename> \
|
|
182
182
|
| pv -l -s 5500000 \
|
|
183
183
|
| parallel -j$(sysctl -n hw.logicalcpu) --pipe --block 50M --recend '\n' \
|
|
184
184
|
jq -rcf <slug>.jq.txt \
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
cocina-models (0.
|
|
4
|
+
cocina-models (0.128.0)
|
|
5
5
|
activesupport
|
|
6
6
|
cocina_display
|
|
7
7
|
deprecation
|
|
@@ -102,11 +102,11 @@ GEM
|
|
|
102
102
|
iso8601 (0.13.0)
|
|
103
103
|
janeway-jsonpath (1.0.0)
|
|
104
104
|
json (2.20.0)
|
|
105
|
-
jsonschema_rs (0.46.
|
|
105
|
+
jsonschema_rs (0.46.10-arm64-darwin)
|
|
106
106
|
bigdecimal (>= 3.1, < 5)
|
|
107
|
-
jsonschema_rs (0.46.
|
|
107
|
+
jsonschema_rs (0.46.10-x86_64-linux)
|
|
108
108
|
bigdecimal (>= 3.1, < 5)
|
|
109
|
-
language_server-protocol (3.17.0.
|
|
109
|
+
language_server-protocol (3.17.0.6)
|
|
110
110
|
lint_roller (1.1.0)
|
|
111
111
|
logger (1.7.0)
|
|
112
112
|
minitest (6.0.6)
|
|
@@ -162,7 +162,7 @@ GEM
|
|
|
162
162
|
rspec-support (3.13.7)
|
|
163
163
|
rspec_junit_formatter (0.6.0)
|
|
164
164
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
165
|
-
rubocop (1.88.
|
|
165
|
+
rubocop (1.88.1)
|
|
166
166
|
json (~> 2.3)
|
|
167
167
|
language_server-protocol (~> 3.17.0.2)
|
|
168
168
|
lint_roller (~> 1.1.0)
|
|
@@ -173,7 +173,7 @@ GEM
|
|
|
173
173
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
174
174
|
ruby-progressbar (~> 1.7)
|
|
175
175
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
176
|
-
rubocop-ast (1.
|
|
176
|
+
rubocop-ast (1.50.0)
|
|
177
177
|
parser (>= 3.3.7.2)
|
|
178
178
|
prism (~> 1.7)
|
|
179
179
|
rubocop-rake (0.7.1)
|
|
@@ -232,7 +232,7 @@ CHECKSUMS
|
|
|
232
232
|
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
233
233
|
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
|
|
234
234
|
bundler (4.0.15) sha256=a4ceb882fe94a0e0ac63cd0813932bbfd631a14e5ac0b7975189b19a4d28d9e7
|
|
235
|
-
cocina-models (0.
|
|
235
|
+
cocina-models (0.128.0)
|
|
236
236
|
cocina_display (2.8.0) sha256=89722e8e204c07cfa38f3deacbd66d42f3db9c7b29fdc034973d847cf93c4995
|
|
237
237
|
concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
|
|
238
238
|
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
@@ -260,9 +260,9 @@ CHECKSUMS
|
|
|
260
260
|
iso8601 (0.13.0) sha256=298c2b15b7be5fa95a1372813d36a2257656cd8e906dfbc1f5cb409851425aa2
|
|
261
261
|
janeway-jsonpath (1.0.0) sha256=c8293f009f2aea9487ddee3067ca735a1f758eb1c8834ff4fab3ffd06c56d0a3
|
|
262
262
|
json (2.20.0) sha256=9362bc6e55a952b056abf9167cf053358181c904cb70cd6eee0808ea830fc32b
|
|
263
|
-
jsonschema_rs (0.46.
|
|
264
|
-
jsonschema_rs (0.46.
|
|
265
|
-
language_server-protocol (3.17.0.
|
|
263
|
+
jsonschema_rs (0.46.10-arm64-darwin) sha256=1bece46823184a8cbec55d7585f09de68cc2bc03772d8aa9c29deba23b490609
|
|
264
|
+
jsonschema_rs (0.46.10-x86_64-linux) sha256=ef1f8a244e8e5b4a9e35ccd0b7f7aa9912a7e15b00f1170ba3f3cade0bdc627b
|
|
265
|
+
language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
|
|
266
266
|
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
267
267
|
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
268
268
|
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
|
|
@@ -290,8 +290,8 @@ CHECKSUMS
|
|
|
290
290
|
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
|
|
291
291
|
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
292
292
|
rspec_junit_formatter (0.6.0) sha256=40dde674e6ae4e6cc0ff560da25497677e34fefd2338cc467a8972f602b62b15
|
|
293
|
-
rubocop (1.88.
|
|
294
|
-
rubocop-ast (1.
|
|
293
|
+
rubocop (1.88.1) sha256=726af773d6bc169ed3ff852f3ca020b7c58d39c34e7a8d879a8e0147cc994f26
|
|
294
|
+
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
|
|
295
295
|
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
|
|
296
296
|
rubocop-rspec (3.10.2) sha256=0b3e2ecc592cd10ecbf0095bb58d1e357905276e069643523cc19eb7495f65e2
|
|
297
297
|
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
data/bin/validate-data
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
# Validate JSONL (
|
|
4
|
+
# Validate JSONL (zstd compressed) files against the schema
|
|
5
5
|
|
|
6
6
|
# Trap Ctrl+C to exit gracefully
|
|
7
7
|
Signal.trap('INT') do
|
|
@@ -65,7 +65,7 @@ end
|
|
|
65
65
|
# Count lines in the file
|
|
66
66
|
def count_lines(filename)
|
|
67
67
|
count = 0
|
|
68
|
-
IO.popen(['
|
|
68
|
+
IO.popen(['zstdcat', filename]) do |io|
|
|
69
69
|
io.each_line { count += 1 }
|
|
70
70
|
end
|
|
71
71
|
count
|
|
@@ -73,7 +73,7 @@ end
|
|
|
73
73
|
|
|
74
74
|
# Get total line count (either from option or by counting)
|
|
75
75
|
def get_total_lines(filename, provided_count)
|
|
76
|
-
count_filename = filename.sub(/\.
|
|
76
|
+
count_filename = filename.sub(/\.zst$/, '.count.txt')
|
|
77
77
|
if provided_count
|
|
78
78
|
puts "Using provided line count: #{provided_count}"
|
|
79
79
|
provided_count
|
|
@@ -183,7 +183,7 @@ def distribute_work(filename, workers, batch_size, total_lines) # rubocop:disabl
|
|
|
183
183
|
throttle_rate: 0.1
|
|
184
184
|
)
|
|
185
185
|
|
|
186
|
-
IO.popen(['
|
|
186
|
+
IO.popen(['zstdcat', filename]) do |io|
|
|
187
187
|
io.each_line do |line|
|
|
188
188
|
line_number += 1
|
|
189
189
|
batch << [line_number, line]
|
|
@@ -6,6 +6,17 @@ module Cocina
|
|
|
6
6
|
# an AdminPolicy. This is almost the same as DROAccess, but it provides no defaults
|
|
7
7
|
# and has no embargo.
|
|
8
8
|
class AdminPolicyAccessTemplate < Struct
|
|
9
|
+
# Access level.
|
|
10
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
11
|
+
attribute? :view, Types::Strict::String.optional.default('dark')
|
|
12
|
+
# Download access level.
|
|
13
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
14
|
+
attribute? :download, Types::Strict::String.optional.default('none')
|
|
15
|
+
# Not used for this access type, must be null.
|
|
16
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
17
|
+
attribute? :location, Types::Strict::String.optional
|
|
18
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
19
|
+
attribute? :controlledDigitalLending, Types::Strict::Bool.optional.default(false)
|
|
9
20
|
# The human readable copyright statement that applies
|
|
10
21
|
# example: Copyright World Trade Organization
|
|
11
22
|
attribute? :copyright, Copyright.optional
|
|
@@ -18,17 +29,6 @@ module Cocina
|
|
|
18
29
|
# The license governing reuse of the DRO. Should be an IRI for known licenses (i.e.
|
|
19
30
|
# CC, RightsStatement.org URI, etc.).
|
|
20
31
|
attribute? :license, License.optional.enum(nil, 'https://www.gnu.org/licenses/agpl.txt', 'https://www.apache.org/licenses/LICENSE-2.0', 'https://opensource.org/licenses/BSD-2-Clause', 'https://opensource.org/licenses/BSD-3-Clause', 'https://creativecommons.org/licenses/by/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode', 'https://creativecommons.org/licenses/by-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-sa/4.0/legalcode', 'https://creativecommons.org/publicdomain/zero/1.0/legalcode', 'https://opensource.org/licenses/cddl1', 'https://www.eclipse.org/legal/epl-2.0', 'https://www.gnu.org/licenses/gpl-3.0-standalone.html', 'https://www.isc.org/downloads/software-support-policy/isc-license/', 'https://www.gnu.org/licenses/lgpl-3.0-standalone.html', 'https://opensource.org/licenses/MIT', 'https://www.mozilla.org/MPL/2.0/', 'https://opendatacommons.org/licenses/by/1-0/', 'http://opendatacommons.org/licenses/odbl/1.0/', 'https://opendatacommons.org/licenses/odbl/1-0/', 'https://creativecommons.org/publicdomain/mark/1.0/', 'https://opendatacommons.org/licenses/pddl/1-0/', 'https://creativecommons.org/licenses/by/3.0/legalcode', 'https://creativecommons.org/licenses/by-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nd/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode', 'https://cocina.sul.stanford.edu/licenses/none')
|
|
21
|
-
# Access level.
|
|
22
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
23
|
-
attribute? :view, Types::Strict::String.optional.default('dark')
|
|
24
|
-
# Download access level.
|
|
25
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
26
|
-
attribute? :download, Types::Strict::String.optional.default('none')
|
|
27
|
-
# Not used for this access type, must be null.
|
|
28
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
29
|
-
attribute? :location, Types::Strict::String.optional
|
|
30
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
31
|
-
attribute? :controlledDigitalLending, Types::Strict::Bool.optional.default(false)
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -2,10 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
module Cocina
|
|
4
4
|
module Models
|
|
5
|
-
#
|
|
6
|
-
# which a descriptive element is applicable.
|
|
5
|
+
# Value model for appliesTo property.
|
|
7
6
|
class AppliesTo < Struct
|
|
8
|
-
attribute :
|
|
7
|
+
attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
8
|
+
attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
9
|
+
attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
10
|
+
# String or integer value of the descriptive element.
|
|
11
|
+
attribute? :value, Types::Nominal::Any
|
|
12
|
+
# Type of value provided by the descriptive element. See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md
|
|
13
|
+
# for valid types.
|
|
14
|
+
attribute? :type, Types::Strict::String
|
|
15
|
+
# Status of the descriptive element value relative to other instances of the element.
|
|
16
|
+
attribute? :status, Types::Strict::String
|
|
17
|
+
# Code value of the descriptive element.
|
|
18
|
+
attribute? :code, Types::Strict::String
|
|
19
|
+
# URI value of the descriptive element.
|
|
20
|
+
attribute? :uri, Types::Strict::String
|
|
21
|
+
# Property model for indicating the encoding, standard, or syntax to which a value
|
|
22
|
+
# conforms (e.g. RDA).
|
|
23
|
+
attribute? :standard, Standard.optional
|
|
24
|
+
# Property model for indicating the encoding, standard, or syntax to which a value
|
|
25
|
+
# conforms (e.g. RDA).
|
|
26
|
+
attribute? :encoding, Standard.optional
|
|
27
|
+
# Property model for indicating the vocabulary, authority, or other origin for a term,
|
|
28
|
+
# code, or identifier.
|
|
29
|
+
attribute? :source, Source.optional
|
|
30
|
+
# The preferred display label to use for the descriptive element in access systems.
|
|
31
|
+
attribute? :displayLabel, Types::Strict::String.optional
|
|
32
|
+
# A term providing information about the circumstances of the statement (e.g., approximate
|
|
33
|
+
# dates).
|
|
34
|
+
attribute? :qualifier, Types::Strict::String
|
|
35
|
+
# Other information related to the descriptive element.
|
|
36
|
+
attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
37
|
+
# Language of the descriptive element value
|
|
38
|
+
attribute? :valueLanguage, DescriptiveValueLanguage.optional
|
|
39
|
+
# URL or other pointer to the location of the value of the descriptive element.
|
|
40
|
+
attribute? :valueAt, Types::Strict::String
|
|
41
|
+
# Identifiers and URIs associated with the descriptive element.
|
|
42
|
+
attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
|
|
9
43
|
end
|
|
10
44
|
end
|
|
11
45
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Cocina
|
|
4
4
|
module Models
|
|
5
5
|
# Basic value model for descriptive elements. Can only have one of value, parallelValue,
|
|
6
|
-
# groupedValue, or structuredValue.
|
|
6
|
+
# groupedValue, or structuredValue. Does not have identifier or appliesTo properties.
|
|
7
7
|
class DescriptiveBasicValue < Struct
|
|
8
8
|
attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
9
9
|
attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
@@ -25,8 +25,6 @@ module Cocina
|
|
|
25
25
|
# Property model for indicating the encoding, standard, or syntax to which a value
|
|
26
26
|
# conforms (e.g. RDA).
|
|
27
27
|
attribute? :encoding, Standard.optional
|
|
28
|
-
# Identifiers and URIs associated with the descriptive element.
|
|
29
|
-
attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
|
|
30
28
|
# Property model for indicating the vocabulary, authority, or other origin for a term,
|
|
31
29
|
# code, or identifier.
|
|
32
30
|
attribute? :source, Source.optional
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module Cocina
|
|
4
4
|
module Models
|
|
5
|
-
#
|
|
6
|
-
# property to prevent infinite recursion.
|
|
5
|
+
# Default value model for identifiers.
|
|
7
6
|
class DescriptiveIdentifier < Struct
|
|
8
|
-
attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).default([].freeze)
|
|
9
7
|
attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
10
8
|
attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
11
9
|
attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
@@ -40,6 +38,7 @@ module Cocina
|
|
|
40
38
|
attribute? :valueLanguage, DescriptiveValueLanguage.optional
|
|
41
39
|
# URL or other pointer to the location of the value of the descriptive element.
|
|
42
40
|
attribute? :valueAt, Types::Strict::String
|
|
41
|
+
attribute :appliesTo, Types::Strict::Array.of(AppliesTo).default([].freeze)
|
|
43
42
|
end
|
|
44
43
|
end
|
|
45
44
|
end
|
|
@@ -4,7 +4,6 @@ module Cocina
|
|
|
4
4
|
module Models
|
|
5
5
|
# Default value model for descriptive elements.
|
|
6
6
|
class DescriptiveValue < Struct
|
|
7
|
-
attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).default([].freeze)
|
|
8
7
|
attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
9
8
|
attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
10
9
|
attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
@@ -25,8 +24,6 @@ module Cocina
|
|
|
25
24
|
# Property model for indicating the encoding, standard, or syntax to which a value
|
|
26
25
|
# conforms (e.g. RDA).
|
|
27
26
|
attribute? :encoding, Standard.optional
|
|
28
|
-
# Identifiers and URIs associated with the descriptive element.
|
|
29
|
-
attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
|
|
30
27
|
# Property model for indicating the vocabulary, authority, or other origin for a term,
|
|
31
28
|
# code, or identifier.
|
|
32
29
|
attribute? :source, Source.optional
|
|
@@ -41,6 +38,9 @@ module Cocina
|
|
|
41
38
|
attribute? :valueLanguage, DescriptiveValueLanguage.optional
|
|
42
39
|
# URL or other pointer to the location of the value of the descriptive element.
|
|
43
40
|
attribute? :valueAt, Types::Strict::String
|
|
41
|
+
attribute :appliesTo, Types::Strict::Array.of(AppliesTo).default([].freeze)
|
|
42
|
+
# Identifiers and URIs associated with the descriptive element.
|
|
43
|
+
attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
module Cocina
|
|
4
4
|
module Models
|
|
5
5
|
class DROAccess < Struct
|
|
6
|
+
# Access level.
|
|
7
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
8
|
+
attribute? :view, Types::Strict::String.optional.default('dark')
|
|
9
|
+
# Download access level.
|
|
10
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
11
|
+
attribute? :download, Types::Strict::String.optional.default('none')
|
|
12
|
+
# Not used for this access type, must be null.
|
|
13
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
14
|
+
attribute? :location, Types::Strict::String.optional
|
|
15
|
+
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
16
|
+
attribute? :controlledDigitalLending, Types::Strict::Bool.optional.default(false)
|
|
6
17
|
# The human readable copyright statement that applies
|
|
7
18
|
# example: Copyright World Trade Organization
|
|
8
19
|
attribute? :copyright, Copyright.optional
|
|
@@ -16,17 +27,6 @@ module Cocina
|
|
|
16
27
|
# The license governing reuse of the DRO. Should be an IRI for known licenses (i.e.
|
|
17
28
|
# CC, RightsStatement.org URI, etc.).
|
|
18
29
|
attribute? :license, License.optional.enum(nil, 'https://www.gnu.org/licenses/agpl.txt', 'https://www.apache.org/licenses/LICENSE-2.0', 'https://opensource.org/licenses/BSD-2-Clause', 'https://opensource.org/licenses/BSD-3-Clause', 'https://creativecommons.org/licenses/by/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode', 'https://creativecommons.org/licenses/by-nd/4.0/legalcode', 'https://creativecommons.org/licenses/by-sa/4.0/legalcode', 'https://creativecommons.org/publicdomain/zero/1.0/legalcode', 'https://opensource.org/licenses/cddl1', 'https://www.eclipse.org/legal/epl-2.0', 'https://www.gnu.org/licenses/gpl-3.0-standalone.html', 'https://www.isc.org/downloads/software-support-policy/isc-license/', 'https://www.gnu.org/licenses/lgpl-3.0-standalone.html', 'https://opensource.org/licenses/MIT', 'https://www.mozilla.org/MPL/2.0/', 'https://opendatacommons.org/licenses/by/1-0/', 'http://opendatacommons.org/licenses/odbl/1.0/', 'https://opendatacommons.org/licenses/odbl/1-0/', 'https://creativecommons.org/publicdomain/mark/1.0/', 'https://opendatacommons.org/licenses/pddl/1-0/', 'https://creativecommons.org/licenses/by/3.0/legalcode', 'https://creativecommons.org/licenses/by-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nd/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode', 'https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode', 'https://cocina.sul.stanford.edu/licenses/none')
|
|
19
|
-
# Access level.
|
|
20
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
21
|
-
attribute? :view, Types::Strict::String.optional.default('dark')
|
|
22
|
-
# Download access level.
|
|
23
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
24
|
-
attribute? :download, Types::Strict::String.optional.default('none')
|
|
25
|
-
# Not used for this access type, must be null.
|
|
26
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
27
|
-
attribute? :location, Types::Strict::String.optional
|
|
28
|
-
# Validation of this property is relaxed. See the schema.json for full validation.
|
|
29
|
-
attribute? :controlledDigitalLending, Types::Strict::Bool.optional.default(false)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -5,7 +5,7 @@ module Cocina
|
|
|
5
5
|
# Languages, scripts, symbolic systems, and notations used in all or part of a resource
|
|
6
6
|
# or its descriptive metadata.
|
|
7
7
|
class Language < Struct
|
|
8
|
-
attribute :appliesTo, Types::Strict::Array.of(
|
|
8
|
+
attribute :appliesTo, Types::Strict::Array.of(AppliesTo).default([].freeze)
|
|
9
9
|
# Code value of the descriptive element.
|
|
10
10
|
attribute? :code, Types::Strict::String
|
|
11
11
|
# The preferred display label to use for the descriptive element in access systems.
|
|
@@ -37,8 +37,10 @@ module Cocina
|
|
|
37
37
|
@notifier = notifier
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# @param [Boolean] include_related_resource whether to map nested relatedItem elements;
|
|
41
|
+
# false when building a relatedItem, since RelatedResource cannot itself nest a relatedResource
|
|
40
42
|
# @return [Hash] a hash that can be mapped to a cocina description model
|
|
41
|
-
def build(resource_element:, purl: nil, require_title: true)
|
|
43
|
+
def build(resource_element:, purl: nil, require_title: true, include_related_resource: true)
|
|
42
44
|
cocina_description = {}
|
|
43
45
|
title_result = @title_builder.build(resource_element: resource_element, require_title: require_title,
|
|
44
46
|
notifier: notifier)
|
|
@@ -47,7 +49,8 @@ module Cocina
|
|
|
47
49
|
purl_value = purl || Purl.primary_purl_value(resource_element, purl)
|
|
48
50
|
cocina_description[:purl] = purl_value if purl_value
|
|
49
51
|
|
|
50
|
-
BUILDERS
|
|
52
|
+
builders = include_related_resource ? BUILDERS : BUILDERS.except(:relatedResource)
|
|
53
|
+
builders.each do |description_property, builder|
|
|
51
54
|
result = builder.build(resource_element: resource_element, description_builder: self,
|
|
52
55
|
purl: purl_value)
|
|
53
56
|
cocina_description.merge!(description_property => result) if result.present?
|
|
@@ -80,7 +80,8 @@ module Cocina
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def build_related_item(related_item)
|
|
83
|
-
description_builder.build(resource_element: related_item, require_title: false
|
|
83
|
+
description_builder.build(resource_element: related_item, require_title: false,
|
|
84
|
+
include_related_resource: false).tap do |item|
|
|
84
85
|
item[:displayLabel] = related_item['displayLabel']
|
|
85
86
|
if related_item['type']
|
|
86
87
|
item[:type] = normalized_type_for(related_item['type'])
|
|
@@ -38,8 +38,6 @@ module Cocina
|
|
|
38
38
|
attribute? :purl, Purl.optional
|
|
39
39
|
# Information about how to access digital and physical versions of the object.
|
|
40
40
|
attribute? :access, DescriptiveAccessMetadata.optional
|
|
41
|
-
# Other resources associated with the related resource.
|
|
42
|
-
attribute :relatedResource, Types::Strict::Array.of(RelatedResource).default([].freeze)
|
|
43
41
|
# Information about this resource description.
|
|
44
42
|
attribute? :adminMetadata, DescriptiveAdminMetadata.optional
|
|
45
43
|
# The version of the related resource.
|
|
@@ -14,7 +14,7 @@ module Cocina
|
|
|
14
14
|
# example: 1.2.3
|
|
15
15
|
attribute :cocinaVersion, CocinaVersion.default(VERSION)
|
|
16
16
|
attribute :type, Types::Strict::String.enum(*RequestAdminPolicy::TYPES)
|
|
17
|
-
attribute :label, Types::Strict::String
|
|
17
|
+
attribute? :label, Types::Strict::String.default('')
|
|
18
18
|
attribute :version, Types::Strict::Integer.default(1).enum(1)
|
|
19
19
|
# Administrative properties for an AdminPolicy
|
|
20
20
|
attribute(:administrative, AdminPolicyAdministrative.default { AdminPolicyAdministrative.new })
|
|
@@ -18,7 +18,7 @@ module Cocina
|
|
|
18
18
|
# example: 1.2.3
|
|
19
19
|
attribute :cocinaVersion, CocinaVersion.default(VERSION)
|
|
20
20
|
attribute :type, Types::Strict::String.enum(*RequestCollection::TYPES)
|
|
21
|
-
attribute :label, Types::Strict::String
|
|
21
|
+
attribute? :label, Types::Strict::String.default('')
|
|
22
22
|
attribute :version, Types::Strict::Integer.default(1).enum(1)
|
|
23
23
|
# Access metadata for collections
|
|
24
24
|
attribute(:access, CollectionAccess.default { CollectionAccess.new })
|
|
@@ -30,7 +30,7 @@ module Cocina
|
|
|
30
30
|
# example: 1.2.3
|
|
31
31
|
attribute :cocinaVersion, CocinaVersion.default(VERSION)
|
|
32
32
|
attribute :type, Types::Strict::String.enum(*RequestDRO::TYPES)
|
|
33
|
-
attribute :label, Types::Strict::String
|
|
33
|
+
attribute? :label, Types::Strict::String.default('')
|
|
34
34
|
attribute :version, Types::Strict::Integer.default(1).enum(1)
|
|
35
35
|
attribute? :access, DROAccess.optional
|
|
36
36
|
attribute(:administrative, RequestAdministrative.default { RequestAdministrative.new })
|
data/lib/cocina/models/title.rb
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Cocina
|
|
4
4
|
module Models
|
|
5
5
|
class Title < Struct
|
|
6
|
-
attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).default([].freeze)
|
|
7
6
|
attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
8
7
|
attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
9
8
|
attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
|
|
@@ -24,8 +23,6 @@ module Cocina
|
|
|
24
23
|
# Property model for indicating the encoding, standard, or syntax to which a value
|
|
25
24
|
# conforms (e.g. RDA).
|
|
26
25
|
attribute? :encoding, Standard.optional
|
|
27
|
-
# Identifiers and URIs associated with the descriptive element.
|
|
28
|
-
attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
|
|
29
26
|
# Property model for indicating the vocabulary, authority, or other origin for a term,
|
|
30
27
|
# code, or identifier.
|
|
31
28
|
attribute? :source, Source.optional
|
|
@@ -40,6 +37,9 @@ module Cocina
|
|
|
40
37
|
attribute? :valueLanguage, DescriptiveValueLanguage.optional
|
|
41
38
|
# URL or other pointer to the location of the value of the descriptive element.
|
|
42
39
|
attribute? :valueAt, Types::Strict::String
|
|
40
|
+
attribute :appliesTo, Types::Strict::Array.of(AppliesTo).default([].freeze)
|
|
41
|
+
# Identifiers and URIs associated with the descriptive element.
|
|
42
|
+
attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -17,10 +17,10 @@ module Cocina
|
|
|
17
17
|
DescriptionDateTimeVisitorValidator,
|
|
18
18
|
DescriptionEventDateVisitorValidator,
|
|
19
19
|
DescriptionSubjectTemporalEncodingVisitorValidator,
|
|
20
|
-
DescriptionLocationSourceCodeVisitorValidator,
|
|
21
20
|
DescriptionTitleSourceCodeVisitorValidator,
|
|
22
21
|
DescriptionLanguageUriVisitorValidator,
|
|
23
|
-
DescriptionScriptVisitorValidator
|
|
22
|
+
DescriptionScriptVisitorValidator,
|
|
23
|
+
DescriptionLocationVisitorValidator
|
|
24
24
|
].freeze
|
|
25
25
|
|
|
26
26
|
def self.validate(clazz, attributes)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'cocina_display'
|
|
4
|
+
|
|
5
|
+
module Cocina
|
|
6
|
+
module Models
|
|
7
|
+
module Validators
|
|
8
|
+
# Validates location.source.code against location_source_codes.yml and
|
|
9
|
+
# validates location.code against marc_country_codes.yml when source.code is marccountry.
|
|
10
|
+
class DescriptionLocationVisitorValidator < BaseDescriptionVisitorValidator
|
|
11
|
+
def validate!
|
|
12
|
+
errors = []
|
|
13
|
+
errors << "Unrecognized location source codes in description: #{error_paths.join(', ')}" if error_paths.any?
|
|
14
|
+
errors << "Invalid MARC country codes in description: #{marc_country_error_paths.join(', ')}" if marc_country_error_paths.any?
|
|
15
|
+
raise ValidationError, errors.join('; ') if errors.any?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def visit_hash(hash:, path:)
|
|
19
|
+
return unless location_path?(path)
|
|
20
|
+
|
|
21
|
+
source_code = hash.dig(:source, :code)
|
|
22
|
+
return unless source_code
|
|
23
|
+
|
|
24
|
+
error_paths << "#{path_to_s(path)}.source.code (#{source_code})" unless valid_codes.include?(source_code.downcase)
|
|
25
|
+
|
|
26
|
+
return unless source_code.downcase == 'marccountry'
|
|
27
|
+
|
|
28
|
+
code = hash[:code]
|
|
29
|
+
marc_country_error_paths << "#{path_to_s(path)}.code (#{code})" if code && !valid_marc_country_codes.include?(code.downcase)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def error_paths
|
|
35
|
+
@error_paths ||= []
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def marc_country_error_paths
|
|
39
|
+
@marc_country_error_paths ||= []
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def location_path?(path)
|
|
43
|
+
# Match entries in a location array (e.g., [:location, 0] or [:relatedResource, 0, :location, 0]).
|
|
44
|
+
path.length >= 2 && path[-1].is_a?(Integer) && path[-2].to_s == 'location'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# rubocop:disable Style/ClassVars
|
|
48
|
+
def valid_codes
|
|
49
|
+
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../location_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def valid_marc_country_codes
|
|
53
|
+
@@valid_marc_country_codes ||= YAML.load_file(CocinaDisplay.root.join('config/marc_countries.yml')).keys.to_set(&:to_s)
|
|
54
|
+
end
|
|
55
|
+
# rubocop:enable Style/ClassVars
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -48,7 +48,6 @@ module Cocina
|
|
|
48
48
|
type: Cocina::Models::ObjectType.object,
|
|
49
49
|
id: 'druid:bc234fg5678',
|
|
50
50
|
version: 1,
|
|
51
|
-
label: 'factory DRO label',
|
|
52
51
|
title: 'factory DRO title',
|
|
53
52
|
source_id: 'sul:1234',
|
|
54
53
|
admin_policy_id: 'druid:hv992ry2431'
|
|
@@ -60,7 +59,6 @@ module Cocina
|
|
|
60
59
|
type: Cocina::Models::ObjectType.collection,
|
|
61
60
|
id: 'druid:bb222ff5555',
|
|
62
61
|
version: 1,
|
|
63
|
-
label: 'factory collection label',
|
|
64
62
|
title: 'factory collection title',
|
|
65
63
|
admin_policy_id: 'druid:hv992ry2431',
|
|
66
64
|
source_id: 'sulcollection:1234'
|
|
@@ -72,7 +70,6 @@ module Cocina
|
|
|
72
70
|
type: Cocina::Models::ObjectType.admin_policy,
|
|
73
71
|
id: 'druid:cb432gf8765',
|
|
74
72
|
version: 1,
|
|
75
|
-
label: 'factory APO label',
|
|
76
73
|
title: 'factory APO title',
|
|
77
74
|
admin_policy_id: 'druid:hv992ry2431',
|
|
78
75
|
agreement_id: 'druid:hp308wm0436'
|
|
@@ -97,12 +94,11 @@ module Cocina
|
|
|
97
94
|
end
|
|
98
95
|
|
|
99
96
|
# rubocop:disable Metrics/ParameterLists
|
|
100
|
-
def self.build_request_dro_properties(type:, version:,
|
|
97
|
+
def self.build_request_dro_properties(type:, version:, title:, source_id:, admin_policy_id:,
|
|
101
98
|
barcode: nil, catkeys: [], folio_instance_hrids: [], collection_ids: [])
|
|
102
99
|
{
|
|
103
100
|
type: type,
|
|
104
101
|
version: version,
|
|
105
|
-
label: label,
|
|
106
102
|
access: {},
|
|
107
103
|
administrative: { hasAdminPolicy: admin_policy_id },
|
|
108
104
|
description: {
|
|
@@ -143,12 +139,11 @@ module Cocina
|
|
|
143
139
|
end
|
|
144
140
|
|
|
145
141
|
# rubocop:disable Metrics/ParameterLists
|
|
146
|
-
def self.build_request_collection_properties(type:, version:,
|
|
142
|
+
def self.build_request_collection_properties(type:, version:, title:, admin_policy_id:, source_id: nil,
|
|
147
143
|
catkeys: [], folio_instance_hrids: [])
|
|
148
144
|
{
|
|
149
145
|
type: type,
|
|
150
146
|
version: version,
|
|
151
|
-
label: label,
|
|
152
147
|
access: {},
|
|
153
148
|
administrative: { hasAdminPolicy: admin_policy_id },
|
|
154
149
|
description: {
|
|
@@ -204,7 +199,7 @@ module Cocina
|
|
|
204
199
|
end
|
|
205
200
|
|
|
206
201
|
# rubocop:disable Metrics/ParameterLists
|
|
207
|
-
def self.build_request_admin_policy_properties(type:, version:,
|
|
202
|
+
def self.build_request_admin_policy_properties(type:, version:, title:,
|
|
208
203
|
admin_policy_id:, agreement_id:,
|
|
209
204
|
use_statement: nil, copyright: nil, license: nil,
|
|
210
205
|
registration_workflow: nil, collections_for_registration: nil,
|
|
@@ -212,7 +207,6 @@ module Cocina
|
|
|
212
207
|
{
|
|
213
208
|
type: type,
|
|
214
209
|
version: version,
|
|
215
|
-
label: label,
|
|
216
210
|
administrative: {
|
|
217
211
|
hasAdminPolicy: admin_policy_id,
|
|
218
212
|
hasAgreement: agreement_id,
|
data/schema.json
CHANGED
|
@@ -155,19 +155,22 @@
|
|
|
155
155
|
"allOf": [
|
|
156
156
|
{
|
|
157
157
|
"$ref": "#/$defs/Access"
|
|
158
|
-
}
|
|
159
|
-
],
|
|
160
|
-
"properties": {
|
|
161
|
-
"copyright": {
|
|
162
|
-
"$ref": "#/$defs/Copyright"
|
|
163
|
-
},
|
|
164
|
-
"useAndReproductionStatement": {
|
|
165
|
-
"$ref": "#/$defs/UseAndReproductionStatement"
|
|
166
158
|
},
|
|
167
|
-
|
|
168
|
-
"
|
|
159
|
+
{
|
|
160
|
+
"type": "object",
|
|
161
|
+
"properties": {
|
|
162
|
+
"copyright": {
|
|
163
|
+
"$ref": "#/$defs/Copyright"
|
|
164
|
+
},
|
|
165
|
+
"useAndReproductionStatement": {
|
|
166
|
+
"$ref": "#/$defs/UseAndReproductionStatement"
|
|
167
|
+
},
|
|
168
|
+
"license": {
|
|
169
|
+
"$ref": "#/$defs/License"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
169
172
|
}
|
|
170
|
-
|
|
173
|
+
],
|
|
171
174
|
"unevaluatedProperties": false
|
|
172
175
|
},
|
|
173
176
|
"AdminPolicyAdministrative": {
|
|
@@ -230,18 +233,6 @@
|
|
|
230
233
|
],
|
|
231
234
|
"unevaluatedProperties": false
|
|
232
235
|
},
|
|
233
|
-
"AppliesTo": {
|
|
234
|
-
"description": "Property model for indicating the parts, aspects, or versions of the resource to which a descriptive element is applicable.",
|
|
235
|
-
"type": "object",
|
|
236
|
-
"properties": {
|
|
237
|
-
"appliesTo": {
|
|
238
|
-
"type": "array",
|
|
239
|
-
"items": {
|
|
240
|
-
"$ref": "#/$defs/DescriptiveBasicValue"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
236
|
"Barcode": {
|
|
246
237
|
"description": "A barcode",
|
|
247
238
|
"oneOf": [
|
|
@@ -262,6 +253,28 @@
|
|
|
262
253
|
}
|
|
263
254
|
]
|
|
264
255
|
},
|
|
256
|
+
"AppliesTo": {
|
|
257
|
+
"description": "Value model for appliesTo property.",
|
|
258
|
+
"type": "object",
|
|
259
|
+
"allOf": [
|
|
260
|
+
{
|
|
261
|
+
"$ref": "#/$defs/DescriptiveBasicValue"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"type": "object",
|
|
265
|
+
"properties": {
|
|
266
|
+
"identifier": {
|
|
267
|
+
"description": "Identifiers and URIs associated with the descriptive element.",
|
|
268
|
+
"type": "array",
|
|
269
|
+
"items": {
|
|
270
|
+
"$ref": "#/$defs/DescriptiveIdentifier"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"unevaluatedProperties": false
|
|
277
|
+
},
|
|
265
278
|
"BusinessBarcode": {
|
|
266
279
|
"description": "The barcode associated with a business library DRO, prefixed with 2050",
|
|
267
280
|
"type": "string",
|
|
@@ -672,23 +685,26 @@
|
|
|
672
685
|
},
|
|
673
686
|
"DROAccess": {
|
|
674
687
|
"type": "object",
|
|
675
|
-
"properties": {
|
|
676
|
-
"copyright": {
|
|
677
|
-
"$ref": "#/$defs/Copyright"
|
|
678
|
-
},
|
|
679
|
-
"embargo": {
|
|
680
|
-
"$ref": "#/$defs/Embargo"
|
|
681
|
-
},
|
|
682
|
-
"useAndReproductionStatement": {
|
|
683
|
-
"$ref": "#/$defs/UseAndReproductionStatement"
|
|
684
|
-
},
|
|
685
|
-
"license": {
|
|
686
|
-
"$ref": "#/$defs/License"
|
|
687
|
-
}
|
|
688
|
-
},
|
|
689
688
|
"allOf": [
|
|
690
689
|
{
|
|
691
690
|
"$ref": "#/$defs/Access"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
"type": "object",
|
|
694
|
+
"properties": {
|
|
695
|
+
"copyright": {
|
|
696
|
+
"$ref": "#/$defs/Copyright"
|
|
697
|
+
},
|
|
698
|
+
"embargo": {
|
|
699
|
+
"$ref": "#/$defs/Embargo"
|
|
700
|
+
},
|
|
701
|
+
"useAndReproductionStatement": {
|
|
702
|
+
"$ref": "#/$defs/UseAndReproductionStatement"
|
|
703
|
+
},
|
|
704
|
+
"license": {
|
|
705
|
+
"$ref": "#/$defs/License"
|
|
706
|
+
}
|
|
707
|
+
}
|
|
692
708
|
}
|
|
693
709
|
],
|
|
694
710
|
"unevaluatedProperties": false
|
|
@@ -1073,7 +1089,7 @@
|
|
|
1073
1089
|
"unevaluatedProperties": false
|
|
1074
1090
|
},
|
|
1075
1091
|
"DescriptiveBasicValue": {
|
|
1076
|
-
"description": "Basic value model for descriptive elements. Can only have one of value, parallelValue, groupedValue, or structuredValue.",
|
|
1092
|
+
"description": "Basic value model for descriptive elements. Can only have one of value, parallelValue, groupedValue, or structuredValue. Does not have identifier or appliesTo properties.",
|
|
1077
1093
|
"type": "object",
|
|
1078
1094
|
"allOf": [
|
|
1079
1095
|
{
|
|
@@ -1118,13 +1134,6 @@
|
|
|
1118
1134
|
"encoding": {
|
|
1119
1135
|
"$ref": "#/$defs/Standard"
|
|
1120
1136
|
},
|
|
1121
|
-
"identifier": {
|
|
1122
|
-
"description": "Identifiers and URIs associated with the descriptive element.",
|
|
1123
|
-
"type": "array",
|
|
1124
|
-
"items": {
|
|
1125
|
-
"$ref": "#/$defs/DescriptiveIdentifier"
|
|
1126
|
-
}
|
|
1127
|
-
},
|
|
1128
1137
|
"source": {
|
|
1129
1138
|
"$ref": "#/$defs/Source"
|
|
1130
1139
|
},
|
|
@@ -1203,7 +1212,7 @@
|
|
|
1203
1212
|
"required": ["groupedValue"],
|
|
1204
1213
|
"properties": {
|
|
1205
1214
|
"groupedValue": {
|
|
1206
|
-
"minItems":
|
|
1215
|
+
"minItems": 1
|
|
1207
1216
|
}
|
|
1208
1217
|
}
|
|
1209
1218
|
}
|
|
@@ -1349,181 +1358,49 @@
|
|
|
1349
1358
|
}
|
|
1350
1359
|
}
|
|
1351
1360
|
},
|
|
1352
|
-
"
|
|
1353
|
-
"description": "Default value model for
|
|
1361
|
+
"DescriptiveIdentifier": {
|
|
1362
|
+
"description": "Default value model for identifiers.",
|
|
1354
1363
|
"type": "object",
|
|
1355
|
-
"properties": {
|
|
1356
|
-
"appliesTo": {
|
|
1357
|
-
"type": "array",
|
|
1358
|
-
"items": {
|
|
1359
|
-
"$ref": "#/$defs/DescriptiveBasicValue"
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
},
|
|
1363
1364
|
"allOf": [
|
|
1364
1365
|
{
|
|
1365
|
-
"$ref": "#/$defs/
|
|
1366
|
-
},
|
|
1367
|
-
{
|
|
1368
|
-
"$ref": "#/$defs/DescriptiveParallelValue"
|
|
1369
|
-
},
|
|
1370
|
-
{
|
|
1371
|
-
"$ref": "#/$defs/DescriptiveGroupedValue"
|
|
1366
|
+
"$ref": "#/$defs/DescriptiveBasicValue"
|
|
1372
1367
|
},
|
|
1373
1368
|
{
|
|
1374
1369
|
"type": "object",
|
|
1375
1370
|
"properties": {
|
|
1376
|
-
"
|
|
1377
|
-
"description": "String or integer value of the descriptive element.",
|
|
1378
|
-
"oneOf": [
|
|
1379
|
-
{
|
|
1380
|
-
"type": "string"
|
|
1381
|
-
}
|
|
1382
|
-
]
|
|
1383
|
-
},
|
|
1384
|
-
"type": {
|
|
1385
|
-
"description": "Type of value provided by the descriptive element. See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md for valid types.",
|
|
1386
|
-
"type": "string"
|
|
1387
|
-
},
|
|
1388
|
-
"status": {
|
|
1389
|
-
"description": "Status of the descriptive element value relative to other instances of the element.",
|
|
1390
|
-
"type": "string"
|
|
1391
|
-
},
|
|
1392
|
-
"code": {
|
|
1393
|
-
"description": "Code value of the descriptive element.",
|
|
1394
|
-
"type": "string"
|
|
1395
|
-
},
|
|
1396
|
-
"uri": {
|
|
1397
|
-
"description": "URI value of the descriptive element.",
|
|
1398
|
-
"type": "string"
|
|
1399
|
-
},
|
|
1400
|
-
"standard": {
|
|
1401
|
-
"$ref": "#/$defs/Standard"
|
|
1402
|
-
},
|
|
1403
|
-
"encoding": {
|
|
1404
|
-
"$ref": "#/$defs/Standard"
|
|
1405
|
-
},
|
|
1406
|
-
"identifier": {
|
|
1407
|
-
"description": "Identifiers and URIs associated with the descriptive element.",
|
|
1371
|
+
"appliesTo": {
|
|
1408
1372
|
"type": "array",
|
|
1409
1373
|
"items": {
|
|
1410
|
-
"$ref": "#/$defs/
|
|
1374
|
+
"$ref": "#/$defs/AppliesTo"
|
|
1411
1375
|
}
|
|
1412
|
-
},
|
|
1413
|
-
"source": {
|
|
1414
|
-
"$ref": "#/$defs/Source"
|
|
1415
|
-
},
|
|
1416
|
-
"displayLabel": {
|
|
1417
|
-
"description": "The preferred display label to use for the descriptive element in access systems.",
|
|
1418
|
-
"type": [
|
|
1419
|
-
"string",
|
|
1420
|
-
"null"
|
|
1421
|
-
]
|
|
1422
|
-
},
|
|
1423
|
-
"qualifier": {
|
|
1424
|
-
"description": "A term providing information about the circumstances of the statement (e.g., approximate dates).",
|
|
1425
|
-
"type": "string"
|
|
1426
|
-
},
|
|
1427
|
-
"note": {
|
|
1428
|
-
"description": "Other information related to the descriptive element.",
|
|
1429
|
-
"type": "array",
|
|
1430
|
-
"items": {
|
|
1431
|
-
"$ref": "#/$defs/DescriptiveValue"
|
|
1432
|
-
}
|
|
1433
|
-
},
|
|
1434
|
-
"valueLanguage": {
|
|
1435
|
-
"$ref": "#/$defs/DescriptiveValueLanguage"
|
|
1436
|
-
},
|
|
1437
|
-
"valueAt": {
|
|
1438
|
-
"description": "URL or other pointer to the location of the value of the descriptive element.",
|
|
1439
|
-
"type": "string"
|
|
1440
1376
|
}
|
|
1441
1377
|
}
|
|
1442
1378
|
}
|
|
1443
1379
|
],
|
|
1444
1380
|
"unevaluatedProperties": false
|
|
1445
1381
|
},
|
|
1446
|
-
"
|
|
1447
|
-
"description": "
|
|
1382
|
+
"DescriptiveValue": {
|
|
1383
|
+
"description": "Default value model for descriptive elements.",
|
|
1448
1384
|
"type": "object",
|
|
1449
|
-
"properties": {
|
|
1450
|
-
"appliesTo": {
|
|
1451
|
-
"type": "array",
|
|
1452
|
-
"items": {
|
|
1453
|
-
"$ref": "#/$defs/DescriptiveBasicValue"
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
},
|
|
1457
1385
|
"allOf": [
|
|
1458
1386
|
{
|
|
1459
|
-
"$ref": "#/$defs/
|
|
1460
|
-
},
|
|
1461
|
-
{
|
|
1462
|
-
"$ref": "#/$defs/DescriptiveParallelValue"
|
|
1463
|
-
},
|
|
1464
|
-
{
|
|
1465
|
-
"$ref": "#/$defs/DescriptiveGroupedValue"
|
|
1387
|
+
"$ref": "#/$defs/DescriptiveBasicValue"
|
|
1466
1388
|
},
|
|
1467
1389
|
{
|
|
1468
1390
|
"type": "object",
|
|
1469
1391
|
"properties": {
|
|
1470
|
-
"
|
|
1471
|
-
"description": "String or integer value of the descriptive element.",
|
|
1472
|
-
"oneOf": [
|
|
1473
|
-
{
|
|
1474
|
-
"type": "string"
|
|
1475
|
-
}
|
|
1476
|
-
]
|
|
1477
|
-
},
|
|
1478
|
-
"type": {
|
|
1479
|
-
"description": "Type of value provided by the descriptive element. See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md for valid types.",
|
|
1480
|
-
"type": "string"
|
|
1481
|
-
},
|
|
1482
|
-
"status": {
|
|
1483
|
-
"description": "Status of the descriptive element value relative to other instances of the element.",
|
|
1484
|
-
"type": "string"
|
|
1485
|
-
},
|
|
1486
|
-
"code": {
|
|
1487
|
-
"description": "Code value of the descriptive element.",
|
|
1488
|
-
"type": "string"
|
|
1489
|
-
},
|
|
1490
|
-
"uri": {
|
|
1491
|
-
"description": "URI value of the descriptive element.",
|
|
1492
|
-
"type": "string"
|
|
1493
|
-
},
|
|
1494
|
-
"standard": {
|
|
1495
|
-
"$ref": "#/$defs/Standard"
|
|
1496
|
-
},
|
|
1497
|
-
"encoding": {
|
|
1498
|
-
"$ref": "#/$defs/Standard"
|
|
1499
|
-
},
|
|
1500
|
-
"source": {
|
|
1501
|
-
"$ref": "#/$defs/Source"
|
|
1502
|
-
},
|
|
1503
|
-
"displayLabel": {
|
|
1504
|
-
"description": "The preferred display label to use for the descriptive element in access systems.",
|
|
1505
|
-
"type": [
|
|
1506
|
-
"string",
|
|
1507
|
-
"null"
|
|
1508
|
-
]
|
|
1509
|
-
},
|
|
1510
|
-
"qualifier": {
|
|
1511
|
-
"description": "A term providing information about the circumstances of the statement (e.g., approximate dates).",
|
|
1512
|
-
"type": "string"
|
|
1513
|
-
},
|
|
1514
|
-
"note": {
|
|
1515
|
-
"description": "Other information related to the descriptive element.",
|
|
1392
|
+
"appliesTo": {
|
|
1516
1393
|
"type": "array",
|
|
1517
1394
|
"items": {
|
|
1518
|
-
"$ref": "#/$defs/
|
|
1395
|
+
"$ref": "#/$defs/AppliesTo"
|
|
1519
1396
|
}
|
|
1520
1397
|
},
|
|
1521
|
-
"
|
|
1522
|
-
"
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1398
|
+
"identifier": {
|
|
1399
|
+
"description": "Identifiers and URIs associated with the descriptive element.",
|
|
1400
|
+
"type": "array",
|
|
1401
|
+
"items": {
|
|
1402
|
+
"$ref": "#/$defs/DescriptiveIdentifier"
|
|
1403
|
+
}
|
|
1527
1404
|
}
|
|
1528
1405
|
}
|
|
1529
1406
|
}
|
|
@@ -1720,7 +1597,7 @@
|
|
|
1720
1597
|
"minItems": 1
|
|
1721
1598
|
}
|
|
1722
1599
|
}
|
|
1723
|
-
}
|
|
1600
|
+
}
|
|
1724
1601
|
]
|
|
1725
1602
|
},
|
|
1726
1603
|
"File": {
|
|
@@ -2012,7 +1889,7 @@
|
|
|
2012
1889
|
"appliesTo": {
|
|
2013
1890
|
"type": "array",
|
|
2014
1891
|
"items": {
|
|
2015
|
-
"$ref": "#/$defs/
|
|
1892
|
+
"$ref": "#/$defs/AppliesTo"
|
|
2016
1893
|
}
|
|
2017
1894
|
},
|
|
2018
1895
|
"code": {
|
|
@@ -2502,13 +2379,6 @@
|
|
|
2502
2379
|
"access": {
|
|
2503
2380
|
"$ref": "#/$defs/DescriptiveAccessMetadata"
|
|
2504
2381
|
},
|
|
2505
|
-
"relatedResource": {
|
|
2506
|
-
"description": "Other resources associated with the related resource.",
|
|
2507
|
-
"type": "array",
|
|
2508
|
-
"items": {
|
|
2509
|
-
"$ref": "#/$defs/RelatedResource"
|
|
2510
|
-
}
|
|
2511
|
-
},
|
|
2512
2382
|
"adminMetadata": {
|
|
2513
2383
|
"$ref": "#/$defs/DescriptiveAdminMetadata"
|
|
2514
2384
|
},
|
|
@@ -2676,7 +2546,6 @@
|
|
|
2676
2546
|
"required": [
|
|
2677
2547
|
"cocinaVersion",
|
|
2678
2548
|
"administrative",
|
|
2679
|
-
"label",
|
|
2680
2549
|
"type",
|
|
2681
2550
|
"version"
|
|
2682
2551
|
],
|
|
@@ -2744,7 +2613,6 @@
|
|
|
2744
2613
|
"cocinaVersion",
|
|
2745
2614
|
"access",
|
|
2746
2615
|
"administrative",
|
|
2747
|
-
"label",
|
|
2748
2616
|
"type",
|
|
2749
2617
|
"version"
|
|
2750
2618
|
],
|
|
@@ -2811,7 +2679,6 @@
|
|
|
2811
2679
|
"cocinaVersion",
|
|
2812
2680
|
"administrative",
|
|
2813
2681
|
"identification",
|
|
2814
|
-
"label",
|
|
2815
2682
|
"type",
|
|
2816
2683
|
"version"
|
|
2817
2684
|
],
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocina-models
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.128.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
@@ -488,7 +488,7 @@ files:
|
|
|
488
488
|
- lib/cocina/models/validators/description_identifier_source_code_visitor_validator.rb
|
|
489
489
|
- lib/cocina/models/validators/description_language_code_visitor_validator.rb
|
|
490
490
|
- lib/cocina/models/validators/description_language_uri_visitor_validator.rb
|
|
491
|
-
- lib/cocina/models/validators/
|
|
491
|
+
- lib/cocina/models/validators/description_location_visitor_validator.rb
|
|
492
492
|
- lib/cocina/models/validators/description_name_source_code_visitor_validator.rb
|
|
493
493
|
- lib/cocina/models/validators/description_role_source_code_visitor_validator.rb
|
|
494
494
|
- lib/cocina/models/validators/description_script_visitor_validator.rb
|
|
@@ -536,7 +536,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
536
536
|
- !ruby/object:Gem::Version
|
|
537
537
|
version: '0'
|
|
538
538
|
requirements: []
|
|
539
|
-
rubygems_version:
|
|
539
|
+
rubygems_version: 4.0.6
|
|
540
540
|
specification_version: 4
|
|
541
541
|
summary: Data models for the SDR
|
|
542
542
|
test_files: []
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Cocina
|
|
4
|
-
module Models
|
|
5
|
-
module Validators
|
|
6
|
-
# Validates location.source.code values against location_source_codes.yml.
|
|
7
|
-
class DescriptionLocationSourceCodeVisitorValidator < BaseDescriptionVisitorValidator
|
|
8
|
-
def validate!
|
|
9
|
-
return if error_paths.empty?
|
|
10
|
-
|
|
11
|
-
raise ValidationError, "Unrecognized location source codes in description: #{error_paths.join(', ')}"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def visit_hash(hash:, path:)
|
|
15
|
-
return unless location_path?(path)
|
|
16
|
-
|
|
17
|
-
source_code = hash.dig(:source, :code)
|
|
18
|
-
return unless source_code
|
|
19
|
-
return if valid_codes.include?(source_code.downcase)
|
|
20
|
-
|
|
21
|
-
error_paths << "#{path_to_s(path)}.source.code (#{source_code})"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
def error_paths
|
|
27
|
-
@error_paths ||= []
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def location_path?(path)
|
|
31
|
-
# Match entries in a location array (e.g., [:location, 0] or [:relatedResource, 0, :location, 0]).
|
|
32
|
-
path.length >= 2 && path[-1].is_a?(Integer) && path[-2].to_s == 'location'
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# rubocop:disable Style/ClassVars
|
|
36
|
-
def valid_codes
|
|
37
|
-
@@valid_codes ||= YAML.load_file(::File.expand_path('../../../../location_source_codes.yml', __dir__)).to_set(&:downcase)
|
|
38
|
-
end
|
|
39
|
-
# rubocop:enable Style/ClassVars
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|