ddr-core 1.8.0 → 1.9.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: 8ecf0c2c7b9b7cbe1c4a6f97c52b9890e6baf5bb5de8696cd79c0fc9a9b1ed5c
4
- data.tar.gz: c5962101e2e49c746565a9de779f9e23d0aa00a410129bb766ea2d9fd19b96b6
3
+ metadata.gz: 459e3f967f5aea9cf71eb372e1f47f015580a71f189e17c6d66d70f3175362e4
4
+ data.tar.gz: '094f150903df4ccd33b7fa9e1658e536c378e5d291cef1e581951a9516982fd2'
5
5
  SHA512:
6
- metadata.gz: f11f35d59878e82b1c5d81571ecfcb914d48541280745df1df7a2c0f7434afb02897a54a26c777a683dc3a27b6734fe863b2016c2bc761e587b3b65cc259eee9
7
- data.tar.gz: 8406cd5b5f19da79f2b618f33d56c0a9fb4e779485df5a3856ce533f291d44d4b93c547f6d70fb27eac0d29c5524cc922b7c0fc2f3b5c9779be2e1f7b6b7cccf
6
+ metadata.gz: acac4ce5a709ff3c7c68ef331f5d7eee7d2cb6057a03e1d649d51c98102c1bb94d973e0dad8505a3bed78f30d3765ba80b25d9db1d698570fca9e5581cbeab35
7
+ data.tar.gz: 3af0823f4af7f4b7c1c5eee1a6431f226bdf3507154a61d11b91d65b4fa01a21dbd3d1f4cbf42430211aed7f407b433c83d58c64db805a7fbdd3c4e81f8aa853
@@ -2,22 +2,17 @@ module Ddr
2
2
  module Describable
3
3
  extend ActiveSupport::Concern
4
4
 
5
+ TERM_NAMES = (Ddr.vocab[:dcmi_terms] + Ddr.vocab[:duke_terms] - [:license]).freeze
6
+
5
7
  def self.term_names
6
- term_names = []
7
- vocabularies.each do |vocab|
8
- Ddr::Vocab::Vocabulary.property_terms(vocab).each do |term|
9
- term_name = Ddr::Vocab::Vocabulary.term_name(vocab, term)
10
- unless term_name == :license
11
- term_names << term_name
12
- end
13
- end
14
- end
15
- term_names
8
+ TERM_NAMES
16
9
  end
17
10
 
18
- # Dublin Core vocabulary comes from the rdf-vocab gem (https://github.com/ruby-rdf/rdf-vocab)
19
- # DDR vocabulary is defined locally
11
+ # @deprecated
20
12
  def self.vocabularies
13
+ warn "[DEPRECATION] `Ddr::Describable.vocabularies` is deprecated."
14
+
15
+ require 'ddr/vocab'
21
16
  [RDF::Vocab::DC, Ddr::Vocab::DukeTerms].freeze
22
17
  end
23
18
 
@@ -44,16 +39,11 @@ module Ddr
44
39
  end
45
40
  end
46
41
 
47
- # Used in dul-hydra view
42
+ # Used in ddr-admin view
48
43
  def has_desc_metadata?
49
44
  desc_metadata_terms(:present).present?
50
45
  end
51
46
 
52
- # Used in dul-hydra
53
- ######################
54
- # Commenting out the :required argument since validation is not a model concern in the Valkyrie paradigm.
55
- # This will break the `desc_metadata_form_fields` helper in dul-hydra and we'll have to fix it there eventually.
56
- ######################
57
47
  def desc_metadata_terms *args
58
48
  return Ddr::Describable.term_names if args.empty?
59
49
  arg = args.pop
@@ -64,15 +54,14 @@ module Ddr
64
54
  desc_metadata_terms.select { |t| values(t).present? }
65
55
  when :defined_attributes
66
56
  desc_metadata_terms
