cocina-models 0.124.0 → 0.126.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/Gemfile.lock +38 -40
  4. data/bin/validate-data +1 -2
  5. data/iso15924_codes.yml +275 -0
  6. data/language_uri_iso639_2_codes.yml +509 -0
  7. data/language_uri_languages_codes.yml +487 -0
  8. data/lib/cocina/models/admin_policy.rb +1 -1
  9. data/lib/cocina/models/admin_policy_lite.rb +1 -1
  10. data/lib/cocina/models/admin_policy_with_metadata.rb +1 -1
  11. data/lib/cocina/models/collection.rb +1 -1
  12. data/lib/cocina/models/collection_lite.rb +1 -1
  13. data/lib/cocina/models/collection_with_metadata.rb +1 -1
  14. data/lib/cocina/models/contributor.rb +1 -1
  15. data/lib/cocina/models/description.rb +1 -1
  16. data/lib/cocina/models/descriptive_admin_metadata.rb +1 -1
  17. data/lib/cocina/models/descriptive_basic_value.rb +1 -1
  18. data/lib/cocina/models/descriptive_identifier.rb +45 -0
  19. data/lib/cocina/models/descriptive_parallel_event.rb +1 -1
  20. data/lib/cocina/models/descriptive_value.rb +1 -1
  21. data/lib/cocina/models/dro.rb +1 -1
  22. data/lib/cocina/models/dro_lite.rb +1 -1
  23. data/lib/cocina/models/dro_with_metadata.rb +1 -1
  24. data/lib/cocina/models/event.rb +1 -1
  25. data/lib/cocina/models/mapping/from_mods/access.rb +2 -2
  26. data/lib/cocina/models/related_resource.rb +1 -1
  27. data/lib/cocina/models/request_description.rb +1 -1
  28. data/lib/cocina/models/title.rb +1 -1
  29. data/lib/cocina/models/validators/composite_description_validator.rb +7 -1
  30. data/lib/cocina/models/validators/description_language_code_visitor_validator.rb +48 -0
  31. data/lib/cocina/models/validators/description_language_uri_visitor_validator.rb +86 -0
  32. data/lib/cocina/models/validators/description_name_source_code_visitor_validator.rb +45 -0
  33. data/lib/cocina/models/validators/description_script_visitor_validator.rb +74 -0
  34. data/lib/cocina/models/validators/description_subject_source_code_visitor_validator.rb +41 -0
  35. data/lib/cocina/models/validators/description_title_source_code_visitor_validator.rb +43 -0
  36. data/lib/cocina/models/version.rb +1 -1
  37. data/name_source_codes.yml +498 -0
  38. data/name_title_source_codes.yml +46 -0
  39. data/schema.json +109 -55
  40. data/subject_source_codes.yml +848 -0
  41. metadata +15 -2
