ddr-core 1.6.5 → 1.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5acb00ec6165ae78dff9f6162853cd36809d83aeed478990fe5e07cf4a585709
4
- data.tar.gz: 6ea0edd150967cec1c0c1ae9af81f5145d7462c711fe325b8d71880fe474d0d5
3
+ metadata.gz: 459e3f967f5aea9cf71eb372e1f47f015580a71f189e17c6d66d70f3175362e4
4
+ data.tar.gz: '094f150903df4ccd33b7fa9e1658e536c378e5d291cef1e581951a9516982fd2'
5
5
  SHA512:
6
- metadata.gz: f6117b28065660304e0581ef2b1477724833298f0465d88025b87606f1d168e8467637a7be4e102662b166ad1c9fd992fec9ab0071793b05776d151b3046ed0d
7
- data.tar.gz: 6006793f4ad07366ff3d85ad59e6d3a63d0295f47c9a1bcd6b5b878a419db3a7701406e311b7c764e53e655752b464d33c1344976ab55de82218cb897e80fa08
6
+ metadata.gz: acac4ce5a709ff3c7c68ef331f5d7eee7d2cb6057a03e1d649d51c98102c1bb94d973e0dad8505a3bed78f30d3765ba80b25d9db1d698570fca9e5581cbeab35
7
+ data.tar.gz: 3af0823f4af7f4b7c1c5eee1a6431f226bdf3507154a61d11b91d65b4fa01a21dbd3d1f4cbf42430211aed7f407b433c83d58c64db805a7fbdd3c4e81f8aa853
data/README.md CHANGED
@@ -10,19 +10,11 @@ Change to the `.docker` directory.
10
10
 
11
11
  Start the *development* stack:
12
12
 
13
- $ ./dev.sh up -d --build
13
+ $ ./dev.sh up -d
14
14
 
15
15
  To run a Bash shell on the app server:
16
16
 
17
- $ ./dev.sh run --rm app bash
18
-
19
- To connect to the *development* database:
20
-
21
- $ ./dev.sh run --rm app psql -U postgres -h db -d ddr_core
22
-
23
- To run the *test suite*:
24
-
25
- $ ./run_test_suite.sh
17
+ $ ./dev.sh exec app bash
26
18
 
27
19
  Stop the *development* stack:
28
20
 
@@ -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
@@ -6,55 +6,9 @@ module Ddr
6
6
  attribute :content, Ddr::File.optional
7
7
  attribute :fits_file, Ddr::File.optional
8
8
 
9
- ### DDRevo ################################################
10
- # Extracted text factored out to separate concern -- Ddr::HasExtractedText
11
- ### DDRevo ################################################
12
- # has_file_datastream \
13
- # name: Ddr::Datastreams::EXTRACTED_TEXT,
14
- # type: Ddr::Datastreams::PlainTextDatastream,
15
- # versionable: true,
16
- # label: "Text extracted from the content file",
17
- # control_group: "M"
18
- #
19
-
20
9
  delegate :original_filename, to: :content, allow_nil: true
21
-
22
- #######DDRevo#########
23
- # expect that the FileManagement module will go to staff app
24
- #######DDRevo#########
25
- # include FileManagement
26
- #
27
- #######DDRevo#########
28
- # to staff app
29
- #######DDRevo#########
30
- # delegate :validate_checksum!, to: :content
31
10
  end
32
11
 
33
- #######DDRevo#########
34
- # to staff app
35
- #######DDRevo#########
36
- # # Convenience method wrapping FileManagement#add_file
37
- # def upload file, opts={}
38
- # add_file(file, Ddr::Datastreams::CONTENT, opts)
39
- # end
40
- #
41
- #######DDRevo#########
42
- # to staff app
43
- #######DDRevo#########
44
- # # Set content to file and save
45
- # def upload! file, opts={}
46
- # upload(file, opts)
47
- # save
48
- # end
49
- #
50
- #######DDRevo#########
51
- # DerivativesManager will go to staff app. Need to determine if there is a need for a '#derivatives' method on
52
- # content-bearing objects and, if so, what it should return
53
- #######DDRevo#########
54
- # def derivatives
55
- # @derivatives ||= Ddr::Managers::DerivativesManager.new(self)
56
- # end
57
- #
58
12
  def techmd