67
- # when :required
68
- # desc_metadata_terms(:defined_attributes).select {|t| required? t}
69
57
  when :dcterms
70
- Ddr::Vocab::Vocabulary.term_names(RDF::Vocab::DC11) +
71
- (Ddr::Vocab::Vocabulary.term_names(RDF::Vocab::DC) - Ddr::Vocab::Vocabulary.term_names(RDF::Vocab::DC11))
58
+ # Why? I think we did this to put the DCMI Elements terms in front ...
59
+ # Do we still need that? Also, we didn't remove :license here, which is probably wrong.
60
+ Ddr.vocab[:dcmi_elements] + (Ddr.vocab[:dcmi_terms] - Ddr.vocab[:dcmi_elements])
72
61
  when :dcterms_elements11
73
- Ddr::Vocab::Vocabulary.term_names(RDF::Vocab::DC11)
62
+ Ddr.vocab[:dcmi_elements]
74
63
  when :duke
75
- Ddr::Vocab::Vocabulary.term_names(Ddr::Vocab::DukeTerms)
64
+ Ddr.vocab[:duke_terms]
76
65
  else
77
66
  raise ArgumentError, "Invalid argument: #{arg.inspect}"
78
67
  end
@@ -83,8 +72,10 @@ module Ddr
83
72
  end
84
73
  end
85
74
 
86
- # Used in dul-hydra helper -- replace there with Ddr::Describable.vocabularies?
75
+ # @deprecated
87
76
  def desc_metadata_vocabs
77
+ warn "[DEPRECATION] `Ddr::Describable#desc_metadata_vocabs` is deprecated."
78
+
88
79
  Ddr::Describable.vocabularies
89
80
  end
90
81
 
@@ -100,5 +91,7 @@ module Ddr
100
91
  desc_metadata_terms.each { |t| set_desc_metadata_values(t, term_values_hash[t]) }
101
92
  end
102
93
 
94
+
95
+
103
96
  end
104
97
  end
data/config/vocab.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "dcmi_terms": ["abstract", "accessRights", "accrualMethod", "accrualPeriodicity", "accrualPolicy", "alternative", "audience", "available", "bibliographicCitation", "conformsTo", "contributor", "coverage", "created", "creator", "date", "dateAccepted", "dateCopyrighted", "dateSubmitted", "description", "educationLevel", "extent", "format", "hasFormat", "hasPart", "hasVersion", "identifier", "instructionalMethod", "isFormatOf", "isPartOf", "isReferencedBy", "isReplacedBy", "isRequiredBy", "isVersionOf", "issued", "language", "license", "mediator", "medium", "modified", "provenance", "publisher", "references", "relation", "replaces", "requires", "rights", "rightsHolder", "source", "spatial", "subject", "tableOfContents", "temporal", "title", "type", "valid"],
3
+ "duke_terms": ["arranger", "artist", "awards", "biblical_book", "box_number", "call_number", "category", "chapter_and_verse", "chimpanzee", "choreographer", "company", "composer", "dcmitype", "dedicatee", "digitized", "duke_opponent", "engraver", "first_line", "folder", "genre", "headline", "illustrated", "illustrator", "instrumentation", "interview_date", "interview_location", "interview_number", "interview_state", "interviewee_birthplace", "interviewee_date_of_birth", "interviewee_gender", "interviewee_occupation", "interviewee_residence", "interviewee_state_of_birth", "interviewer_name", "issue_date", "issue_number", "lithographer", "lyricist", "negative_number", "oclc_number", "people", "performer", "placement_company", "print_number", "producer", "product", "pubcity", "pubcountry", "publication", "pubregion", "pubstate", "race", "record_type", "refrain", "roll_number", "season", "series", "setting", "site_alignment", "source_collection", "sponsor", "staging", "subseries", "tag", "time_of_photo", "tone", "venue", "volume"],
4
+ "dcmi_elements": ["contributor", "coverage", "creator", "date", "description", "format", "identifier", "language", "publisher", "relation", "rights", "source", "subject", "title", "type"]
5
+ }
data/lib/ddr/core.rb CHANGED
@@ -58,6 +58,12 @@ module Ddr
58
58
  @storage_adapter = storage_adapter
