cocina-models 0.54.0 → 0.58.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocina/generator/generator.rb +2 -0
  3. data/lib/cocina/generator/schema.rb +1 -1
  4. data/lib/cocina/generator/schema_base.rb +10 -0
  5. data/lib/cocina/generator/schema_value.rb +2 -1
  6. data/lib/cocina/generator/vocab.rb +30 -13
  7. data/lib/cocina/models/access.rb +10 -2
  8. data/lib/cocina/models/admin_policy_administrative.rb +8 -3
  9. data/lib/cocina/models/admin_policy_default_access.rb +25 -0
  10. data/lib/cocina/models/administrative.rb +1 -1
  11. data/lib/cocina/models/business_barcode.rb +9 -0
  12. data/lib/cocina/models/catkey_barcode.rb +9 -0
  13. data/lib/cocina/models/collection_identification.rb +1 -1
  14. data/lib/cocina/models/contributor.rb +4 -3
  15. data/lib/cocina/models/description.rb +2 -2
  16. data/lib/cocina/models/descriptive_basic_value.rb +8 -8
  17. data/lib/cocina/models/descriptive_parallel_contributor.rb +19 -0
  18. data/lib/cocina/models/descriptive_parallel_event.rb +2 -2
  19. data/lib/cocina/models/descriptive_value.rb +8 -8
  20. data/lib/cocina/models/descriptive_value_language.rb +4 -4
  21. data/lib/cocina/models/dro_access.rb +8 -6
  22. data/lib/cocina/models/dro_structural.rb +1 -1
  23. data/lib/cocina/models/embargo.rb +1 -1
  24. data/lib/cocina/models/event.rb +2 -2
  25. data/lib/cocina/models/file.rb +3 -3
  26. data/lib/cocina/models/file_access.rb +4 -4
  27. data/lib/cocina/models/file_set.rb +16 -1
  28. data/lib/cocina/models/identification.rb +3 -1
  29. data/lib/cocina/models/language.rb +7 -7
  30. data/lib/cocina/models/presentation.rb +2 -2
  31. data/lib/cocina/models/related_resource.rb +6 -6
  32. data/lib/cocina/models/release_tag.rb +4 -4
  33. data/lib/cocina/models/request_dro_structural.rb +1 -1
  34. data/lib/cocina/models/request_file.rb +4 -4
  35. data/lib/cocina/models/request_file_set.rb +16 -1
  36. data/lib/cocina/models/request_identification.rb +2 -0
  37. data/lib/cocina/models/sequence.rb +1 -1
  38. data/lib/cocina/models/source.rb +4 -4
  39. data/lib/cocina/models/standard.rb +4 -4
  40. data/lib/cocina/models/standard_barcode.rb +9 -0
  41. data/lib/cocina/models/title.rb +8 -8
  42. data/lib/cocina/models/version.rb +1 -1
  43. data/lib/cocina/models/vocab.rb +66 -4
  44. data/openapi.yml +174 -4
  45. metadata +11 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aef820c19c5713ea051cebe2b29f458413bda243c7906f4e75e29f655c21119
4
- data.tar.gz: 43a183c9e4b8e7a993e5ed04b1379d3ffa40b0831a2a471cc63a048698799a26
3
+ metadata.gz: 11f8ca2b0924a901afd8988d67184b44b91ad061ca2cdf7965042b8c1282f2e2
4
+ data.tar.gz: 82423f38ede08c6f0046a08abaaa87a1c4ddad1926c8dc56050788cb7a75ad55
5
5
  SHA512:
6
- metadata.gz: 1fb48a8bc9573cb59fb8c9c36246aad1ddaa2afc4dc122c793b97c5d4fe5ee364f1a75c65b43ac5845f1ee4ce633a2739d17bd2d3e7ac15dfd88642c4911272c
7
- data.tar.gz: b5e4db39b12e7e300d2a45b8be2a06a2683cedaf9ea98aafe7716e36552a1432650c9f1c71438d07dc123f993290909eb3dbb71597cfda78005a91c064b09247
6
+ metadata.gz: 982da9783c7e8c86a32c68d7946f1dfa695ab6ce9b5a2bf84d1ade358d7f0855072553ef4fe6fda35c685d39cc464402258572547ce5d06258c1f53fe9c780de
7
+ data.tar.gz: 269a9c9e3460d46edf2aaa085535ec626195666adad478173e1ab0e86643a0be7539c5bfdf9db47db6e5ab4a65042bd39c7a938c0f0b6d0d21b6596df64a3d43
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'fileutils'
4
+
3
5
  module Cocina
