cocina-models 0.76.0 → 0.77.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff6e03954275e59dcc8fbf693f3aeef4b90742767771865508e81541f53f1cbf
4
- data.tar.gz: dacc3005506e32d5cca5b599477d1c450844272715e9500f8242bc19bf69972b
3
+ metadata.gz: 3448513fd9c5a834a341c41dc2e532fe9196d5aafca3ed6812f4243ef952e960
4
+ data.tar.gz: 2c1e122cd5d903ce1d92a443f1d8ab2879aaf8cdc9550f3b27c67342ce32bdc8
5
5
  SHA512:
6
- metadata.gz: bf5f815fb3c09ae4cba6d0e1cf16aafd7502cb731f523004c643806579475d6ac11882845a5d0178732f8d3c9edad56901bf8e05df7d5681a0afdc0032f14058
7
- data.tar.gz: 5b88e55c0e25e6dad32a4326a2063bf5a72fedc8146e90a7ead461a1fad0bb1f0f293d360f16884daf5582fa16f4e95fdb61307487e21b7a28b2250c69c1d9ad
6
+ metadata.gz: ca06ecb3bf3952a5190dbff8ce3510c4612a49e50f863d70511dd93f6678a184bd2f664197bc7a3ad5004b55d2bc7d66865b85796b39c5701e9eebdb71b580b7
7
+ data.tar.gz: 804c0deb6ec304f9e2ab44808ec7c9f9e47a4a8df15432ec66d4dd068939116f1f5a22405658a7e20651b961fba4949708b5bd28ede4f63ac0060c126416f7cc
@@ -132,6 +132,8 @@ event:
132
132
  description: The discussion of an academic or intellectual work for an audience, such as a seminar.
133
133
  - value: production
134
134
  description: The physical assembly of a resource not considered published, such as page proofs for a book.
135
+ - value: provenance
136
+ description: The resource's origins and history.
135
137
  - value: publication
136
138
  description: The publishing or issuing of a resource.
137
139
  - value: recording
@@ -141,6 +141,8 @@ _Path: event.type_
141
141
  * The discussion of an academic or intellectual work for an audience, such as a seminar.
142
142
  * production
143
143
  * The physical assembly of a resource not considered published, such as page proofs for a book.
144
+ * provenance
145
+ * The resource's origins and history.
144
146
  * publication
145
147
  * The publishing or issuing of a resource.
146
148
  * recording
@@ -15,7 +15,6 @@ module Cocina
15
15
  # @param [TitleBuilder] title_builder - defaults to Title class
16
16
  # @param [Cocina::Models::Mapping::ErrorNotifier] notifier
17
17
  # @return [Hash] a hash that can be mapped to a cocina descriptive model
18
- # @raises [Cocina::Mapper::InvalidDescMetadata] if some assumption about descMetadata is violated
19
18
  def self.props(mods:, druid:, label:, title_builder: Title, notifier: nil)
20
19
  new(title_builder: title_builder, mods: mods, druid: druid, label: label, notifier: notifier).props
21
20
  end
@@ -5,8 +5,7 @@ module Cocina
5
5
  module Mapping
6
6
  # Utility methods for generating purl links
7
7
  class Purl
8
- class_attribute :base_url
9
- self.base_url = 'https://purl.stanford.edu'
8
+ class_attribute :base_url, default: 'https://purl.stanford.edu'
10
9
 
11
10
  def self.for(druid:)
12
11
  return nil if druid.nil?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.76.0'
5
+ VERSION = '0.77.0'
6
6
  end
7
7
  end
@@ -12,8 +12,20 @@ module Cocina
12
12
  end
13
13
  end
14
14
 
15
+ SUPPORTED_TYPES = %i[
16
+ admin_policy
17
+ admin_policy_with_metadata
18
+ collection
19
+ collection_with_metadata
20
+ dro
21
+ dro_with_metadata
22
+ request_admin_policy
23
+ request_collection
24
+ request_dro
25
+ ].freeze
26
+
15
27
  def self.supported_type?(type)
16
- %i[dro collection admin_policy dro_with_metadata collection_with_metadata admin_policy_with_metadata].include?(type)
28
+ SUPPORTED_TYPES.include?(type)
17
29
  end
18
30
 
19
31
  WITH_METADATA_SUFFIX = '_with_metadata'
@@ -39,8 +51,12 @@ module Cocina
39
51
  admin_policy_id: 'druid:hv992ry2431'
