cocina-models 0.109.0 → 0.110.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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +13 -0
  3. data/Gemfile.lock +107 -22
  4. data/cocina-models.gemspec +3 -5
  5. data/description_types.yml +1 -2
  6. data/docs/description_types.md +0 -1
  7. data/lib/cocina/generator/generator.rb +3 -3
  8. data/lib/cocina/generator/schema_base.rb +2 -1
  9. data/lib/cocina/models/mapping/from_marc/access.rb +50 -0
  10. data/lib/cocina/models/mapping/from_marc/admin_metadata.rb +77 -0
  11. data/lib/cocina/models/mapping/from_marc/contributor.rb +109 -0
  12. data/lib/cocina/models/mapping/from_marc/description.rb +8 -17
  13. data/lib/cocina/models/mapping/from_marc/description_builder.rb +27 -29
  14. data/lib/cocina/models/mapping/from_marc/event.rb +152 -0
  15. data/lib/cocina/models/mapping/from_marc/form.rb +135 -0
  16. data/lib/cocina/models/mapping/from_marc/geographic.rb +45 -0
  17. data/lib/cocina/models/mapping/from_marc/identifier.rb +101 -0
  18. data/lib/cocina/models/mapping/from_marc/language.rb +49 -0
  19. data/lib/cocina/models/mapping/from_marc/marc_relators.rb +321 -0
  20. data/lib/cocina/models/mapping/from_marc/note.rb +186 -0
  21. data/lib/cocina/models/mapping/from_marc/title.rb +104 -8
  22. data/lib/cocina/models/mapping/from_marc/util.rb +27 -0
  23. data/lib/cocina/models/mapping/from_mods/note.rb +0 -8
  24. data/lib/cocina/models/mapping/to_mods/note.rb +1 -6
  25. data/lib/cocina/models/validators/open_api_validator.rb +8 -20
  26. data/lib/cocina/models/version.rb +1 -1
  27. data/lib/cocina/models.rb +6 -16
  28. data/lib/cocina/open_api_wrapper.rb +147 -0
  29. data/openapi.yml +78 -72
  30. metadata +42 -25
  31. data/lib/cocina/models/mapping/from_marc/title_builder.rb +0 -73
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b84997ec614fd5688aafaecffc4e76731ccebe63129e215ad77bf8d13a9e8e4f
4
- data.tar.gz: 8018ef77c9f21f189f2ec1d3fdeeba8c6b7638023beca2b1b4ca99e15e7bd910
3
+ metadata.gz: 8b9fe9682c10921ac206fea73e6526883ba31fe7fb08f720f17ff7601e54e0d4
4
+ data.tar.gz: c854536af0b5c26c355129317c6331ae0ff9c772edc666a03a1f68cde97c0c8e
5
5
  SHA512:
6
- metadata.gz: 44c4c1c7070a6d5ad8f1122eecce1eb45809f567f20086b46bf096fb07a66590adf8b51ae307994c9edbf80f837082121a584b3a1884fd151578f63c0991b101
7
- data.tar.gz: 274a80c4ce5f170f468a4416a0f3948ee65a678136458f4bf4ed255676e5b1950c7f317f74f30752667f4943164ec42c0a1fcc25582d8adf50024d47a67766bf
6
+ metadata.gz: cfe6d191ba1e17e102788fca888c4bd5e099eca554bd38e3642b155b453c26d4cba11f1dbc2b1e02547fe8d682a5382224eb0650d7c6be8dc3abb1636e968f25
7
+ data.tar.gz: adb832be7b97215ff35647f94fa20bc86eab92d7045a52e7e81d3274b935fc8156b11c250b0fd9079ac3d0197b266e628693a138aec84ba962791df720a6f79d
data/.rubocop.yml CHANGED
@@ -540,3 +540,16 @@ Style/RedundantArrayFlatten: # new in 1.76
540
540
  Enabled: true
541
541
  Style/ArrayIntersectWithSingleElement: # new in 1.81
542
542
  Enabled: true