4
6
  module Generator
5
7
  # Class for generating Cocina models from openapi.
@@ -96,7 +96,7 @@ module Cocina
96
96
  doc.properties.map do |key, properties_doc|
97
97
  property_class_for(properties_doc).new(properties_doc,
98
98
  key: key,
99
- required: doc.requires?(properties_doc),
99
+ required: doc.requires?(key),
100
100
  parent: self)
101
101
  end
102
102
  end
@@ -21,12 +21,22 @@ module Cocina
21
21
  key || schema_doc.name
22
22
  end
23
23
 
24
+ # Allows non-required values to not be provided. This allows smaller
25
+ # requests as not every field needs to be present.
24
26
  def omittable
25
27
  return '' if required
26
28
 
27
29
  '.meta(omittable: true)'
28
30
  end
29
31
 
32
+ # Allows non-required values to be set to nil. This is useful when doing
33
+ # an update and you want to clear out a value.
34
+ def optional
35
+ return '' if required
36
+
37
+ '.optional'
38
+ end
39
+
30
40
  def quote(item)
31
41
  return item unless schema_doc.type == 'string'
32
42
 
@@ -6,7 +6,8 @@ module Cocina
6
6
  class SchemaValue < SchemaBase
7
7
  # rubocop:disable Layout/LineLength
8
8
  def generate
9
- "#{description}#{example}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{default}#{enum}#{omittable}"
9
+ # optional has to come before default or the default value that gets set will be nil.
10
+ "#{description}#{example}attribute :#{name.camelize(:lower)}, Types::#{dry_datatype(schema_doc)}#{optional}#{default}#{enum}#{omittable}"
10
11
  end
11
12
  # rubocop:enable Layout/LineLength
12
13
 
@@ -33,23 +33,40 @@ module Cocina
33
33
 
34
34
  attr_reader :schemas
35
35
 
36
- # rubocop:disable Style/MultilineBlockChain
36
+ BASE = 'http://cocina.sul.stanford.edu/models/'
37
+
37
38
  def vocabs
38
- schemas.values.map do |schema|
39
- type_property = schema.properties['type']
40
- type_property.nil? ? [] : type_property.enum.to_a
41
- end
42
- .flatten
43
- .uniq
44
- .sort
45
- .filter { |vocab| vocab.start_with?('http://cocina.sul.stanford.edu/models') }
39
+ type_properties = schemas.values.map { |schema| schema.properties['type'] }.compact
40
+ type_properties.map(&:enum).flat_map(&:to_a)
41
+ .filter { |vocab| vocab.start_with?(BASE) }
42
+ .uniq
43
+ .sort
46
44
  end
47
- # rubocop:enable Style/MultilineBlockChain
48
45
 
49
46
  def vocab_methods
50
- # Note special handling of 3d
51
- vocabs.map do |vocab|
52
- name = vocab[38, vocab.size - 45].gsub('-', '_').gsub('3d', 'three_dimensional')
47
+ names = vocabs.each_with_object({}) do |vocab, object|
48
+ # Note special handling of 3d
49
+ namespaced = vocab.delete_prefix(BASE).delete_suffix('.jsonld')
50
+ .gsub('-', '_').gsub('3d', 'three_dimensional')
51
+ namespace, name = namespaced.include?('/') ? namespaced.split('/') : [:root, namespaced]
52
+ object[namespace] ||= {}
53
+ object[namespace][name] = vocab
54
+ end
55
+ draw_namespaced_methods(names)
56
+ end
57
+
58
+ def draw_namespaced_methods(names)
59
+ names.flat_map do |namespace, methods|
60
+ [].tap do |items|
61
+ items << "class #{namespace.capitalize}" unless namespace == :root
62
+ items << draw_ruby_methods(methods)
63
+ items << 'end' unless namespace == :root
64
+ end
65
+ end.join("\n")
66
+ end
67
+
68
+ def draw_ruby_methods(methods)
69
+ methods.map do |name, vocab|
53
70
  <<~RUBY
54
71
  def self.#{name}
55
72
  "#{vocab}"
@@ -4,9 +4,17 @@ module Cocina
4
4
  module Models
5
5
  class Access < Struct
6
6
  # Access level
