dor-services 5.17.3 → 5.18.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 +4 -4
- data/config/config_defaults.yml +8 -12
- data/config/dev_console_env.rb.example +0 -1
- data/lib/dor-services.rb +1 -5
- data/lib/dor/config.rb +0 -5
- data/lib/dor/datastreams/rights_metadata_ds.rb +10 -10
- data/lib/dor/models/concerns/describable.rb +66 -58
- data/lib/dor/models/concerns/editable.rb +9 -9
- data/lib/dor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d2d0fea02b55ee4906b57a7f1ec29d281cd4441a
|
|
4
|
+
data.tar.gz: 87963a5b75e157f4bb9bfd3aadefaf77b1945707
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d97aa054071249c9980d50c382823395a8b1deaa0a76241166bb5d0c1d903e5a6b6d0cd619a6bb881d64907ac07ef7beba7f6efda267dc1d55c852a62099d6b
|
|
7
|
+
data.tar.gz: f5c4680e39daa95b119771e1c6c0006b7e3189552637d4b20650008b2e5697d4b2c179f2ca85f6f518cb25532226b828e0fcf1039518e9546324c79ee70d9b4c
|
data/config/config_defaults.yml
CHANGED
|
@@ -9,13 +9,6 @@
|
|
|
9
9
|
:key_pass: ""
|
|
10
10
|
:fedora:
|
|
11
11
|
:url:
|
|
12
|
-
:safeurl:
|
|
13
|
-
:stomp:
|
|
14
|
-
:host:
|
|
15
|
-
:user: ""
|
|
16
|
-
:password: ""
|
|
17
|
-
:port: 61613
|
|
18
|
-
:client_id: 'dor-services'
|
|
19
12
|
:solr:
|
|
20
13
|
:url:
|
|
21
14
|
:opts: {}
|
|
@@ -23,8 +16,6 @@
|
|
|
23
16
|
:metadata:
|
|
24
17
|
:catalog:
|
|
25
18
|
:url:
|
|
26
|
-
:exist:
|
|
27
|
-
:url:
|
|
28
19
|
:sdr:
|
|
29
20
|
:local_workspace_root: /dor/workspace
|
|
30
21
|
:local_export_home: /dor/export
|
|
@@ -40,8 +31,6 @@
|
|
|
40
31
|
:rest_url: ""
|
|
41
32
|
:stacks:
|
|
42
33
|
:local_workspace_root: /dor
|
|
43
|
-
:storage_root: /stacks
|
|
44
|
-
:document_cache_storage_root:
|
|
45
34
|
:host:
|
|
46
35
|
:user:
|
|
47
36
|
:document_cache_host:
|
|
@@ -49,7 +38,7 @@
|
|
|
49
38
|
:local_stacks_root: /stacks
|
|
50
39
|
:local_document_cache_root: /purl/document_cache
|
|
51
40
|
:url:
|
|
52
|
-
:iiif_profile:
|
|
41
|
+
:iiif_profile: 'http://iiif.io/api/image/2/level1.json'
|
|
53
42
|
:suri:
|
|
54
43
|
:pass:
|
|
55
44
|
:id_namespace: druid
|
|
@@ -69,3 +58,10 @@
|
|
|
69
58
|
:log: 'log/indexing_svc.log'
|
|
70
59
|
:log_date_format_str: '%Y-%m-%d %H:%M:%S.%L'
|
|
71
60
|
:log_rotation_interval: 'daily'
|
|
61
|
+
:goobi:
|
|
62
|
+
:url:
|
|
63
|
+
:dpg_workflow_name: 'goobiWF'
|
|
64
|
+
:default_goobi_workflow_name: 'Example_Workflow'
|
|
65
|
+
:max_tries: 3
|
|
66
|
+
:max_sleep_seconds: 20
|
|
67
|
+
:base_sleep_seconds: 2
|
data/lib/dor-services.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'active_fedora'
|
|
2
2
|
require 'active_fedora/version'
|
|
3
3
|
require 'active_support/core_ext/module/attribute_accessors'
|
|
4
|
+
require 'active_support/core_ext/object/blank'
|
|
4
5
|
require 'modsulator'
|
|
5
6
|
require 'dor/utils/sdr_client'
|
|
6
7
|
|
|
@@ -144,11 +145,6 @@ module Dor
|
|
|
144
145
|
autoload :ResetWorkspaceService, 'dor/services/reset_workspace_service'
|
|
145
146
|
autoload :CleanupResetService, 'dor/services/cleanup_reset_service'
|
|
146
147
|
|
|
147
|
-
# Versioning Classes
|
|
148
|
-
module Versioning
|
|
149
|
-
autoload :FileInventoryDifference, 'dor/versioning/file_inventory_difference'
|
|
150
|
-
end
|
|
151
|
-
|
|
152
148
|
# Workflow Classes
|
|
153
149
|
module Workflow
|
|
154
150
|
autoload :Graph, 'dor/workflow/graph'
|
data/lib/dor/config.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require 'confstruct/configuration'
|
|
2
2
|
require 'rsolr'
|
|
3
|
-
require 'stomp'
|
|
4
3
|
require 'yaml'
|
|
5
4
|
|
|
6
5
|
module Dor
|
|
@@ -72,10 +71,6 @@ module Dor
|
|
|
72
71
|
:sdr => {
|
|
73
72
|
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.url, c.cert_file, c.key_file, c.key_pass }
|
|
74
73
|
},
|
|
75
|
-
:stomp => {
|
|
76
|
-
:connection => Confstruct.deferred { |c| Stomp::Connection.new c.user, c.password, c.host, c.port, true, 5, { 'client-id' => c.client_id }},
|
|
77
|
-
:client => Confstruct.deferred { |c| Stomp::Client.new c.user, c.password, c.host, c.port }
|
|
78
|
-
},
|
|
79
74
|
:workflow => {
|
|
80
75
|
:client => Confstruct.deferred do |c|
|
|
81
76
|
Dor::WorkflowService.configure c.url, logger: c.client_logger, timeout: c.timeout, dor_services_url: config.dor_services.url
|
|
@@ -183,17 +183,17 @@ module Dor
|
|
|
183
183
|
|
|
184
184
|
# these two values are returned by index_elements[:primary], but are just a less granular version of
|
|
185
185
|
# what the other more specific fields return, so discard them
|
|
186
|
-
solr_doc['rights_descriptions_ssim']
|
|
187
|
-
solr_doc['rights_descriptions_ssim']
|
|
186
|
+
solr_doc['rights_descriptions_ssim'] -= ['access_restricted', 'access_restricted_qualified', 'world_qualified']
|
|
187
|
+
solr_doc['rights_descriptions_ssim'] += ['dark (file)'] if dra.index_elements[:terms].include? 'none_read_file'
|
|
188
188
|
|
|
189
|
-
solr_doc['obj_rights_locations_ssim'] = dra.index_elements[:obj_locations]
|
|
190
|
-
solr_doc['file_rights_locations_ssim'] = dra.index_elements[:file_locations]
|
|
191
|
-
solr_doc['obj_rights_agents_ssim'] = dra.index_elements[:obj_agents]
|
|
192
|
-
solr_doc['file_rights_agents_ssim'] = dra.index_elements[:file_agents]
|
|
189
|
+
solr_doc['obj_rights_locations_ssim'] = dra.index_elements[:obj_locations] unless dra.index_elements[:obj_locations].blank?
|
|
190
|
+
solr_doc['file_rights_locations_ssim'] = dra.index_elements[:file_locations] unless dra.index_elements[:file_locations].blank?
|
|
191
|
+
solr_doc['obj_rights_agents_ssim'] = dra.index_elements[:obj_agents] unless dra.index_elements[:obj_agents].blank?
|
|
192
|
+
solr_doc['file_rights_agents_ssim'] = dra.index_elements[:file_agents] unless dra.index_elements[:file_agents].blank?
|
|
193
193
|
|
|
194
194
|
# suppress empties
|
|
195
195
|
%w(use_statement_ssim copyright_ssim).each do |key|
|
|
196
|
-
solr_doc[key] = solr_doc[key].reject
|
|
196
|
+
solr_doc[key] = solr_doc[key].reject(&:blank?).flatten unless solr_doc[key].nil?
|
|
197
197
|
end
|
|
198
198
|
add_solr_value(solr_doc, 'use_license_machine', use_license, :string, [:stored_sortable])
|
|
199
199
|
|
|
@@ -201,9 +201,9 @@ module Dor
|
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
def use_license
|
|
204
|
-
return creative_commons unless
|
|
205
|
-
return open_data_commons unless
|
|
206
|
-
|
|
204
|
+
return creative_commons unless creative_commons.blank?
|
|
205
|
+
return open_data_commons unless open_data_commons.blank?
|
|
206
|
+
nil
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
# maintain AF < 8 indexing behavior
|
|
@@ -18,10 +18,12 @@ module Dor
|
|
|
18
18
|
# @param [Nokogiri::XML::Document] content Nokogiri descMetadata document (overriding internal data)
|
|
19
19
|
# @param [boolean] ns_aware namespace awareness toggle for from_nk_node()
|
|
20
20
|
def stanford_mods(content = nil, ns_aware = true)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
@stanford_mods ||= begin
|
|
22
|
+
m = Stanford::Mods::Record.new
|
|
23
|
+
desc = content.nil? ? descMetadata.ng_xml : content
|
|
24
|
+
m.from_nk_node(desc.root, ns_aware)
|
|
25
|
+
m
|
|
26
|
+
end
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
def fetch_descMetadata_datastream
|
|
@@ -198,68 +200,74 @@ module Dor
|
|
|
198
200
|
|
|
199
201
|
def to_solr(solr_doc = {}, *args)
|
|
200
202
|
solr_doc = super solr_doc, *args
|
|
203
|
+
add_metadata_format_to_solr_doc(solr_doc)
|
|
204
|
+
add_dc_to_solr_doc(solr_doc)
|
|
205
|
+
add_mods_to_solr_doc(solr_doc)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def add_metadata_format_to_solr_doc(solr_doc)
|
|
209
|
+
solr_doc['metadata_format_ssim'] ||= []
|
|
210
|
+
solr_doc['metadata_format_ssim'] += ['mods']
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def add_dc_to_solr_doc(solr_doc)
|
|
214
|
+
dc_doc = generate_dublin_core(include_collection_as_related_item: false)
|
|
215
|
+
# we excluding the generated collection relation here; we instead get the collection
|
|
216
|
+
# title from Dor::Identifiable.
|
|
217
|
+
dc_doc.xpath('/oai_dc:dc/*', oai_dc: XMLNS_OAI_DC).each do |node|
|
|
218
|
+
add_solr_value(solr_doc, "public_dc_#{node.name}", node.text, :string, [:stored_searchable])
|
|
219
|
+
end
|
|
220
|
+
creator = ''
|
|
221
|
+
dc_doc.xpath('//dc:creator', dc: XMLNS_DC).each do |node|
|
|
222
|
+
creator = node.text
|
|
223
|
+
end
|
|
224
|
+
title = ''
|
|
225
|
+
dc_doc.xpath('//dc:title', dc: XMLNS_DC).each do |node|
|
|
226
|
+
title = node.text
|
|
227
|
+
end
|
|
228
|
+
creator_title = creator + title
|
|
229
|
+
add_solr_value(solr_doc, 'creator_title', creator_title, :string, [:stored_sortable])
|
|
230
|
+
rescue CrosswalkError => e
|
|
231
|
+
Dor.logger.warn "Cannot index #{pid}.descMetadata: #{e.message}"
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def add_mods_to_solr_doc(solr_doc)
|
|
201
235
|
mods_sources = {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
'sw_subject_temporal_tesim' => :era_facet,
|
|
216
|
-
'sw_subject_geographic_ssim' => :geographic_facet,
|
|
217
|
-
'sw_subject_geographic_tesim' => :geographic_facet,
|
|
218
|
-
'mods_typeOfResource_ssim' => [:term_values, :typeOfResource],
|
|
219
|
-
'mods_typeOfResource_tesim' => [:term_values, :typeOfResource]
|
|
220
|
-
}
|
|
221
|
-
keys = mods_sources.keys.concat(%w( metadata_format_ssim ))
|
|
222
|
-
keys.each { |key|
|
|
223
|
-
solr_doc[key] ||= [] # initialize multivalue targts if necessary
|
|
236
|
+
sw_title_display: %w(sw_display_title_tesim),
|
|
237
|
+
main_author_w_date: %w(sw_author_ssim sw_author_tesim),
|
|
238
|
+
sw_sort_author: %w(sw_author_sort_ssi),
|
|
239
|
+
sw_language_facet: %w(sw_language_ssim sw_language_tesim),
|
|
240
|
+
sw_genre: %w(sw_genre_ssim sw_genre_tesim),
|
|
241
|
+
format_main: %w(sw_format_ssim sw_format_tesim),
|
|
242
|
+
topic_facet: %w(sw_topic_ssim sw_topic_tesim),
|
|
243
|
+
era_facet: %w(sw_subject_temporal_ssim sw_subject_temporal_tesim),
|
|
244
|
+
geographic_facet: %w(sw_subject_geographic_ssim sw_subject_geographic_tesim),
|
|
245
|
+
[:term_values, :typeOfResource] => %w(mods_typeOfResource_ssim mods_typeOfResource_tesim),
|
|
246
|
+
pub_year_sort_str: %w(sw_pub_date_sort_ssi),
|
|
247
|
+
pub_year_int: %w(sw_pub_date_sort_isi),
|
|
248
|
+
pub_year_display_str: %w(sw_pub_date_facet_ssi)
|
|
224
249
|
}
|
|
225
250
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
creator = ''
|
|
235
|
-
dc_doc.xpath('//dc:creator', dc: XMLNS_DC).each do |node|
|
|
236
|
-
creator = node.text
|
|
237
|
-
end
|
|
238
|
-
title = ''
|
|
239
|
-
dc_doc.xpath('//dc:title', dc: XMLNS_DC).each do |node|
|
|
240
|
-
title = node.text
|
|
251
|
+
mods_sources.each_pair do |meth, solr_keys|
|
|
252
|
+
vals = meth.is_a?(Array) ? stanford_mods.send(meth.shift, *meth) : stanford_mods.send(meth)
|
|
253
|
+
|
|
254
|
+
next if vals.nil? || (vals.respond_to?(:empty?) && vals.empty?)
|
|
255
|
+
|
|
256
|
+
solr_keys.each do |key|
|
|
257
|
+
solr_doc[key] ||= []
|
|
258
|
+
solr_doc[key].push *vals
|
|
241
259
|
end
|
|
242
|
-
|
|
243
|
-
add_solr_value(solr_doc, 'creator_title', creator_title, :string, [:stored_sortable])
|
|
244
|
-
rescue CrosswalkError => e
|
|
245
|
-
Dor.logger.warn "Cannot index #{pid}.descMetadata: #{e.message}"
|
|
260
|
+
# asterisk to avoid multi-dimensional array: push values, not the array
|
|
246
261
|
end
|
|
247
262
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
vals = meth.is_a?(Array) ? mods.send(meth.shift, *meth) : mods.send(meth)
|
|
252
|
-
solr_doc[solr_key].push *vals unless vals.nil? || vals.empty?
|
|
253
|
-
# asterisk to avoid multi-dimensional array: push values, not the array
|
|
254
|
-
end
|
|
255
|
-
solr_doc['sw_pub_date_sort_ssi' ] = mods.pub_year_sort_str # e.g. '0800'
|
|
256
|
-
solr_doc['sw_pub_date_sort_isi' ] = mods.pub_year_int # e.g. '0800'
|
|
257
|
-
solr_doc['sw_pub_date_facet_ssi'] = mods.pub_year_display_str # e.g. '9th century'
|
|
263
|
+
# convert multivalued fields to single value
|
|
264
|
+
%w(sw_pub_date_sort_ssi sw_pub_date_sort_isi sw_pub_date_facet_ssi).each do |key|
|
|
265
|
+
solr_doc[key] = solr_doc[key].first unless solr_doc[key].nil?
|
|
258
266
|
end
|
|
259
267
|
# some fields get explicit "(none)" placeholder values, mostly for faceting
|
|
260
|
-
%w(sw_language_tesim sw_genre_tesim sw_format_tesim).each
|
|
261
|
-
|
|
262
|
-
|
|
268
|
+
%w(sw_language_tesim sw_genre_tesim sw_format_tesim).each do |key|
|
|
269
|
+
solr_doc[key] = ['(none)'] if solr_doc[key].nil? || solr_doc[key].empty?
|
|
270
|
+
end
|
|
263
271
|
solr_doc
|
|
264
272
|
end
|
|
265
273
|
|
|
@@ -174,19 +174,19 @@ module Dor
|
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
def use_license
|
|
177
|
-
return creative_commons_license unless
|
|
178
|
-
return open_data_commons_license unless
|
|
179
|
-
|
|
177
|
+
return creative_commons_license unless creative_commons_license.blank?
|
|
178
|
+
return open_data_commons_license unless open_data_commons_license.blank?
|
|
179
|
+
nil
|
|
180
180
|
end
|
|
181
181
|
def use_license_uri
|
|
182
|
-
return defaultObjectRights.creative_commons.uri.first unless
|
|
183
|
-
return defaultObjectRights.open_data_commons.uri.first unless
|
|
184
|
-
|
|
182
|
+
return defaultObjectRights.creative_commons.uri.first unless defaultObjectRights.creative_commons.uri.blank?
|
|
183
|
+
return defaultObjectRights.open_data_commons.uri.first unless defaultObjectRights.open_data_commons.uri.blank?
|
|
184
|
+
nil
|
|
185
185
|
end
|
|
186
186
|
def use_license_human
|
|
187
|
-
return creative_commons_license_human unless
|
|
188
|
-
return open_data_commons_license_human unless
|
|
189
|
-
|
|
187
|
+
return creative_commons_license_human unless creative_commons_license_human.blank?
|
|
188
|
+
return open_data_commons_license_human unless open_data_commons_license_human.blank?
|
|
189
|
+
nil
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
def creative_commons_license=(use_license_machine)
|
data/lib/dor/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dor-services
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.18.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Klein
|
|
@@ -14,7 +14,7 @@ authors:
|
|
|
14
14
|
autorequire:
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
|
-
date: 2016-11-
|
|
17
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
|
18
18
|
dependencies:
|
|
19
19
|
- !ruby/object:Gem::Dependency
|
|
20
20
|
name: active-fedora
|