543
+
544
+ Style/EmptyClassDefinition: # new in 1.83
545
+ Enabled: true
546
+ Style/ModuleMemberExistenceCheck: # new in 1.82
547
+ Enabled: true
548
+ Style/NegativeArrayIndex: # new in 1.83
549
+ Enabled: true
550
+ Style/ReverseFind: # new in 1.83
551
+ Enabled: true
552
+ RSpec/LeakyLocalVariable: # new in 3.8
553
+ Enabled: true
554
+ RSpec/Output: # new in 3.9
555
+ Enabled: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.109.0)
4
+ cocina-models (0.110.0)
5
5
  activesupport
6
6
  deprecation
7
7
  dry-struct (~> 1.0)
@@ -9,9 +9,10 @@ PATH
9
9
  edtf
10
10
  equivalent-xml
11
11
  i18n
12
+ json_schemer (~> 2.0)
12
13
  jsonpath
14
+ marc (~> 1.3)
13
15
  nokogiri
14
- openapi_parser (~> 1.0)
15
16
  super_diff
16
17
  thor
17
18
  zeitwerk (~> 2.1)
@@ -36,10 +37,6 @@ GEM
36
37
  attr_extras (7.1.0)
37
38
  base64 (0.3.0)
38
39
  bigdecimal (4.0.1)
39
- committee (5.0.0)
40
- json_schema (~> 0.14, >= 0.14.3)
41
- openapi_parser (~> 1.0)
42
- rack (>= 1.5)
43
40
  concurrent-ruby (1.3.6)
44
41
  connection_pool (3.0.2)
45
42
  date (3.5.1)
@@ -66,7 +63,7 @@ GEM
66
63
  dry-types (~> 1.8, >= 1.8.2)
67
64
  ice_nine (~> 0.11)
68
65
  zeitwerk (~> 2.6)
69
- dry-types (1.9.0)
66
+ dry-types (1.9.1)
70
67
  bigdecimal (>= 3.0)
71
68
  concurrent-ruby (~> 1.0)
72
69
  dry-core (~> 1.0)
@@ -78,6 +75,7 @@ GEM
78
75
  equivalent-xml (0.6.0)
79
76
  nokogiri (>= 1.4.3)
80
77
  erb (6.0.1)
78
+ hana (1.3.7)
81
79
  i18n (1.14.8)
82
80
  concurrent-ruby (~> 1.0)
83
81
  ice_nine (0.11.2)
@@ -86,21 +84,27 @@ GEM
86
84
  pp (>= 0.6.0)
87
85
  rdoc (>= 4.0.0)
88
86
  reline (>= 0.4.2)
89
- json (2.18.0)
90
- json_schema (0.21.0)
87
+ json (2.18.1)
88
+ json_schemer (2.5.0)
89
+ bigdecimal
90
+ hana (~> 1.3)
91
+ regexp_parser (~> 2.0)
92
+ simpleidn (~> 0.2)
91
93
  jsonpath (1.1.5)
92
94
  multi_json
93
95
  language_server-protocol (3.17.0.5)
94
96
  lint_roller (1.1.0)
95
97
  logger (1.7.0)
96
- mini_portile2 (2.8.9)
98
+ marc (1.4.0)
99
+ nokogiri (~> 1.0)
100
+ rexml
97
101
  minitest (6.0.1)
98
102
  prism (~> 1.5)
99
103
  multi_json (1.19.1)
100
- nokogiri (1.19.0)
101
- mini_portile2 (~> 2.8.2)
104
+ nokogiri (1.19.0-arm64-darwin)
105
+ racc (~> 1.4)
106
+ nokogiri (1.19.0-x86_64-linux-gnu)
102
107
  racc (~> 1.4)
103
- openapi_parser (1.0.0)
104
108
  optimist (3.2.1)
105
109
  parallel (1.27.0)
106
110
  parser (3.3.10.1)
@@ -111,12 +115,11 @@ GEM
111
115
  pp (0.6.3)
112
116
  prettyprint
113
117
  prettyprint (0.2.0)
114
- prism (1.8.0)
118
+ prism (1.9.0)
115
119
  psych (5.3.1)
