cocina-models 0.29.0 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +51 -0
- data/.github/pull_request_template.md +8 -1
- data/.rubocop.yml +14 -3
- data/README.md +21 -13
- data/cocina-models.gemspec +6 -1
- data/docs/index.html +20 -0
- data/docs/maps/DRO.json +1 -1
- data/exe/generator +9 -0
- data/lib/cocina/generator.rb +7 -0
- data/lib/cocina/generator/generator.rb +80 -0
- data/lib/cocina/generator/schema.rb +105 -0
- data/lib/cocina/generator/schema_array.rb +24 -0
- data/lib/cocina/generator/schema_base.rb +71 -0
- data/lib/cocina/generator/schema_ref.rb +16 -0
- data/lib/cocina/generator/schema_value.rb +38 -0
- data/lib/cocina/generator/vocab.rb +63 -0
- data/lib/cocina/models.rb +54 -25
- data/lib/cocina/models/access.rb +14 -0
- data/lib/cocina/models/admin_policy.rb +13 -56
- data/lib/cocina/models/admin_policy_administrative.rb +11 -0
- data/lib/cocina/models/administrative.rb +14 -0
- data/lib/cocina/models/applies_to.rb +9 -0
- data/lib/cocina/models/catalog_link.rb +4 -1
- data/lib/cocina/models/collection.rb +21 -31
- data/lib/cocina/models/collection_identification.rb +9 -0
- data/lib/cocina/models/contributor.rb +14 -0
- data/lib/cocina/models/description.rb +16 -7
- data/lib/cocina/models/descriptive_admin_metadata.rb +12 -0
- data/lib/cocina/models/descriptive_basic_value.rb +21 -0
- data/lib/cocina/models/descriptive_structured_value.rb +9 -0
- data/lib/cocina/models/descriptive_value.rb +23 -0
- data/lib/cocina/models/descriptive_value_required.rb +23 -0
- data/lib/cocina/models/dro.rb +34 -70
- data/lib/cocina/models/dro_access.rb +22 -0
- data/lib/cocina/models/dro_structural.rb +14 -0
- data/lib/cocina/models/embargo.rb +16 -0
- data/lib/cocina/models/event.rb +15 -0
- data/lib/cocina/models/file.rb +20 -36
- data/lib/cocina/models/file_administrative.rb +10 -0
- data/lib/cocina/models/file_set.rb +8 -15
- data/lib/cocina/models/file_set_structural.rb +9 -0
- data/lib/cocina/models/geographic.rb +10 -0
- data/lib/cocina/models/identification.rb +11 -0
- data/lib/cocina/models/message_digest.rb +17 -0
- data/lib/cocina/models/presentation.rb +12 -0
- data/lib/cocina/models/release_tag.rb +12 -7
- data/lib/cocina/models/request_admin_policy.rb +15 -3
- data/lib/cocina/models/request_collection.rb +21 -4
- data/lib/cocina/models/request_dro.rb +32 -11
- data/lib/cocina/models/request_dro_structural.rb +13 -0
- data/lib/cocina/models/request_file.rb +15 -6
- data/lib/cocina/models/request_file_set.rb +7 -9
- data/lib/cocina/models/request_file_set_structural.rb +9 -0
- data/lib/cocina/models/request_identification.rb +11 -0
- data/lib/cocina/models/sequence.rb +3 -5
- data/lib/cocina/models/source.rb +14 -0
- data/lib/cocina/models/validator.rb +28 -0
- data/lib/cocina/models/version.rb +1 -1
- data/lib/cocina/models/vocab.rb +45 -60
- data/openapi.yml +1003 -0
- metadata +116 -19
- data/.travis.yml +0 -23
- data/docs/README.md +0 -9
- data/docs/_config.yml +0 -1
- data/docs/meta.json +0 -9
- data/docs/schema.json +0 -1654
- data/docs/schema.md +0 -268
- data/lib/cocina/models/admin_policy_attributes.rb +0 -21
- data/lib/cocina/models/collection_attributes.rb +0 -22
- data/lib/cocina/models/dro_attributes.rb +0 -22
- data/lib/cocina/models/file_attributes.rb +0 -25
- data/lib/cocina/models/file_set_attributes.rb +0 -16
- data/lib/cocina/models/types.rb +0 -10
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# Metadata for a catalog link
|
6
5
|
class CatalogLink < Struct
|
6
|
+
# Catalog that is the source of the linked record.
|
7
|
+
# example: symphony
|
7
8
|
attribute :catalog, Types::Strict::String
|
9
|
+
# Record identifier that is unique within the context of the linked record's catalog.
|
10
|
+
# example: 11403803
|
8
11
|
attribute :catalogRecordId, Types::Strict::String
|
9
12
|
end
|
10
13
|
end
|
@@ -2,43 +2,33 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# A digital repository collection.
|
6
|
-
# See http://sul-dlss.github.io/cocina-models/maps/Collection.json
|
7
5
|
class Collection < Struct
|
8
6
|
include Checkable
|
9
7
|
|
10
|
-
TYPES = [
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Vocab.user_collection
|
16
|
-
].freeze
|
8
|
+
TYPES = ['http://cocina.sul.stanford.edu/models/collection.jsonld',
|
9
|
+
'http://cocina.sul.stanford.edu/models/curated-collection.jsonld',
|
10
|
+
'http://cocina.sul.stanford.edu/models/user-collection.jsonld',
|
11
|
+
'http://cocina.sul.stanford.edu/models/exhibit.jsonld',
|
12
|
+
'http://cocina.sul.stanford.edu/models/series.jsonld'].freeze
|
17
13
|
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# Identification sub-schema for the Collection
|
33
|
-
class Identification < Struct
|
34
|
-
attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
|
35
|
-
end
|
14
|
+
# The content type of the Collection. Selected from an established set of values.
|
15
|
+
# example: item
|
16
|
+
attribute :type, Types::Strict::String.enum(*Collection::TYPES)
|
17
|
+
# example: druid:bc123df4567
|
18
|
+
attribute :externalIdentifier, Types::Strict::String
|
19
|
+
# Primary processing label (can be same as title) for a Collection.
|
20
|
+
attribute :label, Types::Strict::String
|
21
|
+
# Version for the Collection within SDR.
|
22
|
+
attribute :version, Types::Strict::Integer
|
23
|
+
attribute(:access, Access.default { Access.new })
|
24
|
+
attribute :administrative, Administrative.optional.meta(omittable: true)
|
25
|
+
attribute :description, Description.optional.meta(omittable: true)
|
26
|
+
attribute :identification, CollectionIdentification.optional.meta(omittable: true)
|
36
27
|
|
37
|
-
|
28
|
+
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
29
|
+
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
30
|
+
super(attributes, safe, &block)
|
38
31
|
end
|
39
|
-
|
40
|
-
include CollectionAttributes
|
41
|
-
attribute :externalIdentifier, Types::Strict::String
|
42
32
|
end
|
43
33
|
end
|
44
34
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class Contributor < Struct
|
6
|
+
attribute :name, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
7
|
+
# Entity type of the contributor (person, organization, etc.).
|
8
|
+
attribute :type, Types::Strict::String.meta(omittable: true)
|
9
|
+
# Status of the contributor relative to other parallel contributors.
|
10
|
+
attribute :status, Types::Strict::String.meta(omittable: true)
|
11
|
+
attribute :role, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -2,15 +2,24 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# Descriptive metadata. See http://sul-dlss.github.io/cocina-models/maps/Description.json
|
6
5
|
class Description < Struct
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
attribute :title, Types::Strict::Array.of(DescriptiveValueRequired).default([].freeze)
|
7
|
+
attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
|
8
|
+
attribute :event, Types::Strict::Array.of(Event).meta(omittable: true)
|
9
|
+
attribute :form, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
10
|
+
attribute :language, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
11
|
+
attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
12
|
+
attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
13
|
+
# Stanford persistent URL associated with the resource.
|
14
|
+
attribute :purl, Types::Strict::String.meta(omittable: true)
|
15
|
+
attribute :url, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
16
|
+
attribute :marcEncodedData, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
17
|
+
attribute :adminMetadata, DescriptiveAdminMetadata.optional.meta(omittable: true)
|
12
18
|
|
13
|
-
|
19
|
+
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
20
|
+
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
21
|
+
super(attributes, safe, &block)
|
22
|
+
end
|
14
23
|
end
|
15
24
|
end
|
16
25
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class DescriptiveAdminMetadata < Struct
|
6
|
+
attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
|
7
|
+
attribute :event, Types::Strict::Array.of(Event).meta(omittable: true)
|
8
|
+
attribute :language, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
9
|
+
attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class DescriptiveBasicValue < Struct
|
6
|
+
# String value of the descriptive element.
|
7
|
+
attribute :value, Types::Strict::String.meta(omittable: true)
|
8
|
+
# Type of value provided by the descriptive element.
|
9
|
+
attribute :type, Types::Strict::String.meta(omittable: true)
|
10
|
+
# Status of the descriptive element relative to other instances of the element.
|
11
|
+
attribute :status, Types::Strict::String.meta(omittable: true)
|
12
|
+
# Code value of the descriptive element.
|
13
|
+
attribute :code, Types::Strict::String.meta(omittable: true)
|
14
|
+
# URI value of the descriptive element.
|
15
|
+
attribute :uri, Types::Strict::String.meta(omittable: true)
|
16
|
+
attribute :standard, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
17
|
+
attribute :encoding, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
18
|
+
attribute :source, Source.optional.meta(omittable: true)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class DescriptiveValue < Struct
|
6
|
+
# String value of the descriptive element.
|
7
|
+
attribute :value, Types::Strict::String.meta(omittable: true)
|
8
|
+
# Type of value provided by the descriptive element.
|
9
|
+
attribute :type, Types::Strict::String.meta(omittable: true)
|
10
|
+
# Status of the descriptive element relative to other instances of the element.
|
11
|
+
attribute :status, Types::Strict::String.meta(omittable: true)
|
12
|
+
# Code value of the descriptive element.
|
13
|
+
attribute :code, Types::Strict::String.meta(omittable: true)
|
14
|
+
# URI value of the descriptive element.
|
15
|
+
attribute :uri, Types::Strict::String.meta(omittable: true)
|
16
|
+
attribute :standard, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
17
|
+
attribute :encoding, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
18
|
+
attribute :source, Source.optional.meta(omittable: true)
|
19
|
+
attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
|
20
|
+
attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class DescriptiveValueRequired < Struct
|
6
|
+
# String value of the descriptive element.
|
7
|
+
attribute :value, Types::Strict::String.meta(omittable: true)
|
8
|
+
# Type of value provided by the descriptive element.
|
9
|
+
attribute :type, Types::Strict::String.meta(omittable: true)
|
10
|
+
# Status of the descriptive element relative to other instances of the element.
|
11
|
+
attribute :status, Types::Strict::String.meta(omittable: true)
|
12
|
+
# Code value of the descriptive element.
|
13
|
+
attribute :code, Types::Strict::String.meta(omittable: true)
|
14
|
+
# URI value of the descriptive element.
|
15
|
+
attribute :uri, Types::Strict::String.meta(omittable: true)
|
16
|
+
attribute :standard, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
17
|
+
attribute :encoding, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
|
18
|
+
attribute :source, Source.optional.meta(omittable: true)
|
19
|
+
attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
|
20
|
+
attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/cocina/models/dro.rb
CHANGED
@@ -2,80 +2,44 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# A digital repository object.
|
6
|
-
# See http://sul-dlss.github.io/cocina-models/maps/DRO.json
|
7
5
|
class DRO < Struct
|
8
6
|
include Checkable
|
9
7
|
|
10
|
-
TYPES = [
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# Subschema for embargo concerns
|
31
|
-
class Embargo < Struct
|
32
|
-
attribute :releaseDate, Types::Params::DateTime
|
33
|
-
attribute :access, Types::String.default('dark')
|
34
|
-
.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
|
35
|
-
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
36
|
-
end
|
37
|
-
|
38
|
-
attribute :access, Types::String.default('dark')
|
39
|
-
.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
|
40
|
-
attribute :copyright, Types::Strict::String.meta(omittable: true)
|
41
|
-
attribute :embargo, Embargo.optional.meta(omittable: true)
|
42
|
-
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Subschema for administrative concerns
|
46
|
-
class Administrative < Struct
|
47
|
-
# TODO: Allowing hasAdminPolicy to be omittable for now (until rolled out to consumers),
|
48
|
-
# but I think it's actually required for every DRO
|
49
|
-
attribute :hasAdminPolicy, Types::Strict::String.optional.default(nil)
|
50
|
-
attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).meta(omittable: true).default([].freeze)
|
51
|
-
attribute :partOfProject, Types::Strict::String.meta(omittable: true)
|
52
|
-
end
|
53
|
-
|
54
|
-
# Identification sub-schema for the DRO
|
55
|
-
class Identification < Struct
|
56
|
-
attribute :sourceId, Types::Strict::String.meta(omittable: true)
|
57
|
-
attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
|
58
|
-
end
|
59
|
-
|
60
|
-
# Geographic sub-schema for the DRO
|
61
|
-
class Geographic < Struct
|
62
|
-
attribute :iso19139, Types::Strict::String
|
63
|
-
end
|
64
|
-
|
65
|
-
# Structural sub-schema for the DRO (uses FileSet, unlike RequestDRO which uses RequestFileSet)
|
66
|
-
class Structural < Struct
|
67
|
-
attribute :contains, Types::Strict::Array.of(FileSet).meta(omittable: true)
|
68
|
-
attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
|
69
|
-
attribute :isMemberOf, Types::Strict::String.meta(omittable: true)
|
70
|
-
attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
|
71
|
-
end
|
72
|
-
|
73
|
-
include DroAttributes
|
8
|
+
TYPES = ['http://cocina.sul.stanford.edu/models/object.jsonld',
|
9
|
+
'http://cocina.sul.stanford.edu/models/3d.jsonld',
|
10
|
+
'http://cocina.sul.stanford.edu/models/agreement.jsonld',
|
11
|
+
'http://cocina.sul.stanford.edu/models/book.jsonld',
|
12
|
+
'http://cocina.sul.stanford.edu/models/document.jsonld',
|
13
|
+
'http://cocina.sul.stanford.edu/models/geo.jsonld',
|
14
|
+
'http://cocina.sul.stanford.edu/models/image.jsonld',
|
15
|
+
'http://cocina.sul.stanford.edu/models/page.jsonld',
|
16
|
+
'http://cocina.sul.stanford.edu/models/photograph.jsonld',
|
17
|
+
'http://cocina.sul.stanford.edu/models/manuscript.jsonld',
|
18
|
+
'http://cocina.sul.stanford.edu/models/map.jsonld',
|
19
|
+
'http://cocina.sul.stanford.edu/models/media.jsonld',
|
20
|
+
'http://cocina.sul.stanford.edu/models/track.jsonld',
|
21
|
+
'http://cocina.sul.stanford.edu/models/webarchive-binary.jsonld',
|
22
|
+
'http://cocina.sul.stanford.edu/models/webarchive-seed.jsonld'].freeze
|
23
|
+
|
24
|
+
# The content type of the DRO. Selected from an established set of values.
|
25
|
+
# example: item
|
26
|
+
attribute :type, Types::Strict::String.enum(*DRO::TYPES)
|
27
|
+
# example: druid:bc123df4567
|
74
28
|
attribute :externalIdentifier, Types::Strict::String
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
29
|
+
# Primary processing label (can be same as title) for a DRO.
|
30
|
+
attribute :label, Types::Strict::String
|
31
|
+
# Version for the DRO within SDR.
|
32
|
+
attribute :version, Types::Strict::Integer
|
33
|
+
attribute(:access, DROAccess.default { DROAccess.new })
|
34
|
+
attribute :administrative, Administrative.optional.meta(omittable: true)
|
35
|
+
attribute :description, Description.optional.meta(omittable: true)
|
36
|
+
attribute :identification, Identification.optional.meta(omittable: true)
|
37
|
+
attribute :structural, DROStructural.optional.meta(omittable: true)
|
38
|
+
attribute :geographic, Geographic.optional.meta(omittable: true)
|
39
|
+
|
40
|
+
def self.new(attributes = default_attributes, safe = false, validate = true, &block)
|
41
|
+
Validator.validate(self, attributes.with_indifferent_access) if validate && name
|
42
|
+
super(attributes, safe, &block)
|
79
43
|
end
|
80
44
|
end
|
81
45
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class DROAccess < Struct
|
6
|
+
attribute :access, Types::Strict::String.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
|
7
|
+
# The human readable copyright statement that applies
|
8
|
+
# example: Copyright World Trade Organization
|
9
|
+
attribute :copyright, Types::Strict::String.meta(omittable: true)
|
10
|
+
attribute :embargo, Embargo.optional.meta(omittable: true)
|
11
|
+
# Download access level. This is used in the transition from Fedora as a way to set a default download level at registration that is copied down to all the files.
|
12
|
+
|
13
|
+
attribute :download, Types::Strict::String.default('none').enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
|
14
|
+
# If access is "location-based", which location should have access. This is used in the transition from Fedora as a way to set a default readLocation at registration that is copied down to all the files.
|
15
|
+
|
16
|
+
attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
|
17
|
+
# The human readable use and reproduction statement that applies
|
18
|
+
# example: Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Public Services Librarian of the Dept. of Special Collections (http://library.stanford.edu/spc).
|
19
|
+
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class DROStructural < Struct
|
6
|
+
attribute :contains, Types::Strict::Array.of(FileSet).meta(omittable: true)
|
7
|
+
attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
|
8
|
+
# example: druid:bc123df4567
|
9
|
+
attribute :isMemberOf, Types::Strict::String.meta(omittable: true)
|
10
|
+
# Agreement that covers the deposit of the DRO into SDR.
|
11
|
+
attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class Embargo < Struct
|
6
|
+
# Date when the Collection is released from an embargo.
|
7
|
+
# example: 2029-06-22T07:00:00.000+00:00
|
8
|
+
attribute :releaseDate, Types::Params::DateTime
|
9
|
+
# Access level that applies when embargo expires.
|
10
|
+
attribute :access, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
|
11
|
+
# The human readable use and reproduction statement that applies when the embargo expires.
|
12
|
+
# example: These materials are in the public domain.
|
13
|
+
attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cocina
|
4
|
+
module Models
|
5
|
+
class Event < Struct
|
6
|
+
attribute :structuredValue, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
|
7
|
+
# Description of the event (creation, publication, etc.).
|
8
|
+
attribute :type, Types::Strict::String.meta(omittable: true)
|
9
|
+
attribute :date, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
10
|
+
attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
|
11
|
+
attribute :location, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
12
|
+
attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/cocina/models/file.rb
CHANGED
@@ -2,47 +2,31 @@
|
|
2
2
|
|
3
3
|
module Cocina
|
4
4
|
module Models
|
5
|
-
# Metadata for a file.
|
6
|
-
# See http://sul-dlss.github.io/cocina-models/maps/File.json
|
7
5
|
class File < Struct
|
8
6
|
include Checkable
|
9
7
|
|
10
|
-
TYPES = [
|
11
|
-
Vocab.file
|
12
|
-
].freeze
|
8
|
+
TYPES = ['http://cocina.sul.stanford.edu/models/file.jsonld'].freeze
|
13
9
|
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
|
18
|
-
end
|
19
|
-
|
20
|
-
# Represents the administration of the file
|
21
|
-
class Administrative < Struct
|
22
|
-
attribute :sdrPreserve, Types::Strict::Bool.optional.default(true)
|
23
|
-
attribute :shelve, Types::Strict::Bool.optional.default(false)
|
24
|
-
end
|
25
|
-
|
26
|
-
# Represents a digest (checksum) value for a file
|
27
|
-
class Fixity < Struct
|
28
|
-
attribute :type, Types::String.enum('md5', 'sha1')
|
29
|
-
attribute :digest, Types::Strict::String
|
30
|
-
end
|
31
|
-
|
32
|
-
class Identification < Struct
|
33
|
-
end
|
34
|
-
|
35
|
-
# Represents some technical aspect of the file
|
36
|
-
class Presentation < Struct
|
37
|
-
attribute :height, Types::Strict::Integer.optional.default(nil)
|
38
|
-
attribute :width, Types::Strict::Integer.optional.default(nil)
|
39
|
-
end
|
40
|
-
|
41
|
-
class Structural < Struct
|
42
|
-
end
|
43
|
-
|
44
|
-
include FileAttributes
|
10
|
+
# The content type of the File.
|
11
|
+
attribute :type, Types::Strict::String.enum(*File::TYPES)
|
12
|
+
# Identifier for the resource within the SDR architecture but outside of the repository. UUID. Constant across resource versions. What clients will use calling the repository.
|
45
13
|
attribute :externalIdentifier, Types::Strict::String
|
14
|
+
# Primary processing label (can be same as title) for a File.
|
15
|
+
attribute :label, Types::Strict::String
|
16
|
+
# Filename for a file. Can be same as label.
|
17
|
+
attribute :filename, Types::Strict::String
|
18
|
+
# Size of the File (binary) in bytes.
|
19
|
+
attribute :size, Types::Strict::Integer.meta(omittable: true)
|
20
|
+
# Version for the File within SDR.
|
21
|
+
attribute :version, Types::Strict::Integer
|
22
|
+
# MIME Type of the File.
|
23
|
+
attribute :hasMimeType, Types::Strict::String.meta(omittable: true)
|
24
|
+
# Use for the File.
|
25
|
+
attribute :use, Types::Strict::String.meta(omittable: true)
|
26
|
+
attribute :hasMessageDigests, Types::Strict::Array.of(MessageDigest).default([].freeze)
|
27
|
+
attribute(:access, Access.default { Access.new })
|
28
|
+
attribute(:administrative, FileAdministrative.default { FileAdministrative.new })
|
29
|
+
attribute :presentation, Presentation.optional.meta(omittable: true)
|
46
30
|
end
|
47
31
|
end
|
48
32
|
end
|