7
- attribute :access, Types::Strict::String.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
7
+ attribute :access, Types::Strict::String.optional.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
8
+ # The human readable copyright statement that applies
9
+ # example: Copyright World Trade Organization
10
+ attribute :copyright, Types::Strict::String.meta(omittable: true)
8
11
  # If access is "location-based", which location should have access.
9
- attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
12
+ attribute :readLocation, Types::Strict::String.optional.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
13
+ # The human readable use and reproduction statement that applies
14
+ # 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).
15
+ attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
16
+ # The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
17
+ attribute :license, Types::Strict::String.optional.meta(omittable: true)
10
18
  end
11
19
  end
12
20
  end
@@ -3,14 +3,19 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class AdminPolicyAdministrative < Struct
6
- attribute :defaultObjectRights, Types::Strict::String.default('<?xml version="1.0" encoding="UTF-8"?><rightsMetadata><access type="discover"><machine><world/></machine></access><access type="read"><machine><world/></machine></access><use><human type="useAndReproduction"/><human type="creativeCommons"/><machine type="creativeCommons" uri=""/><human type="openDataCommons"/><machine type="openDataCommons" uri=""/></use><copyright><human/></copyright></rightsMetadata>').meta(omittable: true)
6
+ # This is an XML expression of the default access (see defaultAccess)
7
+ attribute :defaultObjectRights, Types::Strict::String.default('<?xml version="1.0" encoding="UTF-8"?><rightsMetadata><access type="discover"><machine><world/></machine></access><access type="read"><machine><world/></machine></access><use><human type="useAndReproduction"/><human type="creativeCommons"/><machine type="creativeCommons" uri=""/><human type="openDataCommons"/><machine type="openDataCommons" uri=""/></use><copyright><human/></copyright></rightsMetadata>').optional.meta(omittable: true)
8
+ attribute :defaultAccess, AdminPolicyDefaultAccess.optional.meta(omittable: true)
7
9
  attribute :registrationWorkflow, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
8
10
  # An additional workflow to start for objects managed by this admin policy once the end-accession workflow step is complete
9
11
  # example: wasCrawlPreassemblyWF
10
- attribute :disseminationWorkflow, Types::Strict::String.meta(omittable: true)
12
+ attribute :disseminationWorkflow, Types::Strict::String.optional.meta(omittable: true)
11
13
  attribute :collectionsForRegistration, Types::Strict::Array.of(Types::Strict::String).meta(omittable: true)
12
- attribute :roles, Types::Strict::Array.of(AccessRole).meta(omittable: true)
14
+ # example: druid:bc123df4567
13
15
  attribute :hasAdminPolicy, Types::Strict::String
16
+ # example: druid:bc123df4567
17
+ attribute :referencesAgreement, Types::Strict::String.optional.meta(omittable: true)
18
+ attribute :roles, Types::Strict::Array.of(AccessRole).meta(omittable: true)
14
19
  end
15
20
  end
16
21
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class AdminPolicyDefaultAccess < Struct
6
+ attribute :access, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark').optional.meta(omittable: true)
7
+ # Available for controlled digital lending.
8
+ attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
9
+ # The human readable copyright statement that applies
10
+ # example: Copyright World Trade Organization
11
+ attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
12
+ # 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.
13
+
14
+ attribute :download, Types::Strict::String.enum('world', 'stanford', 'location-based', 'none').optional.meta(omittable: true)
15
+ # 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.
16
+
17
+ attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').optional.meta(omittable: true)
18
+ # The human readable use and reproduction statement that applies
19
+ # 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).
20
+ attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
21
+ # The license governing reuse of the Collection. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
22
+ attribute :license, Types::Strict::String.optional.meta(omittable: true)
23
+ end
24
+ end
25
+ end
@@ -8,7 +8,7 @@ module Cocina
8
8
  attribute :releaseTags, Types::Strict::Array.of(ReleaseTag).meta(omittable: true)
9
9
  # Administrative or Internal project this resource is a part of
10
10
  # example: Google Books
11
- attribute :partOfProject, Types::Strict::String.meta(omittable: true)
11
+ attribute :partOfProject, Types::Strict::String.optional.meta(omittable: true)
12
12
  end
13
13
  end