116
120
  date
117
121
  stringio
118
122
  racc (1.8.1)
119
- rack (3.2.4)
120
123
  rainbow (3.1.1)
121
124
  rake (13.3.1)
122
125
  rdoc (7.1.0)
@@ -126,6 +129,7 @@ GEM
126
129
  regexp_parser (2.11.3)
127
130
  reline (0.6.3)
128
131
  io-console (~> 0.5)
132
+ rexml (3.4.4)
129
133
  rspec (3.13.2)
130
134
  rspec-core (~> 3.13.0)
131
135
  rspec-expectations (~> 3.13.0)
@@ -138,10 +142,10 @@ GEM
138
142
  rspec-mocks (3.13.7)
139
143
  diff-lcs (>= 1.2.0, < 2.0)
140
144
  rspec-support (~> 3.13.0)
141
- rspec-support (3.13.6)
145
+ rspec-support (3.13.7)
142
146
  rspec_junit_formatter (0.6.0)
143
147
  rspec-core (>= 2, < 4, != 2.12.0)
144
- rubocop (1.82.1)
148
+ rubocop (1.84.1)
145
149
  json (~> 2.3)
146
150
  language_server-protocol (~> 3.17.0.2)
147
151
  lint_roller (~> 1.1.0)
@@ -149,7 +153,7 @@ GEM
149
153
  parser (>= 3.3.0.2)
150
154
  rainbow (>= 2.2.2, < 4.0)
151
155
  regexp_parser (>= 2.9.3, < 3.0)
152
- rubocop-ast (>= 1.48.0, < 2.0)
156
+ rubocop-ast (>= 1.49.0, < 2.0)
153
157
  ruby-progressbar (~> 1.7)
154
158
  unicode-display_width (>= 2.4.0, < 4.0)
155
159
  rubocop-ast (1.49.0)
@@ -169,6 +173,7 @@ GEM
169
173
  simplecov_json_formatter (~> 0.1)
170
174
  simplecov-html (0.13.2)
171
175
  simplecov_json_formatter (0.1.4)
176
+ simpleidn (0.2.3)
172
177
  stringio (3.2.0)
173
178
  super_diff (0.18.0)
174
179
  attr_extras (>= 6.2.4)
@@ -185,12 +190,12 @@ GEM
185
190
  zeitwerk (2.7.4)
186
191
 
187
192
  PLATFORMS
188
- ruby
193
+ arm64-darwin
194
+ x86_64-linux-gnu
189
195
 
190
196
  DEPENDENCIES
191
- bundler (~> 2.0)
197
+ bundler (>= 2.0, < 5)
192
198
  cocina-models!
193
- committee
194
199
  debug
195
200
  rake (~> 13.0)
196
201
  rspec (~> 3.0)
@@ -200,5 +205,85 @@ DEPENDENCIES
200
205
  rubocop-rspec
201
206
  simplecov
202
207
 
