ddr-models 1.2.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.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +12 -0
  3. data/README.md +5 -0
  4. data/Rakefile +37 -0
  5. data/app/models/attachment.rb +7 -0
  6. data/app/models/collection.rb +54 -0
  7. data/app/models/component.rb +15 -0
  8. data/app/models/item.rb +19 -0
  9. data/app/models/solr_document.rb +36 -0
  10. data/app/models/target.rb +8 -0
  11. data/config/initializers/active_fedora_base.rb +77 -0
  12. data/config/initializers/active_fedora_datastream.rb +5 -0
  13. data/config/initializers/ddr.rb +8 -0
  14. data/config/initializers/devise.rb +245 -0
  15. data/config/initializers/devise.rb~ +245 -0
  16. data/config/initializers/subscriptions.rb +15 -0
  17. data/config/routes.rb +2 -0
  18. data/db/migrate/20141021233359_create_events.rb +28 -0
  19. data/db/migrate/20141021234156_create_minted_ids.rb +19 -0
  20. data/db/migrate/20141103192146_create_workflow_state.rb +13 -0
  21. data/db/migrate/20141104181418_create_users.rb +34 -0
  22. data/db/migrate/20141104181418_create_users.rb~ +6 -0
  23. data/lib/ddr-models.rb +1 -0
  24. data/lib/ddr/actions.rb +8 -0
  25. data/lib/ddr/actions/fixity_check.rb +35 -0
  26. data/lib/ddr/auth.rb +45 -0
  27. data/lib/ddr/auth.rb~ +47 -0
  28. data/lib/ddr/auth/ability.rb +204 -0
  29. data/lib/ddr/auth/ability.rb~ +204 -0
  30. data/lib/ddr/auth/group_service.rb +53 -0
  31. data/lib/ddr/auth/group_service.rb~ +53 -0
  32. data/lib/ddr/auth/grouper_service.rb +76 -0
  33. data/lib/ddr/auth/grouper_service.rb~ +77 -0
  34. data/lib/ddr/auth/remote_group_service.rb +35 -0
  35. data/lib/ddr/auth/remote_group_service.rb~ +35 -0
  36. data/lib/ddr/auth/superuser.rb +13 -0
  37. data/lib/ddr/auth/superuser.rb~ +9 -0
  38. data/lib/ddr/auth/user.rb +71 -0
  39. data/lib/ddr/auth/user.rb~ +65 -0
  40. data/lib/ddr/configurable.rb +34 -0
  41. data/lib/ddr/datastreams.rb +32 -0
  42. data/lib/ddr/datastreams/content_metadata_datastream.rb +147 -0
  43. data/lib/ddr/datastreams/datastream_behavior.rb +95 -0
  44. data/lib/ddr/datastreams/descriptive_metadata_datastream.rb +84 -0
  45. data/lib/ddr/datastreams/properties_datastream.rb +25 -0
  46. data/lib/ddr/datastreams/role_assignments_datastream.rb +19 -0
  47. data/lib/ddr/events.rb +17 -0
  48. data/lib/ddr/events/creation_event.rb +12 -0
  49. data/lib/ddr/events/event.rb +163 -0
  50. data/lib/ddr/events/fixity_check_event.rb +43 -0
  51. data/lib/ddr/events/ingestion_event.rb +12 -0
  52. data/lib/ddr/events/preservation_event_behavior.rb +37 -0
  53. data/lib/ddr/events/preservation_event_type.rb +24 -0
  54. data/lib/ddr/events/reindex_object_after_save.rb +18 -0
  55. data/lib/ddr/events/update_event.rb +9 -0
  56. data/lib/ddr/events/validation_event.rb +11 -0
  57. data/lib/ddr/events/virus_check_event.rb +30 -0
  58. data/lib/ddr/index_fields.rb +39 -0
  59. data/lib/ddr/metadata.rb +22 -0
  60. data/lib/ddr/metadata/duke_terms.rb +15 -0
  61. data/lib/ddr/metadata/premis_event.rb +59 -0
  62. data/lib/ddr/metadata/rdf_vocabulary_parser.rb +45 -0
  63. data/lib/ddr/metadata/roles_vocabulary.rb +10 -0
  64. data/lib/ddr/metadata/sources/duketerms.rdf.xml +856 -0
  65. data/lib/ddr/metadata/vocabulary.rb +37 -0
  66. data/lib/ddr/models.rb +60 -0
  67. data/lib/ddr/models/access_controllable.rb +23 -0
  68. data/lib/ddr/models/base.rb +37 -0
  69. data/lib/ddr/models/describable.rb +81 -0
  70. data/lib/ddr/models/engine.rb +58 -0
  71. data/lib/ddr/models/error.rb +12 -0
  72. data/lib/ddr/models/event_loggable.rb +36 -0
  73. data/lib/ddr/models/file_management.rb +183 -0
  74. data/lib/ddr/models/fixity_checkable.rb +20 -0
  75. data/lib/ddr/models/governable.rb +48 -0
  76. data/lib/ddr/models/has_attachments.rb +12 -0
  77. data/lib/ddr/models/has_children.rb +21 -0
  78. data/lib/ddr/models/has_content.rb +114 -0
  79. data/lib/ddr/models/has_content_metadata.rb +16 -0
  80. data/lib/ddr/models/has_properties.rb +15 -0
  81. data/lib/ddr/models/has_role_assignments.rb +17 -0
  82. data/lib/ddr/models/has_thumbnail.rb +27 -0
  83. data/lib/ddr/models/has_workflow.rb +29 -0
  84. data/lib/ddr/models/indexing.rb +53 -0
  85. data/lib/ddr/models/licensable.rb +28 -0
  86. data/lib/ddr/models/minted_id.rb +10 -0
  87. data/lib/ddr/models/permanent_identification.rb +48 -0
  88. data/lib/ddr/models/solr_document.rb +193 -0
  89. data/lib/ddr/models/version.rb +5 -0
  90. data/lib/ddr/notifications.rb +15 -0
  91. data/lib/ddr/services.rb +8 -0
  92. data/lib/ddr/services/id_service.rb +48 -0
  93. data/lib/ddr/utils.rb +153 -0
  94. data/lib/ddr/workflow.rb +8 -0
  95. data/lib/ddr/workflow/workflow_state.rb +39 -0
  96. data/spec/dummy/README.rdoc +28 -0
  97. data/spec/dummy/Rakefile +6 -0
  98. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  99. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  100. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  101. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  102. data/spec/dummy/app/models/user.rb +5 -0
  103. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  104. data/spec/dummy/bin/bundle +3 -0
  105. data/spec/dummy/bin/rails +4 -0
  106. data/spec/dummy/bin/rake +4 -0
  107. data/spec/dummy/config.ru +4 -0
  108. data/spec/dummy/config/application.rb +29 -0
  109. data/spec/dummy/config/boot.rb +5 -0
  110. data/spec/dummy/config/database.yml +25 -0
  111. data/spec/dummy/config/environment.rb +5 -0
  112. data/spec/dummy/config/environments/development.rb +37 -0
  113. data/spec/dummy/config/environments/production.rb +78 -0
  114. data/spec/dummy/config/environments/test.rb +39 -0
  115. data/spec/dummy/config/initializers/assets.rb +8 -0
  116. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  117. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  118. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  119. data/spec/dummy/config/initializers/inflections.rb +16 -0
  120. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  121. data/spec/dummy/config/initializers/session_store.rb +3 -0
  122. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  123. data/spec/dummy/config/locales/en.yml +23 -0
  124. data/spec/dummy/config/routes.rb +56 -0
  125. data/spec/dummy/config/secrets.yml +22 -0
  126. data/spec/dummy/db/development.sqlite3 +0 -0
  127. data/spec/dummy/db/schema.rb +80 -0
  128. data/spec/dummy/db/test.sqlite3 +0 -0
  129. data/spec/dummy/log/development.log +4974 -0
  130. data/spec/dummy/log/test.log +55627 -0
  131. data/spec/dummy/public/404.html +67 -0
  132. data/spec/dummy/public/422.html +67 -0
  133. data/spec/dummy/public/500.html +66 -0
  134. data/spec/dummy/public/favicon.ico +0 -0
  135. data/spec/factories/attachment_factories.rb +15 -0
  136. data/spec/factories/collection_factories.rb +16 -0
  137. data/spec/factories/component_factories.rb +15 -0
  138. data/spec/factories/event_factories.rb +7 -0
  139. data/spec/factories/item_factories.rb +16 -0
  140. data/spec/factories/target_factories.rb +11 -0
  141. data/spec/factories/test_model_factories.rb +133 -0
  142. data/spec/factories/user_factories.rb +7 -0
  143. data/spec/factories/user_factories.rb~ +7 -0
  144. data/spec/features/grouper_integration_spec.rb~ +21 -0
  145. data/spec/fixtures/contentMetadata.xml +37 -0
  146. data/spec/fixtures/image1.tiff +0 -0
  147. data/spec/fixtures/image2.tiff +0 -0
  148. data/spec/fixtures/image3.tiff +0 -0
  149. data/spec/fixtures/library-devil.tiff +0 -0
  150. data/spec/fixtures/sample.docx +0 -0
  151. data/spec/fixtures/sample.pdf +0 -0
  152. data/spec/fixtures/target.png +0 -0
  153. data/spec/models/ability_spec.rb +248 -0
  154. data/spec/models/ability_spec.rb~ +245 -0
  155. data/spec/models/active_fedora_base_spec.rb +107 -0
  156. data/spec/models/active_fedora_datastream_spec.rb +121 -0
  157. data/spec/models/attachment_spec.rb +13 -0
  158. data/spec/models/collection_spec.rb +33 -0
  159. data/spec/models/component_spec.rb +8 -0
  160. data/spec/models/descriptive_metadata_datastream_spec.rb +102 -0
  161. data/spec/models/events_spec.rb +64 -0
  162. data/spec/models/file_management_spec.rb +179 -0
  163. data/spec/models/has_role_assignments_spec.rb +29 -0
  164. data/spec/models/has_workflow_spec.rb +54 -0
  165. data/spec/models/item_spec.rb +8 -0
  166. data/spec/models/permanent_identification_spec.rb +65 -0
  167. data/spec/models/role_assignments_datastream_spec.rb +25 -0
  168. data/spec/models/superuser_spec.rb +13 -0
  169. data/spec/models/superuser_spec.rb~ +13 -0
  170. data/spec/models/target_spec.rb +8 -0
  171. data/spec/models/user_spec.rb +60 -0
  172. data/spec/models/user_spec.rb~ +56 -0
  173. data/spec/services/group_service_spec.rb +75 -0
  174. data/spec/services/group_service_spec.rb~ +71 -0
  175. data/spec/services/id_service_spec.rb +33 -0
  176. data/spec/spec_helper.rb +125 -0
  177. data/spec/support/shared_examples_for_access_controllables.rb +6 -0
  178. data/spec/support/shared_examples_for_associations.rb +8 -0
  179. data/spec/support/shared_examples_for_ddr_models.rb +7 -0
  180. data/spec/support/shared_examples_for_describables.rb +63 -0
  181. data/spec/support/shared_examples_for_event_loggables.rb +3 -0
  182. data/spec/support/shared_examples_for_events.rb +179 -0
  183. data/spec/support/shared_examples_for_governables.rb +17 -0
  184. data/spec/support/shared_examples_for_has_content.rb +136 -0
  185. data/spec/support/shared_examples_for_has_content_metadata.rb +74 -0
  186. data/spec/support/shared_examples_for_has_properties.rb +5 -0
  187. data/spec/support/shared_examples_for_indexing.rb +36 -0
  188. metadata +562 -0