@@ -0,0 +1,487 @@
1
+ # LC MARC List for Languages codes
2
+ # Source: https://id.loc.gov/vocabulary/languages.html
3
+ - aar
4
+ - abk
5
+ - ace
6
+ - ach
7
+ - ada
8
+ - ady
9
+ - afa
10
+ - afh
11
+ - afr
12
+ - ain
13
+ - aka
14
+ - akk
15
+ - alb
16
+ - ale
17
+ - alg
18
+ - alt
19
+ - amh
20
+ - ang
21
+ - anp
22
+ - apa
23
+ - ara
24
+ - arc
25
+ - arg
26
+ - arm
27
+ - arn
28
+ - arp
29
+ - art
30
+ - arw
31
+ - asm
32
+ - ast
33
+ - ath
34
+ - aus
35
+ - ava
36
+ - ave
37
+ - awa
38
+ - aym
39
+ - aze
40
+ - bad
41
+ - bai
42
+ - bak
43
+ - bal
44
+ - bam
45
+ - ban
46
+ - baq
47
+ - bas
48
+ - bat
49
+ - bej
50
+ - bel
51
+ - bem
52
+ - ben
53
+ - ber
54
+ - bho
55
+ - bih
56
+ - bik
57
+ - bin
58
+ - bis
59
+ - bla
60
+ - bnt
61
+ - bos
62
+ - bra
63
+ - bre
64
+ - btk
65
+ - bua
66
+ - bug
67
+ - bul
68
+ - bur
69
+ - byn
70
+ - cad
71
+ - cai
72
+ - car
73
+ - cat
74
+ - cau
75
+ - ceb
76
+ - cel
77
+ - cha
78
+ - chb
79
+ - che
80
+ - chg
81
+ - chi
82
+ - chk
83
+ - chm
84
+ - chn
85
+ - cho
86
+ - chp
87
+ - chr
88
+ - chu
89
+ - chv
90
+ - chy
91
+ - cmc
92
+ - cnr
93
+ - cop
94
+ - cor
95
+ - cos
96
+ - cpe
97
+ - cpf
98
+ - cpp
99
+ - cre
100
+ - crh
101
+ - crp
102
+ - csb
103
+ - cus
104
+ - cze
105
+ - dak
106
+ - dan
107
+ - dar
108
+ - day
109
+ - del
110
+ - den
111
+ - dgr
112
+ - din
113
+ - div
114
+ - doi
115
+ - dra
116
+ - dsb
117
+ - dua
118
+ - dum
119
+ - dut
120
+ - dyu
121
+ - dzo
122
+ - efi
123
+ - egy
124
+ - eka
125
+ - elx
126
+ - eng
127
+ - enm
128
+ - epo
129
+ - est
130
+ - ewe
131
+ - ewo
132
+ - fan
133
+ - fao
134
+ - fat
135
+ - fij
136
+ - fil
137
+ - fin
138
+ - fiu
139
+ - fon
140
+ - fre
141
+ - frm
142
+ - fro
143
+ - frr
144
+ - frs
145
+ - fry
146
+ - ful
147
+ - fur
148
+ - gaa
149
+ - gay
150
+ - gba
151
+ - gem
152
+ - geo
153
+ - ger
154
+ - gez
155
+ - gil
156
+ - gla
157
+ - gle
158
+ - glg
159
+ - glv
160
+ - gmh
161
+ - goh
162
+ - gon
163
+ - gor
164
+ - got
165
+ - grb
166
+ - grc
167
+ - gre
168
+ - grn
169
+ - gsw
170
+ - guj
171
+ - gwi
172
+ - hai
173
+ - hat
174
+ - hau
175
+ - haw
176
+ - heb
177
+ - her
178
+ - hil
179
+ - him
180
+ - hin
181
+ - hit
182
+ - hmn
183
+ - hmo
184
+ - hrv
185
+ - hsb
186
+ - hun
187
+ - hup
188
+ - iba
189
+ - ibo
190
+ - ice
191
+ - ido
192
+ - iii
193
+ - ijo
194
+ - iku
195
+ - ile
196
+ - ilo
197
+ - ina
198
+ - inc
199
+ - ind
200
+ - ine
201
+ - inh
202
+ - ipk
203
+ - ira
204
+ - iro
205
+ - ita
206
+ - jav
207
+ - jbo
208
+ - jpn
209
+ - jpr
210
+ - jrb
211
+ - kaa
212
+ - kab
213
+ - kac
214
+ - kal
215
+ - kam
216
+ - kan
217
+ - kar
218
+ - kas
219
+ - kau
220
+ - kaw
221
+ - kaz
222
+ - kbd
223
+ - kha
224
+ - khi
225
+ - khm
226
+ - kho
227
+ - kik
228
+ - kin
229
+ - kir
230
+ - kmb
231
+ - kok
232
+ - kom
233
+ - kon
234
+ - kor
235
+ - kos
236
+ - kpe
237
+ - krc
238
+ - krl
239
+ - kro
240
+ - kru
241
+ - kua
242
+ - kum
243
+ - kur
244
+ - kut
245
+ - lad
246
+ - lah
247
+ - lam
248
+ - lao
249
+ - lat
250
+ - lav
251
+ - lez
252
+ - lim
253
+ - lin
254
+ - lit
255
+ - lol
256
+ - loz
257
+ - ltz
258
+ - lua
259
+ - lub
260
+ - lug
261
+ - lui
262
+ - lun
263
+ - luo
264
+ - lus
265
+ - mac
266
+ - mad
267
+ - mag
268
+ - mah
269
+ - mai
270
+ - mak
271
+ - mal
272
+ - man
273
+ - mao
274
+ - map
275
+ - mar
276
+ - mas
277
+ - may
278
+ - mdf
279
+ - mdr
280
+ - men
281
+ - mga
282
+ - mic
283
+ - min
284
+ - mis
285
+ - mkh
286
+ - mlg
287
+ - mlt
288
+ - mnc
289
+ - mni
290
+ - mno
291
+ - moh
292
+ - mon
293
+ - mos
294
+ - mul
295
+ - mun
296
+ - mus
297
+ - mwl
298
+ - mwr
299
+ - myn
300
+ - myv
301
+ - nah
302
+ - nai
303
+ - nap
304
+ - nau
305
+ - nav
306
+ - nbl
307
+ - nde
308
+ - ndo
309
+ - nds
310
+ - nep
311
+ - new
312
+ - nia
313
+ - nic
314
+ - niu
315
+ - nno
316
+ - nob
317
+ - nog
318
+ - non
319
+ - nor
320
+ - nqo
321
+ - nso
322
+ - nub
323
+ - nwc
324
+ - nya
325
+ - nym
326
+ - nyn
327
+ - nyo
328
+ - nzi
329
+ - oci
330
+ - oji
331
+ - ori
332
+ - orm
333
+ - osa
334
+ - oss
335
+ - ota
336
+ - oto
337
+ - paa
338
+ - pag
339
+ - pal
340
+ - pam
341
+ - pan
342
+ - pap
343
+ - pau
344
+ - peo
345
+ - per
346
+ - phi
347
+ - phn
348
+ - pli
349
+ - pol
350
+ - pon
351
+ - por
352
+ - pra
353
+ - pro
354
+ - pus
355
+ - que
356
+ - raj
357
+ - rap
358
+ - rar
359
+ - roa
360
+ - roh
361
+ - rom
362
+ - rum
363
+ - run
364
+ - rup
365
+ - rus
366
+ - sad
367
+ - sag
368
+ - sah
369
+ - sai
370
+ - sal
371
+ - sam
372
+ - san
373
+ - sas
374
+ - sat
375
+ - scn
376
+ - sco
377
+ - sel
378
+ - sem
379
+ - sga
380
+ - sgn
381
+ - shn
382
+ - sid
383
+ - sin
384
+ - sio
385
+ - sit
386
+ - sla
387
+ - slo
388
+ - slv
389
+ - sma
390
+ - sme
391
+ - smi
392
+ - smj
393
+ - smn
394
+ - smo
395
+ - sms
396
+ - sna
397
+ - snd
398
+ - snk
399
+ - sog
400
+ - som
401
+ - son
402
+ - sot
403
+ - spa
404
+ - srd
405
+ - srn
406
+ - srp
407
+ - srr
408
+ - ssa
409
+ - ssw
410
+ - suk
411
+ - sun
412
+ - sus
413
+ - sux
414
+ - swa
415
+ - swe
416
+ - syc
417
+ - syr
418
+ - tah
419
+ - tai
420
+ - tam
421
+ - tat
422
+ - tel
423
+ - tem
424
+ - ter
425
+ - tet
426
+ - tgk
427
+ - tgl
428
+ - tha
429
+ - tib
430
+ - tig
431
+ - tir
432
+ - tiv
433
+ - tkl
434
+ - tlh
435
+ - tli
436
+ - tmh
437
+ - tog
438
+ - ton
439
+ - tpi
440
+ - tsi
441
+ - tsn
442
+ - tso
443
+ - tuk
444
+ - tum
445
+ - tup
446
+ - tur
447
+ - tut
448
+ - tvl
449
+ - twi
450
+ - tyv
451
+ - udm
452
+ - uga
453
+ - uig
454
+ - ukr
455
+ - umb
456
+ - und
457
+ - urd
458
+ - uzb
459
+ - vai
460
+ - ven
461
+ - vie
462
+ - vol
463
+ - vot
464
+ - wak
465
+ - wal
466
+ - war
467
+ - was
468
+ - wel
469
+ - wen
470
+ - wln
471
+ - wol
472
+ - xal
473
+ - xho
474
+ - yao
475
+ - yap
476
+ - yid
477
+ - yor
478
+ - ypk
479
+ - zap
480
+ - zbl
481
+ - zen
482
+ - zha
483
+ - znd
484
+ - zul
485
+ - zun
486
+ - zxx
487
+ - zza
@@ -15,7 +15,7 @@ module Cocina
15
15
  attribute :type, Types::Strict::String.enum(*AdminPolicy::TYPES)