208
+ CHECKSUMS
209
+ activesupport (8.1.2) sha256=88842578ccd0d40f658289b0e8c842acfe9af751afee2e0744a7873f50b6fdae
210
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
211
+ attr_extras (7.1.0) sha256=d96fc9a9dd5d85ba2d37762440a816f840093959ae26bb90da994c2d9f1fc827
212
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
213
+ bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7
214
+ cocina-models (0.110.0)
215
+ concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
216
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
217
+ date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
218
+ debug (1.11.1) sha256=2e0b0ac6119f2207a6f8ac7d4a73ca8eb4e440f64da0a3136c30343146e952b6
219
+ deprecation (1.1.0) sha256=01707cea9a6ed2d7270377457941f43394a345e6dd8048e1be6d18ff2f2a01e1
220
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
221
+ docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
222
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
223
+ dry-core (1.2.0) sha256=0cc5a7da88df397f153947eeeae42e876e999c1e30900f3c536fb173854e96a1
224
+ dry-inflector (1.3.1) sha256=7fb0c2bb04f67638f25c52e7ba39ab435d922a3a5c3cd196120f63accb682dcc
225
+ dry-logic (1.6.0) sha256=da6fedbc0f90fc41f9b0cc7e6f05f5d529d1efaef6c8dcc8e0733f685745cea2
226
+ dry-struct (1.8.0) sha256=74c38b559924fb6462ac43ec780c4533a082d7b1d238a8d7857b773b3b8e2966
227
+ dry-types (1.9.1) sha256=baebeecdb9f8395d6c9d227b62011279440943e3ef2468fe8ccc1ba11467f178
228
+ edtf (3.2.0) sha256=a15a0ee274e49c8047a3ebb5d61d793ba44f7f8ffbf0595392c467e3ea8d2447
229
+ equivalent-xml (0.6.0) sha256=8919761efa848ad0846369ff8be1f646b17e5061698c4867b09829000cc3f487
230
+ erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5
231
+ hana (1.3.7) sha256=5425db42d651fea08859811c29d20446f16af196308162894db208cac5ce9b0d
232
+ i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
233
+ ice_nine (0.11.2) sha256=5d506a7d2723d5592dc121b9928e4931742730131f22a1a37649df1c1e2e63db
234
+ io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
235
+ irb (1.16.0) sha256=2abe56c9ac947cdcb2f150572904ba798c1e93c890c256f8429981a7675b0806
236
+ json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
237
+ json_schemer (2.5.0) sha256=2f01fb4cce721a4e08dd068fc2030cffd0702a7f333f1ea2be6e8991f00ae396
238
+ jsonpath (1.1.5) sha256=29f70467193a2dc93ab864ec3d3326d54267961acc623f487340eb9c34931dbe
239
+ language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
240
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
241
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
242
+ marc (1.4.0) sha256=89f31a66c21f5a11e8fcf65fe06d207e121fb45ac6b23abef403f9ce912c7d10
243
+ minitest (6.0.1) sha256=7854c74f48e2e975969062833adc4013f249a4b212f5e7b9d5c040bf838d54bb
244
+ multi_json (1.19.1) sha256=7aefeff8f2c854bf739931a238e4aea64592845e0c0395c8a7d2eea7fdd631b7
245
+ nokogiri (1.19.0-arm64-darwin) sha256=0811dfd936d5f6dd3f6d32ef790568bf29b2b7bead9ba68866847b33c9cf5810
246
+ nokogiri (1.19.0-x86_64-linux-gnu) sha256=f482b95c713d60031d48c44ce14562f8d2ce31e3a9e8dd0ccb131e9e5a68b58c
247
+ optimist (3.2.1) sha256=8cf8a0fd69f3aa24ab48885d3a666717c27bc3d9edd6e976e18b9d771e72e34e
248
+ parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
249
+ parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
250
+ patience_diff (1.2.0) sha256=f492094486af02fff4a80070fa6b4d0ebbcf4d42fb38bba29d095eef43f6822c
251
+ pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
252
+ prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
253
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
254
+ psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
255
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
256
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
257
+ rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
258
+ rdoc (7.1.0) sha256=494899df0706c178596ca6e1d50f1b7eb285a9b2aae715be5abd742734f17363
259
+ regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
260
+ reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
261
+ rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
262
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
263
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
264
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
265
+ rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
266
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
267
+ rspec_junit_formatter (0.6.0) sha256=40dde674e6ae4e6cc0ff560da25497677e34fefd2338cc467a8972f602b62b15
268
+ rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
269
+ rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
270
+ rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
271
+ rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
272
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
273
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
274
+ simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
275
+ simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
276
+ simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
277
+ simpleidn (0.2.3) sha256=08ce96f03fa1605286be22651ba0fc9c0b2d6272c9b27a260bc88be05b0d2c29
278
+ stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
279
+ super_diff (0.18.0) sha256=9f5e77464fa75150619f7783174fbbe1bbac50a1eaf157cd39ad5584b0eac142
280
+ thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
281
+ tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
282
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
283
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
284
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
285
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
286
+ zeitwerk (2.7.4) sha256=2bef90f356bdafe9a6c2bd32bcd804f83a4f9b8bc27f3600fff051eb3edcec8b
287
+
203
288
  BUNDLED WITH