14
14
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ BusinessBarcode = Types::String.constrained(
6
+ format: /^2050[0-9]{7}$/i
7
+ )
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ CatkeyBarcode = Types::String.constrained(
6
+ format: /^[0-9]+-[0-9]+$/i
7
+ )
8
+ end
9
+ end
@@ -6,7 +6,7 @@ module Cocina
6
6
  # Unique identifier in some other system. This is because a large proportion of what is deposited in SDR, historically and currently, are representations of objects that are also represented in other systems. For example, digitized paper and A/V collections have physical manifestations, and those physical objects are managed in systems that have their own identifiers. Similarly, books have barcodes, archival materials have collection numbers and physical locations, etc. The sourceId allows determining if an item has been deposited before and where to look for the original item if you're looking at its SDR representation. The format is: "namespace:identifier"
7
7
 
8
8
  # example: sul:PC0170_s3_Fiesta_Bowl_2012-01-02_210609_2026
9
- attribute :sourceId, Types::Strict::String.meta(omittable: true)
9
+ attribute :sourceId, Types::Strict::String.optional.meta(omittable: true)
10
10
  attribute :catalogLinks, Types::Strict::Array.of(CatalogLink).meta(omittable: true)
11
11
  end
12
12
  end
@@ -5,14 +5,15 @@ module Cocina
5
5
  class Contributor < Struct
6
6
  attribute :name, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
7
  # Entity type of the contributor (person, organization, etc.).
8
- attribute :type, Types::Strict::String.meta(omittable: true)
8
+ attribute :type, Types::Strict::String.optional.meta(omittable: true)
9
9
  # Status of the contributor relative to other parallel contributors (e.g. the primary author among a group of contributors).
10
- attribute :status, Types::Strict::String.meta(omittable: true)
10
+ attribute :status, Types::Strict::String.optional.meta(omittable: true)
11
11
  attribute :role, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
12
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
13
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
14
14
  # URL or other pointer to the location of the contributor information.
15
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
15
+ attribute :valueAt, Types::Strict::String.optional.meta(omittable: true)
16
+ attribute :parallelContributor, Types::Strict::Array.of(DescriptiveParallelContributor).meta(omittable: true)
16
17
  end
17
18
  end
18
19
  end
@@ -13,13 +13,13 @@ module Cocina
13
13
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
14
14
  attribute :subject, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
15
15
  # Stanford persistent URL associated with the resource.
16
- attribute :purl, Types::Strict::String.meta(omittable: true)
16
+ attribute :purl, Types::Strict::String.optional.meta(omittable: true)
17
17
  attribute :access, DescriptiveAccessMetadata.optional.meta(omittable: true)
18
18
  attribute :relatedResource, Types::Strict::Array.of(RelatedResource).meta(omittable: true)
19
19
  attribute :marcEncodedData, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
20
20
  attribute :adminMetadata, DescriptiveAdminMetadata.optional.meta(omittable: true)
21
21
  # URL or other pointer to the location of the resource description.
22
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
22
+ attribute :valueAt, Types::Strict::String.optional.meta(omittable: true)
23
23
 
24
24
  def self.new(attributes = default_attributes, safe = false, validate = true, &block)
25
25
  Validator.validate(self, attributes.with_indifferent_access) if validate && name
@@ -7,27 +7,27 @@ module Cocina
7
7
  attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
8
8
  attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
9
9
  # String or integer value of the descriptive element.
10
- attribute :value, Types::Nominal::Any.meta(omittable: true)
10
+ attribute :value, Types::Nominal::Any.optional.meta(omittable: true)
11
11
  # Type of value provided by the descriptive element.
12
- attribute :type, Types::Strict::String.meta(omittable: true)
12
+ attribute :type, Types::Strict::String.optional.meta(omittable: true)
13
13
  # Status of the descriptive element value relative to other instances of the element.
14
- attribute :status, Types::Strict::String.meta(omittable: true)
14
+ attribute :status, Types::Strict::String.optional.meta(omittable: true)
15
15
  # Code value of the descriptive element.
16
- attribute :code, Types::Strict::String.meta(omittable: true)
16
+ attribute :code, Types::Strict::String.optional.meta(omittable: true)
17
17
  # URI value of the descriptive element.
18
- attribute :uri, Types::Strict::String.meta(omittable: true)
18
+ attribute :uri, Types::Strict::String.optional.meta(omittable: true)
19
19
  attribute :standard, Standard.optional.meta(omittable: true)
20
20
  attribute :encoding, Standard.optional.meta(omittable: true)