@@ -0,0 +1,12 @@
1
+ module Ddr
2
+ module Events
3
+ class CreationEvent < Event
4
+
5
+ include PreservationEventBehavior
6
+
7
+ self.preservation_event_type = :cre
8
+ self.description = "Object created in the repository"
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,163 @@
1
+ module Ddr
2
+ module Events
3
+ class Event < ActiveRecord::Base
4
+
5
+ belongs_to :user, inverse_of: :events
6
+
7
+ # Event date time - for PREMIS and Solr
8
+ DATE_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%LZ"
9
+
10
+ # set default ordering
11
+ DEFAULT_SORT_ORDER = "event_date_time ASC"
12
+ default_scope { order(DEFAULT_SORT_ORDER) }
13
+
14
+ # Outcomes
15
+ SUCCESS = "success"
16
+ FAILURE = "failure"
17
+ OUTCOMES = [SUCCESS, FAILURE]
18
+
19
+ # Validation constants
20
+ VALID = "VALID"
21
+ INVALID = "INVALID"
22
+
23
+ # For rendering "performed by" when no associated user
24
+ SYSTEM = "SYSTEM"
25
+
26
+ DDR_SOFTWARE = "DDR #{Ddr::Models::VERSION}"
27
+
28
+ class_attribute :description
29
+
30
+ validates_presence_of :event_date_time, :pid
31
+ validates :outcome, inclusion: {in: OUTCOMES, message: "\"%{value}\" is not a valid event outcome"}
32
+ validate :object_exists # unless/until we have a deaccession-type of event
33
+
34
+ after_initialize :set_defaults
35
+
36
+ # Receive message sent by ActiveSupport::Notifications
37
+ def self.call(*args)
38
+ notification = ActiveSupport::Notifications::Event.new(*args)
39
+ create(notification.payload)
40
+ end
41
+
42
+ # Repository software version -- e.g., "Fedora Repository 3.7.0"
43
+ def self.repository_software
44
+ @@repository_software ||= ActiveFedora::Base.connection_for_pid(0).repository_profile
45
+ .values_at(:repositoryName, :repositoryVersion)
46
+ .join(" ")
47
+ end
48
+
49
+ # Scopes
50
+
51
+ def self.for_object(obj)
52
+ for_pid(obj.pid)
53
+ end
54
+
55
+ def self.for_pid(pid)
56
+ where(pid: pid)
57
+ end
58
+
59
+ # Rendering methods
60
+
61
+ def display_type
62
+ # Ddr::Events::UpdateEvent => "Update"
63
+ @display_type ||= self.class.to_s.split("::").last.sub("Event", "").titleize
64
+ end
65
+
66
+ def performed_by
67
+ user ? user.to_s : SYSTEM
68
+ end
69
+
70
+ def comment_or_summary
71
+ comment.present? ? comment : summary
72
+ end
73
+
74
+ # Outcome methods
75
+
76
+ def success!
77
+ self.outcome = SUCCESS
78
+ end
79
+
80
+ def success?
81
+ outcome == SUCCESS
82
+ end
83
+
84
+ def failure!
85
+ self.outcome = FAILURE
86
+ end
87
+
88
+ def failure?
89
+ outcome == FAILURE
90
+ end
91
+
92
+ # Object getter and setter
93
+
94
+ def object
95
+ @object ||= ActiveFedora::Base.find(pid) if pid
96
+ end
97
+
98
+ def object=(obj)
99
+ raise ArgumentError, "Can't set to new object" if obj.new_record?
100
+ self.pid = obj.pid
101
+ @object = obj
102
+ end
103
+
104
+ # Override pid setter to clear cached object instance variable
105
+ def pid=(pid)
106
+ @object = nil
107
+ super
108
+ end
109
+
110
+ # Return a date/time formatted as a string suitable for use as a PREMIS eventDateTime.
111
+ # Format also works for Solr.
112
+ # Force to UTC.
113
+ def event_date_time_s
114
+ event_date_time.utc.strftime DATE_TIME_FORMAT
115
+ end
116
+
117
+ # Return boolean indicator of object existence
118
+ def object_exists?
119
+ !object.nil?
120
+ rescue ActiveFedora::ObjectNotFoundError => e
121
+ false
122
+ end
123
+
124
+ protected
125
+
126
+ def set_defaults
127
+ self.attributes = defaults.reject { |attr, val| attribute_present? attr }
128
+ end
129
+
130
+ def defaults
131
+ { event_date_time: default_event_date_time,
132
+ summary: default_summary,
133
+ software: default_software,
134
+ outcome: default_outcome
135
+ }
136
+ end
137
+
138
+ # Validation method
139
+ def object_exists
140
+ unless object_exists?
141
+ errors.add(:pid, "Object \"#{pid}\" does not exist in the repository")
142
+ end
143
+ end
144
+
145
+ def default_software
146
+ DDR_SOFTWARE
147
+ end
148
+
149
+ def default_outcome
150
+ SUCCESS
151
+ end
152
+
153
+ def default_summary
154
+ self.class.description
155
+ end
156
+
157
+ def default_event_date_time
158
+ Time.now.utc
159
+ end
160
+
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,43 @@
1
+ module Ddr
2
+ module Events
3
+ class FixityCheckEvent < Event
4
+
5
+ include PreservationEventBehavior
6
+ include ReindexObjectAfterSave
7
+
8
+ self.preservation_event_type = :fix
9
+ self.description = "Validation of datastream checksums"
10
+
11
+ DETAIL_PREAMBLE = "Datastream checksum validation results:"
12
+ DETAIL_TEMPLATE = "%{dsid} ... %{validation}"
13
+
14
+ # Message sent by ActiveSupport::Notifications
15
+ def self.call(*args)
16
+ notification = ActiveSupport::Notifications::Event.new(*args)
17
+ result = notification.payload[:result] # FixityCheck::Result instance
18
+ detail = [DETAIL_PREAMBLE]
19
+ result.results.each do |dsid, dsProfile|
20
+ validation = dsProfile["dsChecksumValid"] ? VALID : INVALID
21
+ detail << DETAIL_TEMPLATE % {dsid: dsid, validation: validation}
22
+ end
23
+ create(pid: result.pid,
24
+ event_date_time: notification.time,
25
+ outcome: result.success ? SUCCESS : FAILURE,
26
+ detail: detail.join("\n")
27
+ )
28
+ end
29
+
30
+ def to_solr
31
+ { Ddr::IndexFields::LAST_FIXITY_CHECK_ON => event_date_time_s,
32
+ Ddr::IndexFields::LAST_FIXITY_CHECK_OUTCOME => outcome }
33
+ end
34
+
35
+ protected
36
+
37
+ def default_software
38
+ self.class.repository_software
39
+ end
40
+
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,12 @@
1
+ module Ddr
2
+ module Events
3
+ class IngestionEvent < Event
4
+
5
+ include PreservationEventBehavior
6
+
7
+ self.preservation_event_type = :ing
8
+ self.description = "Object ingested into the repository"
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,37 @@
1
+ module Ddr
2
+ module Events
3
+ module PreservationEventBehavior
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ class_attribute :preservation_event_type
8
+ end
9
+
10
+ def preservation_event_type
11
+ self.class.preservation_event_type
12
+ end
13
+
14
+ EVENT_ID_TYPE = "Duke Digital Repository Event ID"
15
+ LINKING_OBJECT_ID_TYPE = "Duke Digital Repository PID"
16
+
17
+ def as_premis
18
+ Ddr::Metadata::PremisEvent.new.tap do |doc|
19
+ doc.event_type = PreservationEventType.label_for(preservation_event_type)
20
+ doc.event_id_type = EVENT_ID_TYPE
21
+ doc.event_id_value = id
22
+ doc.event_detail = summary
23
+ doc.linking_object_id_type = LINKING_OBJECT_ID_TYPE
24
+ doc.linking_object_id_value = pid
25
+ doc.event_outcome = outcome
26
+ doc.event_outcome_detail_note = detail
27
+ doc.event_date_time = event_date_time_s
28
+ end
29
+ end
30
+
31
+ def to_xml
32
+ as_premis.to_xml
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ require 'rdf'
2
+
3
+ module Ddr
4
+ module Events
5
+ class PreservationEventType < RDF::StrictVocabulary("http://id.loc.gov/vocabulary/preservation/eventType/")
6
+ property :cap, label: "capture"
7
+ property :com, label: "compression"
8
+ property :cre, label: "creation"
9
+ property :dea, label: "deaccession"
10
+ property :dec, label: "decompression"
11
+ property :der, label: "decryption"
12
+ property :del, label: "deletion"
13
+ property :dig, label: "digital signature validation"
14
+ property :fix, label: "fixity check"
15
+ property :ing, label: "ingestion"
16
+ property :mes, label: "message digest calculation"
17
+ property :mig, label: "migration"
18
+ property :nor, label: "normalization"
19
+ property :rep, label: "replication"
20
+ property :val, label: "validation"
21
+ property :vir, label: "virus check"
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ module Ddr
2
+ module Events
3
+ module ReindexObjectAfterSave
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ after_save :reindex_object, unless: "object.nil?" # in case saved with validate: false
8
+ end
9
+
10
+ protected
11
+
12
+ def reindex_object
13
+ object.update_index
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ module Ddr
2
+ module Events
3
+ class UpdateEvent < Event
4
+
5
+ self.description = "Object updated"
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Ddr
2
+ module Events
3
+ class ValidationEvent < Event
4
+
5
+ include PreservationEventBehavior
6
+
7
+ self.preservation_event_type = :val
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,30 @@
1
+ module Ddr
2
+ module Events
3
+ class VirusCheckEvent < Event
4
+
5
+ include PreservationEventBehavior
6
+ include ReindexObjectAfterSave
7
+
8
+ self.preservation_event_type = :vir
9
+ self.description = "Content file scanned for viruses"
10
+
11
+ def to_solr
12
+ { Ddr::IndexFields::LAST_VIRUS_CHECK_ON => event_date_time_s,
13
+ Ddr::IndexFields::LAST_VIRUS_CHECK_OUTCOME => outcome }
14
+ end
15
+
16
+ # Message sent by ActiveSupport::Notifications
17
+ def self.call(*args)
18
+ notification = ActiveSupport::Notifications::Event.new(*args)
19
+ result = notification.payload[:result] # Ddr::Antivirus::ScanResult instance
20
+ create(pid: notification.payload[:pid],
21
+ event_date_time: result.scanned_at,
22
+ outcome: result.ok? ? SUCCESS : FAILURE,
23
+ software: result.version,
24
+ detail: result.to_s
25
+ )
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,39 @@
1
+ module Ddr
2
+ module IndexFields
3
+
4
+ def self.solr_name(*args)
5
+ ActiveFedora::SolrService.solr_name(*args)
6
+ end
7
+
8
+ ACTIVE_FEDORA_MODEL = solr_name :active_fedora_model, :stored_sortable
9
+ CONTENT_CONTROL_GROUP = solr_name :content_control_group, :searchable, type: :string
10
+ CONTENT_METADATA_PARSED = solr_name :content_metadata_parsed, :symbol
11
+ CONTENT_SIZE = solr_name :content_size, :stored_sortable, type: :integer
12
+ CONTENT_SIZE_HUMAN = solr_name :content_size_human, :symbol
13
+ HAS_MODEL = solr_name :has_model, :symbol
14
+ IDENTIFIER = solr_name :identifier, :stored_sortable
15
+ INTERNAL_URI = solr_name :internal_uri, :symbol
16
+ IS_ATTACHED_TO = solr_name :is_attached_to, :symbol
17
+ IS_EXTERNAL_TARGET_FOR = solr_name :is_external_target_for, :symbol
18
+ IS_GOVERNED_BY = solr_name :is_governed_by, :symbol
19
+ IS_MEMBER_OF = solr_name :is_member_of, :symbol
20
+ IS_MEMBER_OF_COLLECTION = solr_name :is_member_of_collection, :symbol
21
+ IS_PART_OF = solr_name :is_part_of, :symbol
22
+ LAST_FIXITY_CHECK_ON = solr_name :last_fixity_check_on, :stored_sortable, type: :date
23
+ LAST_FIXITY_CHECK_OUTCOME = solr_name :last_fixity_check_outcome, :symbol
24
+ LAST_VIRUS_CHECK_ON = solr_name :last_virus_check_on, :stored_sortable, type: :date
25
+ LAST_VIRUS_CHECK_OUTCOME = solr_name :last_virus_check_outcome, :symbol
26
+ MEDIA_SUB_TYPE = solr_name :content_media_sub_type, :facetable
27
+ MEDIA_MAJOR_TYPE = solr_name :content_media_major_type, :facetable
28
+ MEDIA_TYPE = solr_name :content_media_type, :symbol
29
+ OBJECT_PROFILE = solr_name :object_profile, :displayable
30
+ OBJECT_STATE = solr_name :object_state, :stored_sortable
31
+ OBJECT_CREATE_DATE = solr_name :system_create, :stored_sortable, type: :date
32
+ OBJECT_MODIFIED_DATE = solr_name :system_modified, :stored_sortable, type: :date
33
+ ORIGINAL_FILENAME = solr_name :original_filename, :symbol
34
+ PERMANENT_ID = solr_name :permanent_id, :stored_sortable, type: :string
35
+ TITLE = solr_name :title, :stored_sortable
36
+ WORKFLOW_STATE = solr_name :workflow_state, :stored_sortable
37
+
38
+ end
39
+ end
@@ -0,0 +1,22 @@
1
+ module Ddr
2
+ module Metadata
3
+ extend ActiveSupport::Autoload
4
+
5
+ autoload :DukeTerms
6
+ autoload :PremisEvent
7
+ autoload :RDFVocabularyParser
8
+ autoload :RolesVocabulary
9
+ autoload :Vocabulary
10
+
11
+ PREDICATES = {
12
+ "http://projecthydra.org/ns/relations#" => {
13
+ is_attached_to: "isAttachedTo"
14
+ },
15
+ "http://www.loc.gov/mix/v20/externalTarget#" => {
16
+ is_external_target_for: "isExternalTargetFor",
17
+ has_external_target: "hasExternalTarget"
18
+ }
19
+ }
20
+
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ module Ddr
2
+ module Metadata
3
+
4
+ class DukeTerms < RDF::StrictVocabulary("http://library.duke.edu/metadata/terms/")
5
+
6
+ RDFVocabularyParser.new(
7
+ File.join(File.dirname( __FILE__ ), "sources", "duketerms.rdf.xml"),
8
+ "http://library.duke.edu/metadata/terms/").
9
+ term_symbols.sort.each do |term|
10
+ property term, type: "rdf:Property".freeze
11
+ end
12
+
13
+ end
14
+ end
15
+ end