40
52
  }.freeze
41
53
 
54
+ REQUEST_DRO_DEFAULTS = DRO_DEFAULTS.except(:id)
55
+
42
56
  COLLECTION_DEFAULTS = DRO_DEFAULTS.except(:source_id).merge(type: Cocina::Models::ObjectType.collection)
43
57
 
58
+ REQUEST_COLLECTION_DEFAULTS = COLLECTION_DEFAULTS.except(:id)
59
+
44
60
  ADMIN_POLICY_DEFAULTS = {
45
61
  type: Cocina::Models::ObjectType.admin_policy,
46
62
  id: 'druid:bc234fg5678',
@@ -51,19 +67,31 @@ module Cocina
51
67
  agreement_id: 'druid:hp308wm0436'
52
68
  }.freeze
53
69
 
70
+ REQUEST_ADMIN_POLICY_DEFAULTS = ADMIN_POLICY_DEFAULTS.except(:id)
71
+
72
+ def self.build_dro_properties(id:, **kwargs)
73
+ build_request_dro_properties(**kwargs)
74
+ .merge(externalIdentifier: id)
75
+ .tap do |props|
76
+ props[:description][:purl] = "https://purl.stanford.edu/#{id.delete_prefix('druid:')}"
77
+ end
78
+ end
79
+
80
+ def self.build_dro(attributes)
81
+ Cocina::Models.build(build_dro_properties(**DRO_DEFAULTS.merge(attributes)))
82
+ end
83
+
54
84
  # rubocop:disable Metrics/ParameterLists