16
16
  # example: druid:bc123df4567
17
17
  attribute :externalIdentifier, Druid
18
- attribute :label, Types::Strict::String
18
+ attribute? :label, Types::Strict::String.default('')
19
19
  attribute :version, Types::Strict::Integer
20
20
  # Administrative properties for an AdminPolicy
21
21
  attribute(:administrative, AdminPolicyAdministrative.default { AdminPolicyAdministrative.new })
@@ -13,7 +13,7 @@ module Cocina
13
13
  attribute :type, Types::Strict::String.enum(*AdminPolicyLite::TYPES)
14
14
  # example: druid:bc123df4567
15
15
  attribute :externalIdentifier, Druid
16
- attribute :label, Types::Strict::String
16
+ attribute? :label, Types::Strict::String.default('')
17
17
  attribute :version, Types::Strict::Integer
18
18
  # Administrative properties for an AdminPolicy
19
19
  # Validation of this property is relaxed. See the schema.json for full validation.
@@ -16,7 +16,7 @@ module Cocina
16
16
  attribute :type, Types::Strict::String.enum(*AdminPolicyWithMetadata::TYPES)
17
17
  # example: druid:bc123df4567
18
18
  attribute :externalIdentifier, Druid
19
- attribute :label, Types::Strict::String
19
+ attribute? :label, Types::Strict::String.default('')
20
20
  attribute :version, Types::Strict::Integer