21
21
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
22
22
  attribute :source, Source.optional.meta(omittable: true)
23
23
  # The preferred display label to use for the descriptive element in access systems.
24
- attribute :displayLabel, Types::Strict::String.meta(omittable: true)
24
+ attribute :displayLabel, Types::Strict::String.optional.meta(omittable: true)
25
25
  # A term providing information about the circumstances of the statement (e.g., approximate dates).
26
- attribute :qualifier, Types::Strict::String.meta(omittable: true)
26
+ attribute :qualifier, Types::Strict::String.optional.meta(omittable: true)
27
27
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
28
28
  attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
29
29
  # URL or other pointer to the location of the value of the descriptive element.
30
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
30
+ attribute :valueAt, Types::Strict::String.optional.meta(omittable: true)
31
31
  end
32
32
  end
33
33
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocina
4
+ module Models
5
+ class DescriptiveParallelContributor < 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.optional.meta(omittable: true)
9
+ # Status of the contributor relative to other parallel contributors (e.g. the primary author among a group of contributors).
10
+ attribute :status, Types::Strict::String.optional.meta(omittable: true)
11
+ attribute :role, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
+ attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
+ attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
14
+ # URL or other pointer to the location of the contributor information.
15
+ attribute :valueAt, Types::Strict::String.optional.meta(omittable: true)
16
+ attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
17
+ end
18
+ end
19
+ end
@@ -5,9 +5,9 @@ module Cocina
5
5
  class DescriptiveParallelEvent < Struct
6
6
  attribute :structuredValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
7
7
  # Description of the event (creation, publication, etc.).
8
- attribute :type, Types::Strict::String.meta(omittable: true)
8
+ attribute :type, Types::Strict::String.optional.meta(omittable: true)
9
9
  # The preferred display label to use for the event in access systems.
10
- attribute :displayLabel, Types::Strict::String.meta(omittable: true)
10
+ attribute :displayLabel, Types::Strict::String.optional.meta(omittable: true)
11
11
  attribute :date, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
12
12
  attribute :contributor, Types::Strict::Array.of(Contributor).meta(omittable: true)
13
13
  attribute :location, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
@@ -7,27 +7,27 @@ module Cocina
7
7
  attribute :parallelValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
8
8
  attribute :groupedValue, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
9
9
  # String or integer value of the descriptive element.
10
- attribute :value, Types::Nominal::Any.meta(omittable: true)
10
+ attribute :value, Types::Nominal::Any.optional.meta(omittable: true)
11
11
  # Type of value provided by the descriptive element.
12
- attribute :type, Types::Strict::String.meta(omittable: true)
12
+ attribute :type, Types::Strict::String.optional.meta(omittable: true)
13
13
  # Status of the descriptive element value relative to other instances of the element.
14
- attribute :status, Types::Strict::String.meta(omittable: true)
14
+ attribute :status, Types::Strict::String.optional.meta(omittable: true)
15
15
  # Code value of the descriptive element.
16
- attribute :code, Types::Strict::String.meta(omittable: true)
16
+ attribute :code, Types::Strict::String.optional.meta(omittable: true)
17
17
  # URI value of the descriptive element.
18
- attribute :uri, Types::Strict::String.meta(omittable: true)
18
+ attribute :uri, Types::Strict::String.optional.meta(omittable: true)
19
19
  attribute :standard, Standard.optional.meta(omittable: true)
20
20
  attribute :encoding, Standard.optional.meta(omittable: true)
21
21
  attribute :identifier, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
22
22
  attribute :source, Source.optional.meta(omittable: true)
23
23
  # The preferred display label to use for the descriptive element in access systems.
24
- attribute :displayLabel, Types::Strict::String.meta(omittable: true)
24
+ attribute :displayLabel, Types::Strict::String.optional.meta(omittable: true)
25
25
  # A term providing information about the circumstances of the statement (e.g., approximate dates).
26
- attribute :qualifier, Types::Strict::String.meta(omittable: true)
26
+ attribute :qualifier, Types::Strict::String.optional.meta(omittable: true)
27
27
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
28
28
  attribute :valueLanguage, DescriptiveValueLanguage.optional.meta(omittable: true)
29
29
  # URL or other pointer to the location of the value of the descriptive element.
30
- attribute :valueAt, Types::Strict::String.meta(omittable: true)
30
+ attribute :valueAt, Types::Strict::String.optional.meta(omittable: true)
31
31
  attribute :appliesTo, Types::Strict::Array.of(DescriptiveBasicValue).meta(omittable: true)