204
- 2.7.2
289
+ 4.0.6
@@ -32,16 +32,14 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'equivalent-xml' # for diffing MODS
33
33
  spec.add_dependency 'i18n' # for validating BCP 47 language tags, according to RFC 4646
34
34
  spec.add_dependency 'jsonpath' # used for date/time validation
35
+ spec.add_dependency 'json_schemer', '~> 2.0'
36
+ spec.add_dependency 'marc', '~> 1.3'
35
37
  spec.add_dependency 'nokogiri'
36
- # Match these version requirements to what committee wants,
37
- # so that our client (non-committee) users have the same dependencies.
38
- spec.add_dependency 'openapi_parser', '~> 1.0'
39
38
  spec.add_dependency 'super_diff'
40
39
  spec.add_dependency 'thor'
41
40
  spec.add_dependency 'zeitwerk', '~> 2.1'
42
41
 
43
- spec.add_development_dependency 'bundler', '~> 2.0'
44
- spec.add_development_dependency 'committee'
42
+ spec.add_development_dependency 'bundler', '>= 2.0', '< 5'
45
43
  spec.add_development_dependency 'rake', '~> 13.0'
46
44
  spec.add_development_dependency 'rspec', '~> 3.0'
47
45
  spec.add_development_dependency 'rubocop', '~> 1.24'
@@ -347,7 +347,6 @@ identifier:
347
347
  use: accession number
348
348
  - value: accession number
349
349
  - value: alternate case number
350
- - value: anchor
351
350
  - value: Apis ID
352
351
  code: apis
353
352
  - value: ARK
@@ -430,7 +429,7 @@ identifier:
430
429
  code: urn
431
430
  - value: videorecording identifier
432
431
  code: videorecording-identifier
433
- - value: 'West Mat #'
432
+ - value: "West Mat #"
434
433
  - value: Wikidata
435
434
  code: wikidata
436
435
  note:
@@ -357,7 +357,6 @@ _Path: identifier.type_
357
357
  * Deprecated. Preferred usage: accession number
358
358
  * accession number
359
359
  * alternate case number
360
- * anchor
361
360
  * Apis ID
362
361
  * ARK
363
362
  * arXiv
@@ -96,9 +96,9 @@ module Cocina
96
96
  end
97
97
 
98
98
  def schemas
99
- @schemas ||= OpenAPIParser.parse(YAML.load_file(options[:openapi]), strict_reference_validation: true)
100
- .find_object('#/components')
101
- .schemas
99
+ @schemas ||= Cocina::OpenApiWrapper.parse(YAML.load_file(options[:openapi]), strict_reference_validation: true)
100
+ .components
101
+ .schemas
102
102
  end
103
103
 
104
104
  def schema_for(schema_name, lite: false)
@@ -110,7 +110,8 @@ module Cocina
110
110
  end
111
111
 
112
112
  def defined_datatypes?(doc)
113
- doc.one_of&.map(&:name)&.all? { |name| name.present? && schemas.include?(name) }
113
+ doc.one_of.present? &&
114
+ doc.one_of.map(&:name)&.all? { |name| name.present? && schemas.include?(name) }
114
115
  end
115
116
 