21
21
  # Administrative properties for an AdminPolicy
22
22
  attribute(:administrative, AdminPolicyAdministrative.default { AdminPolicyAdministrative.new })
@@ -23,7 +23,7 @@ module Cocina
23
23
  # example: druid:bc123df4567
24
24
  attribute :externalIdentifier, Druid
25
25
  # Primary processing label (can be same as title) for a Collection.
26
- attribute :label, Types::Strict::String
26
+ attribute? :label, Types::Strict::String.default('')
27
27
  # Version for the Collection within SDR.
28
28
  attribute :version, Types::Strict::Integer
29
29
  # Access metadata for collections
@@ -21,7 +21,7 @@ module Cocina
21
21
  # example: druid:bc123df4567
22
22
  attribute :externalIdentifier, Druid
23
23
  # Primary processing label (can be same as title) for a Collection.
24
- attribute :label, Types::Strict::String
24
+ attribute? :label, Types::Strict::String.default('')
25
25
  # Version for the Collection within SDR.
26
26
  attribute :version, Types::Strict::Integer
27
27
  # Access metadata for collections
@@ -22,7 +22,7 @@ module Cocina
22
22
  # example: druid:bc123df4567
23
23
  attribute :externalIdentifier, Druid
24
24
  # Primary processing label (can be same as title) for a Collection.
25
- attribute :label, Types::Strict::String
25
+ attribute? :label, Types::Strict::String.default('')
26
26
  # Version for the Collection within SDR.
27
27
  attribute :version, Types::Strict::Integer
28
28
  # Access metadata for collections
@@ -16,7 +16,7 @@ module Cocina
16
16
  # Relationships of the contributor to the resource or to an event in its history.
17
17
  attribute :role, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
18
18
  # Identifiers and URIs associated with the contributor entity.
19
- attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
19
+ attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
20
20
  # Institutional or other affiliation associated with a contributor.
21
21
  attribute :affiliation, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
22
22
  # Other information associated with the contributor.
@@ -21,7 +21,7 @@ module Cocina
21
21
  # Additional information relevant to a resource.
22
22
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
23
23
  # Identifiers and URIs associated with the resource.
24
- attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
24
+ attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
25
25
  # Terms associated with the intellectual content of the resource.
26
26
  attribute :subject, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
27
27
  # Information about how to access digital and physical versions of the object.
@@ -15,7 +15,7 @@ module Cocina
15
15
  # Descriptive or content standard(s) to which this resource description conforms.
16
16
  attribute :metadataStandard, Types::Strict::Array.of(Standard).default([].freeze)
17
17
  # Identifiers associated with this resource description.
18
- attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
18
+ attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
19
19
  end
20
20
  end
21
21
  end
@@ -26,7 +26,7 @@ module Cocina
26
26
  # conforms (e.g. RDA).
27
27
  attribute? :encoding, Standard.optional
28
28
  # Identifiers and URIs associated with the descriptive element.
29
- attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
29
+ attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
30
30
  # Property model for indicating the vocabulary, authority, or other origin for a term,
31
31
  # code, or identifier.
32
32
  attribute? :source, Source.optional
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ # Value model for descriptive identifiers. Same as DescriptiveValue but omits the identifier
6
+ # property to prevent infinite recursion.
7
+ class DescriptiveIdentifier < Struct
8
+ attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).default([].freeze)
9
+ attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
10
+ attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
11
+ attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
12
+ # String or integer value of the descriptive element.
13
+ attribute? :value, Types::Nominal::Any
14
+ # Type of value provided by the descriptive element. See https://github.com/sul-dlss/cocina-models/blob/main/docs/description_types.md
15
+ # for valid types.
16
+ attribute? :type, Types::Strict::String
17
+ # Status of the descriptive element value relative to other instances of the element.
18
+ attribute? :status, Types::Strict::String
19
+ # Code value of the descriptive element.
20
+ attribute? :code, Types::Strict::String
21
+ # URI value of the descriptive element.
22
+ attribute? :uri, Types::Strict::String
23
+ # Property model for indicating the encoding, standard, or syntax to which a value
24
+ # conforms (e.g. RDA).
25
+ attribute? :standard, Standard.optional
26
+ # Property model for indicating the encoding, standard, or syntax to which a value
27
+ # conforms (e.g. RDA).
28
+ attribute? :encoding, Standard.optional
29
+ # Property model for indicating the vocabulary, authority, or other origin for a term,
30
+ # code, or identifier.
31
+ attribute? :source, Source.optional
32
+ # The preferred display label to use for the descriptive element in access systems.
33
+ attribute? :displayLabel, Types::Strict::String.optional
34
+ # A term providing information about the circumstances of the statement (e.g., approximate
35
+ # dates).
36
+ attribute? :qualifier, Types::Strict::String
37
+ # Other information related to the descriptive element.
38
+ attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
39
+ # Language of the descriptive element value
40
+ attribute? :valueLanguage, DescriptiveValueLanguage.optional
41
+ # URL or other pointer to the location of the value of the descriptive element.
42
+ attribute? :valueAt, Types::Strict::String
43
+ end
44
+ end
45
+ end
@@ -17,7 +17,7 @@ module Cocina
17
17
  # Locations associated with the event.