59
59
  end
60
60
 
61
+ # This static vocab list is to replace the ones generated from RDF.
62
+ def self.vocab
63
+ @vocab ||= JSON.load_file(File.expand_path('../../config/vocab.json', __dir__), symbolize_names: true)
64
+ .transform_values { |v| v.map(&:to_sym).freeze }.freeze
65
+ end
66
+
61
67
  mattr_accessor :default_mime_type do
62
68
  "application/octet-stream"
63
69
  end
@@ -121,7 +127,6 @@ module Ddr
121
127
  end
122
128
 
123
129
  module Core
124
-
125
130
  end
126
131
 
127
132
  end
@@ -1,5 +1,7 @@
1
1
  module Ddr::Vocab
2
2
 
3
+ warn "[DEPRECATION] `#{self.name}::DukeTerms` is deprecated."
4
+
3
5
  class DukeTerms < RDF::StrictVocabulary("http://library.duke.edu/metadata/terms/")
4
6
 
5
7
  RDFVocabularyParser.new(
@@ -3,6 +3,8 @@ require 'rdf/rdfxml'
3
3
  module Ddr::Vocab
4
4
  class RDFVocabularyParser
5
5
 
6
+ warn "[DEPRECATION] `#{self.name}` is deprecated."
7
+
6
8
  attr_reader :source, :prefix
7
9
 
8
10
  def initialize(source, prefix = "")
@@ -3,6 +3,8 @@ require 'rdf/vocab'
3
3
  module Ddr::Vocab
4
4
  class Vocabulary
5
5
 
6
+ warn "[DEPRECATION] `#{self.name}` is deprecated."
7
+
6
8
  def self.label(rdf_vocabulary)
7
9
  case rdf_vocabulary.to_uri
8
10
  when RDF::Vocab::DC.to_uri
data/lib/ddr/vocab.rb CHANGED
@@ -1,22 +1,13 @@
1
1
  require "rdf/vocab"
2
2
 
3
+ warn "[DEPRECATION] 'Ddr::Vocab' is deprecated."
4
+
3
5
  module Ddr::Vocab
4
6
  extend ActiveSupport::Autoload
5
7
 
6
8
  BASE_URI = "http://repository.lib.duke.edu/vocab"
7
9
 
8
- PREMIS = begin
9
- RDF::Vocab::PREMIS::V1
10
- rescue NameError
11
- RDF::Vocab::PREMIS
12
- end
13
-
14
- autoload :Asset
15
- autoload :Contact
16
- autoload :Display
17
10
  autoload :DukeTerms
18
11
  autoload :RDFVocabularyParser
19
- autoload :Roles
20
12
  autoload :Vocabulary
21
-
22
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-12-07 00:00:00.000000000 Z
14
+ date: 2022-02-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activeresource
@@ -341,6 +341,7 @@ files:
341
341
  - config/initializers/devise.rb
342
342
  - config/locales/ddr-core.en.yml
343
343
  - config/routes.rb
344
+ - config/vocab.json
344
345
  - db/migrate/20141104181418_create_users.rb
345
346
  - db/migrate/20141107124012_add_columns_to_user.rb
346
347
  - db/migrate/20200207194453_add_default_to_lock_version.rb
@@ -425,12 +426,8 @@ files:
425
426
  - lib/ddr/structures/struct_map.rb
426
427
  - lib/ddr/utils.rb
427
428
  - lib/ddr/vocab.rb
428
- - lib/ddr/vocab/asset.rb
429
- - lib/ddr/vocab/contact.rb
430
- - lib/ddr/vocab/display.rb
431
429
  - lib/ddr/vocab/duke_terms.rb
432
430
  - lib/ddr/vocab/rdf_vocabulary_parser.rb
433
- - lib/ddr/vocab/roles.rb
434
431
  - lib/ddr/vocab/sources/duketerms.rdf
435
432
  - lib/ddr/vocab/vocabulary.rb
436
433
  - lib/ddr/workflow.rb
@@ -455,7 +452,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
455
452
  - !ruby/object:Gem::Version
456
453
  version: '0'
457
454
  requirements: []
458
- rubygems_version: 3.2.32
455
+ rubygems_version: 3.3.7
459
456
  signing_key:
460
457
  specification_version: 4
461
458
  summary: Models used in the Duke Digital Repository
@@ -1,55 +0,0 @@
1
- module Ddr::Vocab
2
- class Asset < RDF::StrictVocabulary("http://repository.lib.duke.edu/vocab/asset/")
3
-
4
- property "permanentId",
5
- label: "Permanent Identifier"
6
-
7
- property "permanentUrl",
8
- label: "Permanent URL"
9
-
10
- property "workflowState",
11
- label: "Workflow State"
12
-
13
- property "adminSet",
14
- label: "Administrative Set",
15
- comment: "A name under which objects (principally collections) are grouped for administrative purposes."
16
-
17
- property "eadId",
18
- label: "EAD ID"
19
-
20
- property "archivesSpaceId",
21
- label: "ArchivesSpace Identifier"
22
-
23
- property "isLocked",
24
- label: "Is Locked?"
25
-
26
- property "ingestedBy",
27
- label: "Ingested By",
28
- comment: "The agent (person or software) that initiated or performed the ingestion of the object."
29
-
30
- property "ingestionDate",
31
- label: "Ingestion Date",
32
- comment: "The date/time at which the object was originally ingested into the repository."
33
-
34
- property "rightsNote",
35
- label: "Rights Note",
36
- comment: "Free-text statement about the rights status of the resource."
37
-
38
- property "alephId",
39
- label: "Aleph ID",
40
- comment: "The Aleph identifier for a catalog record corresponding to the object."
41
-
42
- property "affiliation",
43
- label: "Affiliation",
44
- comment: "An organizational entity associated with the object content."
45
-
46
- property "nestedPath",
47
- label: "Nested Path",
48
- comment: "The nested/tree path to the object to be reflected in structural metadata."
49
-
50
- property "contentdmId",
51
- label: "CONTENTdm ID"
52
- comment: "The CONTENTdm reference corresponding to the object."
53
-
54
- end
55
- end
@@ -1,9 +0,0 @@
1
- module Ddr::Vocab
2
- class Contact < RDF::StrictVocabulary("#{BASE_URI}/contact/")
3
-
4
- property "assistance",
5
- label: "Research Assistance",
6
- comment: "Contact for research assistance with this object."
7
-
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module Ddr::Vocab
2
- class Display < RDF::StrictVocabulary("#{BASE_URI}/display/")
3
-
4
- property "format",
5
- label: "Display Format",
6
- comment: "Format to use when displaying the object."
7
-
8
- end
9
- end
@@ -1,25 +0,0 @@
1
- module Ddr::Vocab
2
- class Roles < RDF::StrictVocabulary("#{BASE_URI}/roles/")
3
-
4
- term :Role,
5
- label: "Role",
6
- comment: "An assertion of a role granted to an agent."
7
-
8
- property :hasRole,
9
- label: "Has Role",
10
- comment: "Asserts the granting of a role on the subject to an agent."
11
-
12
- property :type,
13
- label: "Type",
14
- comment: "The type of role granted to the agent."
15
-
16
- property :agent,
17
- label: "Agent",
18
- comment: "The agent to whom the role is granted."
19
-
20
- property :scope,
21
- label: "Scope",
22
- comment: "The scope within which the role applies."
23
-
24
- end
25
- end