32
32
  end
33
33
  end
@@ -4,14 +4,14 @@ module Cocina
4
4
  module Models
5
5
  class DescriptiveValueLanguage < Struct
6
6
  # Code representing the standard or encoding.
7
- attribute :code, Types::Strict::String.meta(omittable: true)
7
+ attribute :code, Types::Strict::String.optional.meta(omittable: true)
8
8
  # URI for the standard or encoding.
9
- attribute :uri, Types::Strict::String.meta(omittable: true)
9
+ attribute :uri, Types::Strict::String.optional.meta(omittable: true)
10
10
  # String describing the standard or encoding.
11
- attribute :value, Types::Strict::String.meta(omittable: true)
11
+ attribute :value, Types::Strict::String.optional.meta(omittable: true)
12
12
  attribute :note, Types::Strict::Array.of(DescriptiveValue).meta(omittable: true)
13
13
  # The version of the standard or encoding.
14
- attribute :version, Types::Strict::String.meta(omittable: true)
14
+ attribute :version, Types::Strict::String.optional.meta(omittable: true)
15
15
  attribute :source, Source.optional.meta(omittable: true)
16
16
  attribute :valueScript, Standard.optional.meta(omittable: true)
17
17
  end
@@ -3,22 +3,24 @@
3
3
  module Cocina
4
4
  module Models
5
5
  class DROAccess < Struct
6
- attribute :access, Types::Strict::String.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').meta(omittable: true)
6
+ attribute :access, Types::Strict::String.default('dark').enum('world', 'stanford', 'location-based', 'citation-only', 'dark').optional.meta(omittable: true)
7
7
  # Available for controlled digital lending.
8
- attribute :controlledDigitalLending, Types::Strict::Bool.meta(omittable: true)
8
+ attribute :controlledDigitalLending, Types::Strict::Bool.optional.meta(omittable: true)
9
9
  # The human readable copyright statement that applies
10
10
  # example: Copyright World Trade Organization
11
- attribute :copyright, Types::Strict::String.meta(omittable: true)
11
+ attribute :copyright, Types::Strict::String.optional.meta(omittable: true)
12
12
  attribute :embargo, Embargo.optional.meta(omittable: true)
13
13
  # 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.
14
14
 
15
- attribute :download, Types::Strict::String.default('none').enum('world', 'stanford', 'location-based', 'none').meta(omittable: true)
15
+ attribute :download, Types::Strict::String.default('none').enum('world', 'stanford', 'location-based', 'none').optional.meta(omittable: true)
16
16
  # 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.
17
17
 
18
- attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').meta(omittable: true)
18
+ attribute :readLocation, Types::Strict::String.enum('spec', 'music', 'ars', 'art', 'hoover', 'm&m').optional.meta(omittable: true)
19
19
  # The human readable use and reproduction statement that applies
20
20
  # 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).
21
- attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
21
+ attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
22
+ # The license governing reuse of the DRO. Should be an IRI for known licenses (i.e. CC, RightsStatement.org URI, etc.).
23
+ attribute :license, Types::Strict::String.optional.meta(omittable: true)
22
24
  end
23
25
  end
24
26
  end
@@ -7,7 +7,7 @@ module Cocina
7
7
  attribute :hasMemberOrders, Types::Strict::Array.of(Sequence).meta(omittable: true)
8
8
  attribute :isMemberOf, Types::Strict::Array.of(Druid).meta(omittable: true)
9
9
  # Agreement that covers the deposit of the DRO into SDR.
10
- attribute :hasAgreement, Types::Strict::String.meta(omittable: true)
10
+ attribute :hasAgreement, Types::Strict::String.optional.meta(omittable: true)
11
11
  end
12
12
  end
13
13
  end
@@ -10,7 +10,7 @@ module Cocina
10
10
  attribute :access, Types::Strict::String.enum('world', 'stanford', 'location-based', 'citation-only', 'dark')
11
11
  # The human readable use and reproduction statement that applies when the embargo expires.
12
12
  # example: These materials are in the public domain.
13
- attribute :useAndReproductionStatement, Types::Strict::String.meta(omittable: true)
13
+ attribute :useAndReproductionStatement, Types::Strict::String.optional.meta(omittable: true)
14
14
  end
15
15
  end
16
16
  end