18
18
  attribute :location, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
19
19
  # Identifiers and URIs associated with the event.
20
- attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
20
+ attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
21
21
  # Other information about the event.
22
22
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
23
23
  # Language of the descriptive element value
@@ -26,7 +26,7 @@ module Cocina
26
26
  # conforms (e.g. RDA).
27
27
  attribute? :encoding, Standard.optional
28
28
  # Identifiers and URIs associated with the descriptive element.
29
- attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
29
+ attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
30
30
  # Property model for indicating the vocabulary, authority, or other origin for a term,
31
31
  # code, or identifier.
32
32
  attribute? :source, Source.optional
@@ -33,7 +33,7 @@ module Cocina
33
33
  # example: druid:bc123df4567
34
34
  attribute :externalIdentifier, Druid
35
35
  # Primary processing label (can be same as title) for a DRO.
36
- attribute :label, Types::Strict::String
36
+ attribute? :label, Types::Strict::String.default('')
37
37
  # Version for the DRO within SDR.
38
38
  attribute :version, Types::Strict::Integer
39
39
  attribute(:access, DROAccess.default { DROAccess.new })
@@ -31,7 +31,7 @@ module Cocina
31
31
  # example: druid:bc123df4567
32
32
  attribute :externalIdentifier, Druid
33
33
  # Primary processing label (can be same as title) for a DRO.
34
- attribute :label, Types::Strict::String
34
+ attribute? :label, Types::Strict::String.default('')
35
35
  # Version for the DRO within SDR.
36
36
  attribute :version, Types::Strict::Integer
37
37
  # Validation of this property is relaxed. See the schema.json for full validation.
@@ -32,7 +32,7 @@ module Cocina
32
32
  # example: druid:bc123df4567
33
33
  attribute :externalIdentifier, Druid
34
34
  # Primary processing label (can be same as title) for a DRO.
35
- attribute :label, Types::Strict::String
35
+ attribute? :label, Types::Strict::String.default('')
36
36
  # Version for the DRO within SDR.
37
37
  attribute :version, Types::Strict::Integer
38
38
  attribute(:access, DROAccess.default { DROAccess.new })
@@ -16,7 +16,7 @@ module Cocina
16
16
  # Locations associated with the event.
17
17
  attribute :location, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
18
18
  # Identifiers and URIs associated with the event.
19
- attribute :identifier, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
19
+ attribute :identifier, Types::Strict::Array.of(DescriptiveIdentifier).default([].freeze)
20
20
  # Other information about the event.
21
21
  attribute :note, Types::Strict::Array.of(DescriptiveValue).default([].freeze)
22
22
  # Language of the descriptive element value
@@ -49,13 +49,13 @@ module Cocina
49
49
 
50
50
  def physical_location
51
51
  descriptive_value_for(resource_element.xpath(
52
- "mods:location/mods:physicalLocation[not(@type='repository')][not(@type='discovery')]", mods: Description::DESC_METADATA_NS
52
+ "mods:location/mods:physicalLocation[not(contains(text(), '/')) and not(contains(text(), '\\'))]", mods: Description::DESC_METADATA_NS
53
53
  ))
54
54
  end
55
55
 
56
56
  def digital_location
57
57
  descriptive_value_for(resource_element.xpath(
58
- "mods:location/mods:physicalLocation[(@type='discovery')]", mods: Description::DESC_METADATA_NS
58
+ "mods:location/mods:physicalLocation[contains(text(), '/') or contains(text(), '\\')]", mods: Description::DESC_METADATA_NS
59
59
  ))
60
60
  end
61
61