116
117
  def any_datatype?(doc)
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ module Mapping
6
+ module FromMarc
7
+ # Maps Access to the cocina model
8
+ class Access
9
+ # @see #initialize
10
+ # @see #build
11
+ def self.build(...)
12
+ new(...).build
13
+ end
14
+
15
+ # @param [MARC::Record] marc MARC record from FOLIO
16
+ def initialize(marc:)
17
+ @marc = marc
18
+ end
19
+
20
+ # @return [Hash] a hash that can be mapped to a cocina model
21
+ def build
22
+ { url:, physicalLocation: physical_location }.compact_blank
23
+ end
24
+
25
+ private
26
+
27
+ def physical_location
28
+ field = marc['099']
29
+ return unless field
30
+
31
+ [{
32
+ value: field['a'],
33
+ type: 'shelf locator'
34
+ }]
35
+ end
36
+
37
+ def url
38
+ field = marc['856']
39
+ return unless field
40
+
41
+ notes = field.subfields.select { %(y z).include? it.code }.map { { value: it.value } }
42
+ [{ displayLabel: field['3'], value: field['u'], note: notes }.compact_blank]
43
+ end
44
+
45
+ attr_reader :marc
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ module Mapping
6
+ module FromMarc
7
+ # Maps AdminMetadata to the cocina model
8
+ class AdminMetadata
9
+ # @see #initialize
10
+ # @see #build
11
+ def self.build(...)
12
+ new(...).build
13
+ end
14
+
15
+ # @param [MARC::Record] marc MARC record from FOLIO
16
+ def initialize(marc:)
17
+ @marc = marc
18
+ end
19
+
20
+ # @return [Hash] a hash that can be mapped to a cocina model
21
+ def build
22
+ { contributor:, event:, identifier:, note: }.compact_blank
23
+ end
24
+
25
+ private
26
+
27
+ def contributor
28
+ field = marc['040']
29
+ return unless field
30
+
31
+ [{
32
+ type: 'organization',
33
+ name: [{ code: field['a'], source: { code: 'marcorg' } }]
34
+ }]
35
+ end
36
+
37
+ def event
38
+ [creation, modification].compact
39
+ end
40
+
41
+ def creation
42
+ field = marc['008']
43
+ return unless field
44
+
45
+ {
46
+ type: 'creation',
47
+ date: [{ value: field.value[0..5], encoding: { code: 'marc' } }]
48
+ }
49
+ end
50
+
51
+ def modification
52
+ field = marc['005']
53
+ return unless field
54
+
55
+ {
56
+ type: 'modification',
57
+ date: [{ value: field.value[0..7], encoding: { code: 'iso8601' } }]
58
+ }
59
+ end
60
+
61
+ def identifier
62
+ field = marc['001']
63
+ return unless field
64
+
65
+ [{ value: field.value, type: 'FOLIO' }]
66
+ end
67
+
68
+ def note
69
+ [{ value: "Converted from MARC to Cocina #{Date.today.iso8601}", type: 'record origin' }]
70
+ end
71
+
72
+ attr_reader :marc
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'marc_relators'
4
+
5
+ module Cocina
6
+ module Models
7
+ module Mapping
8
+ module FromMarc
9
+ # Maps contributor information from MARC records to Cocina models.
10
+ class Contributor
11
+ # @see #initialize
12
+ # @see #build
13
+ def self.build(...)
14
+ new(...).build
15
+ end
16
+
17
+ # @param [MARC::Record] marc MARC record from FOLIO
18
+ def initialize(marc:)
19
+ @marc = marc
20
+ end
21
+
22
+ # @return [Array<Hash>] an array of contributor hashes
23
+ def build
24
+ linked_100_field = Util.linked_field(marc, marc['100']) if marc['100']
25
+ linked_700_field = Util.linked_field(marc, marc['700']) if marc['700']
26
+
27
+ [
28
+ build_personal(marc['100'], primary: true),
29
+ build_personal(linked_100_field),
30
+ build_corporate(marc['110'], primary: true),
31
+ build_event(marc['111'], primary: true),
32
+ build_personal(marc['700']),
33
+ build_personal(linked_700_field),
34
+ build_corporate(marc['710']),
35
+ build_event(marc['711']),
36
+ build_personal(marc['720'])
37
+
38
+ ].compact
39
+ end
40
+
41
+ private
42
+
43
+ def build_personal(field, primary: false)
44
+ return unless field
45
+
46
+ name_type = case field.indicator1
47
+ when '1', '2'
48
+ 'person'
49
+ when '3'
50
+ 'family'
51
+ end
52
+ contributor = { type: name_type }.compact
53
+ contributor[:name] = [build_personal_name(field)]
54
+ contributor[:role] = build_roles(field)
55
+ id = build_id(field).first
56
+ contributor[:identifier] = [{ value: id.delete_prefix('https://orcid.org/'), type: 'ORCID' }.compact_blank] if id&.start_with? 'https://orcid.org/'
57
+ contributor[:status] = 'primary' if primary
58
+ contributor.compact_blank
59
+ end
60
+
61
+ def build_personal_name(field)
62
+ return unless field
63
+
64
+ name = Util.strip_punctuation(field.subfields.select { |subfield| %w[a c q d].include? subfield.code }.map(&:value).join(' '))
65
+ { value: name }
66
+ end
67
+
68
+ def build_id(field)
69
+ field.subfields.select { |subfield| %w[1].include? subfield.code }.map(&:value)
70
+ end
71
+
72
+ def build_roles(field, code: 'e')
73
+ expanded = field.subfields.select { |sf| sf.code == '4' }.map { |role| { value: MARC_RELATORS[role.value] }.compact_blank }
74
+
75
+ (field.subfields.select { |sf| sf.code == code }.map { |role| { value: role.value.sub(/.$/, '') } } +
76
+ expanded).uniq.compact_blank
77
+ end
78
+
79
+ def build_corporate(field, primary: false)
80
+ return unless field
81
+
82
+ contributor = { type: 'organization' }
83
+ name = field.subfields.select { |subfield| %w[a b q d].include? subfield.code }.map(&:value).join(' ')
84
+ contributor[:name] = [{ value: name }]
85
+ id = build_id(field).first
86
+ contributor[:identifier] = [{ uri: id }] if id
87
+
88
+ contributor[:status] = 'primary' if primary
89
+ contributor
90
+ end
91
+
92
+ def build_event(field, primary: false)
93
+ return unless field
94
+
95
+ contributor = { type: 'event' }
96
+ name = field.subfields.select { |subfield| %w[a n d c].include? subfield.code }.map(&:value).join(' ')
97
+ contributor[:name] = [{ value: name }]
98
+ roles = build_roles(field, code: 'j')
99
+ contributor[:role] = roles if roles.present?
100
+ contributor[:status] = 'primary' if primary
101
+ contributor
102
+ end
103
+
104
+ attr_reader :marc
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'marc'
4
+
3
5
  module Cocina