55
- def self.build_dro_properties(type:, id:, version:, label:, title:, source_id:, admin_policy_id:,
56
- barcode: nil, catkeys: [], collection_ids: [])
85
+ def self.build_request_dro_properties(type:, version:, label:, title:, source_id:, admin_policy_id:,
86
+ barcode: nil, catkeys: [], collection_ids: [])
57
87
  {
58
88
  type: type,
59
- externalIdentifier: id,
60
89
  version: version,
61
90
  label: label,
62
91
  access: {},
63
92
  administrative: { hasAdminPolicy: admin_policy_id },
64
93
  description: {
65
- title: [{ value: title }],
66
- purl: "https://purl.stanford.edu/#{id.delete_prefix('druid:')}"
94
+ title: [{ value: title }]
67
95
  },
68
96
  identification: {
69
97
  sourceId: source_id
@@ -82,22 +110,28 @@ module Cocina
82
110
  end
83
111
  # rubocop:enable Metrics/ParameterLists
84
112
 
85
- def self.build_dro(attributes)
86
- Cocina::Models.build(build_dro_properties(**DRO_DEFAULTS.merge(attributes)))
113
+ def self.build_request_dro(attributes)
114
+ Cocina::Models.build_request(build_request_dro_properties(**REQUEST_DRO_DEFAULTS.merge(attributes)))
115
+ end
116
+
117
+ def self.build_collection_properties(id:, **kwargs)
118
+ build_request_collection_properties(**kwargs)
119
+ .merge(externalIdentifier: id)
120
+ .tap do |props|
121
+ props[:description][:purl] = "https://purl.stanford.edu/#{id.delete_prefix('druid:')}"
122
+ end
87
123
  end
88
124
 
89
125
  # rubocop:disable Metrics/ParameterLists
90
- def self.build_collection_properties(type:, id:, version:, label:, title:, admin_policy_id:, source_id: nil, catkeys: [])
126
+ def self.build_request_collection_properties(type:, version:, label:, title:, admin_policy_id:, source_id: nil, catkeys: [])
91
127
  {
92
128
  type: type,
93
- externalIdentifier: id,
94
129
  version: version,
95
130
  label: label,
96
131
  access: {},
97
132
  administrative: { hasAdminPolicy: admin_policy_id },
98
133
  description: {
99
- title: [{ value: title }],
100
- purl: "https://purl.stanford.edu/#{id.delete_prefix('druid:')}"
134
+ title: [{ value: title }]
101
135
  },
102
136
  identification: {}
103
137
  }.tap do |props|
@@ -115,19 +149,34 @@ module Cocina
115
149
  Cocina::Models.build(build_collection_properties(**COLLECTION_DEFAULTS.merge(attributes)))
116
150
  end
117
151
 
152
+ def self.build_request_collection(attributes)
153
+ Cocina::Models.build_request(build_request_collection_properties(**REQUEST_COLLECTION_DEFAULTS.merge(attributes)))
154
+ end
155
+
118
156
  def self.build_admin_policy(attributes)
119
157
  Cocina::Models.build(build_admin_policy_properties(**ADMIN_POLICY_DEFAULTS.merge(attributes)))
120
158
  end
121
159
 
160
+ def self.build_request_admin_policy(attributes)
161
+ Cocina::Models.build_request(build_request_admin_policy_properties(**REQUEST_ADMIN_POLICY_DEFAULTS.merge(attributes)))
162
+ end
163
+
164
+ def self.build_admin_policy_properties(id:, **kwargs)
165
+ build_request_admin_policy_properties(**kwargs)
166
+ .merge(externalIdentifier: id)
167
+ .tap do |props|
168
+ props[:description][:purl] = "https://purl.stanford.edu/#{id.delete_prefix('druid:')}"
169
+ end
170
+ end
171
+
122
172
  # rubocop:disable Metrics/ParameterLists
123
- def self.build_admin_policy_properties(type:, id:, version:, label:, title:,
124
- admin_policy_id:, agreement_id:,
125
- use_statement: nil, copyright: nil, license: nil,
126
- registration_workflow: nil, collections_for_registration: nil,
127
- without_description: false)
173
+ def self.build_request_admin_policy_properties(type:, version:, label:, title:,
174
+ admin_policy_id:, agreement_id:,
175
+ use_statement: nil, copyright: nil, license: nil,
176
+ registration_workflow: nil, collections_for_registration: nil,
177
+ without_description: false)
128
178
  {
129
179
  type: type,
130
- externalIdentifier: id,
131
180
  version: version,
132
181
  label: label,
133
182
  administrative: {
@@ -139,8 +188,7 @@ module Cocina
139
188
  }
140
189
  },
141
190
  description: {
142
- title: [{ value: title }],
143
- purl: "https://purl.stanford.edu/#{id.delete_prefix('druid:')}"
191
+ title: [{ value: title }]
144
192
  }
145
193
  }.tap do |props|
146
194
  props[:administrative][:accessTemplate][:useAndReproductionStatement] = use_statement if use_statement
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocina-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.76.0
4
+ version: 0.77.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-28 00:00:00.000000000 Z
11
+ date: 2022-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -306,20 +306,6 @@ files:
306
306
  - docs/cocina-base.jsonld
307
307
  - docs/description_types.md
308
308
  - docs/index.html
309
- - docs/maps/Agent.json
310
- - docs/maps/Collection.json
311
- - docs/maps/DRO.json
312
- - docs/maps/Description.json
313
- - docs/maps/File.json
314
- - docs/maps/Fileset.json
315
- - docs/maps/README.md
316
- - docs/maps/ReleaseTag.json
317
- - docs/maps/Sequence.json
318
- - docs/maps/Title.json
319
- - docs/sampleETD/foxml-export.xml
320
- - docs/sampleETD/foxml.xml
321
- - docs/sampleETD/xn109qc9773_bibframe.ttl
322
- - docs/sampleETD/xn109qc9773_taco.json
323
309
  - exe/generator
324
310
  - lib/cocina/generator.rb
325
311
  - lib/cocina/generator/datatype.rb
@@ -490,7 +476,7 @@ homepage: https://github.com/sul-dlss/cocina-models
490
476
  licenses: []
491
477
  metadata:
492
478
  rubygems_mfa_required: 'true'
493
- post_install_message:
479
+ post_install_message:
494
480
  rdoc_options: []
495
481
  require_paths:
496
482
  - lib
@@ -505,8 +491,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
505
491
  - !ruby/object:Gem::Version
506
492
  version: '0'
507
493
  requirements: []
508
- rubygems_version: 3.3.9
509
- signing_key:
494
+ rubygems_version: 3.2.32
495
+ signing_key:
510
496
  specification_version: 4
511
497
  summary: Data models for the SDR
512
498
  test_files: []
data/docs/maps/Agent.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-06/schema#",
3
- "id": "http://cocina.sul.stanford.edu/schemas/Agent",
4
- "title": "Agent",
5
- "description": "An Agent - Person, Group, Organization, or other Acting body.",
6
- "type": "object",
7
- "required": ["name"],
8
- "properties": {
9
- "name": {
10
- "description": "Primary label or name for an Agent.",
11
- "type": "string"
12
- },
13
- "sunetID": {
14
- "description": "Stanford University NetID for the Agent.",
15
- "type": "string"
16
- }
17
- }
18
- }
@@ -1,240 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-06/schema#",
3
- "id": "http://cocina.sul.stanford.edu/schemas/Collection",
4
- "title": "Digital Repository Collection",
5
- "description": "A group of Digital Repository Objects that indicate some type of conceptual grouping within the domain that is worth reusing across the system.",
6
- "type": "object",
7
- "required": ["@context", "@type", "externalIdentifier", "label", "internalIdentifier", "version", "administrative", "access", "description", "identification", "structural"],
8
- "properties": {
9
- "@context": {
10
- "description": "URI for the JSON-LD context definitions.",
11
- "type": "string"
12
- },
13
- "@type": {
14
- "description": "The content type of the Collection. Selected from an established set of values.",
15
- "type": "string",
16
- "enum": [
17
- "http://cocina.sul.stanford.edu/models/collection.jsonld",
18
- "http://cocina.sul.stanford.edu/models/curated-collection.jsonld",
19
- "http://cocina.sul.stanford.edu/models/user-collection.jsonld",
20
- "http://cocina.sul.stanford.edu/models/exhibit.jsonld",
21
- "http://cocina.sul.stanford.edu/models/series.jsonld"
22
- ]
23
- },
24
- "citation": {
25
- "description": "Citation for the resource, including identifier, label, version, and a persistent URL to the object with SDR at the very least.",
26
- "type": "string"
27
- },
28
- "dedupeIdentifier": {
29
- "description": "Identifier retrieved from identification.sourceId that stands for analog or source identifier that this resource is a digital representation of.",
30
- "type": "string"
31
- },
32
- "depositor": {
33
- "description": "The Agent (User, Group, Application, Department, other) that deposited the Collection into SDR.",
34
- "$ref": "/Agent"
35
- },
36
- "description": {
37
- "description": "Descriptive metadata for the DRO.",
38
- "$ref": "/Description"
39
- },
40
- "externalIdentifier": {
41
- "description": "Identifier for the resource within the SDR architecture but outside of the repository. DRUID or UUID depending on resource type. Constant across resource versions. What clients will use calling the repository. Same as `identification.identifier`",
42
- "type": "string"
43
- },
44
- "label": {
45
- "description": "Primary processing label (can be same as title) for a Collection.",
46
- "type": "string"
47
- },
48
- "internalIdentifier": {
49
- "description": "Identifier for the resource within the repository. UUID, unique for each new version of a repository resource.",
50
- "type": "string"
51
- },
52
- "version": {
53
- "description": "Version for the Collection within SDR.",
54
- "type": "integer"
55
- },
56
- "precedingVersion": {
57
- "description": "Preceding version for the Collection within SDR.",
58
- "type": "string"
59
- },
60
- "followingVersion": {
61
- "description": "Following version for the Collection within SDR.",
62
- "type": "string"
63
- },
64
- "access": {
65
- "description": "Access Metadata for the Collection.",
66
- "type": "object",
67
- "required": ["access", "download"],
68
- "properties": {
69
- "access": {
70
- "description": "Access level for the Collection.",
71
- "type": "string",
72
- "enum": ["world", "stanford", "location-based", "citation-only", "dark"]
73
- },
74
- "copyright": {
75
- "description": "The human readable copyright statement that applies to the Collection.",
76
- "type": "string"
77
- },
78
- "download": {
79
- "description": "Download level for the Collection metadata.",
80
- "type": "string",
81
- "enum": ["world", "stanford", "location-based", "citation-only", "dark"]
82
- },
83
- "embargoReleaseDate": {
84
- "description": "Date when the Collection is released from an embargo, if an embargo exists.",
85
- "type": "string",
86
- "format": "date-time"
87
- },
88
- "license": {
89
- "description": "The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).",
90
- "type": "string"
91
- },
92
- "useAndReproductionStatement": {
93
- "description": "The human readable reuse and reproduction statement that applies to the Collection.",
94
- "type": "string"
95
- },
96
- "termsOfUse": {
97
- "description": "License or terms of use governing reuse of the Collection. Should be a text statement.",
98
- "type": "string"
99
- }
100
- }
101
- },
102
- "administrative": {
103
- "type": "object",
104
- "description": "Administrative metadata for the SDR resource.",
105
- "required": ["created", "isDescribedBy", "sdrPreserve"],
106
- "properties": {
107
- "created": {
108
- "description": "When the resource in SDR was created.",
109
- "type": "string",
110
- "format": "date-time"
111
- },
112
- "deleted": {
113
- "description": "If the resource has been deleted (but not purged).",
114
- "type": "boolean"
115
- },
116
- "gravestoneMessage": {
117
- "description": "Message describing why the object was deleted.",
118
- "type": "string"
119
- },
120
- "isDescribedBy": {
121
- "description": "PURL/XML file that is a traditional representation of the metadata for the Collection.",
122
- "type": "string"
123
- },
124
- "lastUpdated": {
125
- "description": "When the resource in SDR was last updated.",
126
- "type": "string",
127
- "format": "date-time"
128
- },
129
- "partOfProject": {
130
- "description": "Administrative or Internal project this resource is a part of.",
131
- "type": "string"
132
- },
133
- "releaseTags": {
134
- "description": "Tags for release",
135
- "type": "array",
136
- "items": {
137
- "$ref": "/ReleaseTag"
138
- }
139
- },
140
- "sdrPreserve": {
141
- "description": "If this resource should be sent to Preservation.",
142
- "type": "boolean"
143
- },
144
- "remediatedBy": {
145
- "description": "The Agent (User, Group, Application, Department, other) that remediated a Collection in SDR.",
146
- "type": "array",
147
- "items": {
148
- "$ref": "/Agent"
149
- }
150
- }
151
- }
152
- },
153
- "identification": {
154
- "description": "Identifying information for the Collection.",
155
- "type": "object",
156
- "required": ["identifier"],
157
- "properties": {
158
- "catalogLinks": {
159
- "description": "Links to catalog records for the resource that the Collection represents in whole or part.",
160
- "type": "array",
161
- "items": {
162
- "type": "object",
163
- "required": ["catalog", "catalogRecordId"],
164
- "properties": {
165
- "catalog": {
166
- "description": "Catalog that is the source of the linked record.",
167
- "type": "string"
168
- },
169
- "catalogRecordId": {
170
- "description": "Record identifier that is unique within the context of the linked record's catalog.",
171
- "type": "string"
172
- },
173
- "recordSchema": {
174
- "description": "Metadata schema of the linked record.",
175
- "type": "string"
176
- },
177
- "deriveMetadata": {
178
- "description": "If the Collection descriptive metadata should be automatically updated when the linked record changes.",
179
- "type": "boolean"
180
- },
181
- "deliverMetadata": {
182
- "description": "If the linked record should be automatically updated when the Collection descriptive metadata changes.",
183
- "type": "boolean"
184
- },
185
- "recordScope": {
186
- "description": "Whether the linked record describes a resource that is broader than, equivalent to, or narrower than the resource the Collection represents.",
187
- "type": "string",
188
- "enum": ["broader", "equivalent", "narrower"]
189
- }
190
- }
191
- }
192
- },
193
- "DOI": {
194
- "description": "Digital Object Identifier (DOI) for the Collection within this repository.",
195
- "type": "string"
196
- },
197
- "identifier": {
198
- "description": "Identifier for the Collection within the Stanford Digital Repository system",
199
- "type": "string"
200
- },
201
- "sameAs": {
202
- "description": "Another object, either external or internal to the system (if duplication occurs) that is the same digital resource as this Collection.",
203
- "type": "string"
204
- },
205
- "sourceId": {
206
- "description": "A source resource or object (perhaps but not necessarily analog or physical) that the Collection is a digital representation of.",
207
- "type": "string"
208
- },
209
- "sdrUUID": {
210
- "type": "string",
211
- "description": "UUID previously minted for the resource within SDR2 / Fedora 3."
212
- }
213
- }
214
- },
215
- "structural": {
216
- "description": "Structural metadata for the Collection.",
217
- "type": "object",
218
- "properties": {
219
- "hasMember": {
220
- "description": "Component digital repository objects or collections that are a part of this collection.",
221
- "type": "array",
222
- "items": {
223
- "type": "string"
224
- }
225
- },
226
- "isTargetOf": {
227
- "description": "An Annotation instance that applies to the Collection.",
228
- "type": "string"
229
- },
230
- "hasMemberOrders": {
231
- "description": "Provided sequences or orderings of members of the Collection, including some metadata about each sequence (i.e. sequence label, sequence type, if the sequence is primary, etc.).",
232
- "type": "array",
233
- "items": {
234
- "$ref": "/Sequence"
235
- }
236
- }
237
- }
238
- }
239
- }
240
- }