59
13
  @techmd ||= Ddr::Managers::TechnicalMetadataManager.new(self)
60
14
  end
@@ -80,10 +34,6 @@ module Ddr
80
34
  content_type&.split("/")&.last
81
35
  end
82
36
 
83
- # def content_type= mime_type
84
- # self.content.mimeType = mime_type
85
- # end
86
- #
87
37
  def image?
88
38
  content_major_type == "image"
89
39
  end
@@ -92,42 +42,5 @@ module Ddr
92
42
  content_type == "application/pdf"
93
43
  end
94
44
 
95
- # def virus_checks
96
- # Ddr::Events::VirusCheckEvent.for_object(self)
97
- # end
98
- #
99
- # def last_virus_check
100
- # virus_checks.last
101
- # end
102
- #
103
- # def last_virus_check_on
104
- # last_virus_check && last_virus_check.event_date_time
105
- # end
106
- #
107
- # def last_virus_check_outcome
108
- # last_virus_check && last_virus_check.outcome
109
- # end
110
- #
111
- # def content_changed?
112
- # content.external? ? content.dsLocation_changed? : content.content_changed?
113
- # end
114
- #
115
- ### DDRevo ###########################################
116
- # Moved to Ddr::Resource where other 'has_<file>?' methods reside
117
- ### DDRevo ###########################################
118
- # def has_extracted_text?
119
- # extractedText.has_content?
120
- # end
121
- #
122
- # def with_content_file(&block)
123
- # WithContentFile.new(self, &block)
124
- # end
125
- #
126
- # protected
127
- #
128
- # def default_content_type
129
- # "application/octet-stream"
130
- # end
131
-
132
45
  end
133
46
  end
@@ -4,5 +4,9 @@ module Ddr
4
4
  attribute :type, Ddr::Files::CHECKSUM_TYPES
5
5
  attribute :value, Valkyrie::Types::Strict::String
6
6
 
7
+ def sha1?
8
+ type == Ddr::Files::CHECKSUM_TYPE_SHA1
9
+ end
10
+
7
11
  end
8
12
  end
@@ -28,6 +28,10 @@ module Ddr
28
28
  file.size
29
29
  end
30
30
 
31
+ def sha1
32
+ digest.detect(&:sha1?)&.value
33
+ end
34
+
31
35
  # Return default file extension for file based on MIME type
32
36
  def default_file_extension
33
37
  mimetypes = MIME::Types[media_type]
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
@@ -28,6 +28,7 @@ module Ddr::Index
28
28
  COMPANY_FACET = Field.new :company_facet, :facetable
29
29
  COMPOSER_FACET = Field.new :composer_facet, :facetable
30
30
  CONTENT_CREATE_DATE = Field.new :content_create_date, :stored_sortable, type: :date
31
+ CONTENT_SHA1 = Field.new :content_sha1, :stored_sortable
31
32
  CONTENT_SIZE = Field.new :content_size, solr_name: "content_size_lsi"
32
33
  CONTENT_SIZE_HUMAN = Field.new :content_size_human, :symbol
33
34
  CONTENTDM_ID = Field.new :contentdm_id, :stored_sortable
@@ -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.6.5
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-06-28 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
@@ -47,14 +47,14 @@ dependencies:
47
47
  requirements:
48
48
  - - "~>"
49
49
  - !ruby/object:Gem::Version
50
- version: '1.8'
50
+ version: '2.3'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: '1.8'
57
+ version: '2.3'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: devise
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -269,16 +269,16 @@ dependencies:
269
269
  name: rspec-rails
270
270
  requirement: !ruby/object:Gem::Requirement
271
271
  requirements:
272
- - - ">="
272
+ - - "~>"
273
273
  - !ruby/object:Gem::Version
274
- version: '0'
274
+ version: '4.1'
275
275
  type: :development
276
276
  prerelease: false
277
277
  version_requirements: !ruby/object:Gem::Requirement
278
278
  requirements:
279
- - - ">="
279
+ - - "~>"
280
280
  - !ruby/object:Gem::Version
281
- version: '0'
281
+ version: '4.1'
282
282
  - !ruby/object:Gem::Dependency
283
283
  name: solr_wrapper
284
284
  requirement: !ruby/object:Gem::Requirement
@@ -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.21
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