4
6
  module Models
5
7
  module Mapping
@@ -12,34 +14,23 @@ module Cocina
12
14
  new(...).props
13
15
  end
14
16
 
15
- # @param [Hash] marc MARC record from FOLIO
16
- # @param [String] label
17
+ # @param [MARC::Record] marc MARC record from FOLIO
17
18
  # @param [String] druid
18
- # @param [TitleBuilder] title_builder - defaults to Title class
19
19
  # @param [Cocina::Models::Mapping::ErrorNotifier] notifier
20
- def initialize(marc:, label:, druid:, title_builder: nil, notifier: nil)
21
- @title_builder = title_builder || Title
20
+ def initialize(marc:, druid:, notifier: nil)
22
21
  @marc = marc
23
- @notifier = notifier || ErrorNotifier.new(druid: druid)
24
- @druid = druid
25
- @label = label
22
+ @notifier = notifier || ErrorNotifier.new(druid:)
23
+ @purl = Cocina::Models::Mapping::Purl.for(druid:) if druid
26
24
  end
27
25
 
28
26
  # @return [Hash] a hash that can be mapped to a Cocina Description model
29
27
  def props
30
- return nil if marc.nil?
31
-
32
- DescriptionBuilder.build(title_builder: title_builder,
33
- marc: marc,
34
- notifier: notifier,
35
- purl: druid ? Cocina::Models::Mapping::Purl.for(druid: druid) : nil).tap do |properties|
36
- properties[:title] = [{ value: label }] unless properties.key?(:title)
37
- end
28
+ DescriptionBuilder.build(marc:, notifier:, purl:) if marc
38
29
  end
39
30
 
40
31
  private
41
32
 
42
- attr_reader :title_builder, :marc, :notifier, :druid, :label
33
+ attr_reader :marc, :notifier, :purl
43
34
  end
44
35
  end
45
36
  end