dor-services 5.0.0 → 5.0.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f49ca049f1d4c644bc7e51811bc36562298ba729
|
4
|
+
data.tar.gz: 401af70a4012e11c8a26b8d9c0c3f871bd5b1a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd74c7ff789ae4e0e06f8dc29e8460501f64c8f765fee7addd406d61692fb7e83e037b5961a502a0d367a533dcecb112aea14a3e1e421128079b5862a22935b3
|
7
|
+
data.tar.gz: bcab2bbfdcd50f81c5465633d62b1c7b5d4d198f5ce5824f742a4e2f34fc48930783ff7dd30bdab006859e9b8c2c5b68b3a43a450bc72db1d6b449dc3d3b89c1
|
@@ -1,27 +1,33 @@
|
|
1
1
|
module Dor
|
2
|
-
class DescMetadataDS < ActiveFedora::OmDatastream
|
3
|
-
|
2
|
+
class DescMetadataDS < ActiveFedora::OmDatastream
|
3
|
+
|
4
4
|
MODS_NS = 'http://www.loc.gov/mods/v3'
|
5
5
|
set_terminology do |t|
|
6
6
|
t.root :path => 'mods', :xmlns => MODS_NS, :index_as => [:not_searchable]
|
7
7
|
t.originInfo :index_as => [:not_searchable] do
|
8
|
-
t.publisher :index_as => [:
|
8
|
+
t.publisher :index_as => [:stored_searchable]
|
9
|
+
t.date_created :path => 'dateCreated', :index_as => [:stored_searchable]
|
9
10
|
t.place :index_as => [:not_searchable] do
|
10
|
-
t.placeTerm :attributes => {:type => 'text'}, :index_as => [:
|
11
|
+
t.placeTerm :attributes => {:type => 'text'}, :index_as => [:stored_searchable]
|
11
12
|
end
|
12
13
|
end
|
14
|
+
t.subject(:index_as => [:not_searchable]) do
|
15
|
+
t.geographic :index_as => [:stored_searchable]
|
16
|
+
t.topic :index_as => [:stored_searchable]
|
17
|
+
t.temporal :index_as => [:stored_searchable]
|
18
|
+
end
|
13
19
|
t.title_info(:path=>"titleInfo") {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
20
|
+
t.main_title(:index_as=>[:facetable], :path=>"title", :label=>"title") {
|
21
|
+
t.main_title_lang(:path=>{:attribute=> "xml:lang"})
|
22
|
+
}
|
23
|
+
}
|
18
24
|
t.coordinates :index_as => [:searchable]
|
19
25
|
t.extent :index_as => [:searchable]
|
20
26
|
t.scale :index_as => [:searchable]
|
21
|
-
t.topic :index_as => [:
|
22
|
-
t.abstract :index_as => [:
|
27
|
+
t.topic :index_as => [:stored_searchable]
|
28
|
+
t.abstract :index_as => [:stored_searchable]
|
23
29
|
end
|
24
|
-
|
30
|
+
|
25
31
|
def self.xml_template
|
26
32
|
Nokogiri::XML::Builder.new do |xml|
|
27
33
|
xml.mods( 'xmlns' => 'http://www.loc.gov/mods/v3', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',:version => '3.3', "xsi:schemaLocation" => 'http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd'){
|
@@ -85,9 +85,9 @@ class IdentityMetadataDS < ActiveFedora::OmDatastream
|
|
85
85
|
if digital_object.respond_to?(:profile)
|
86
86
|
digital_object.profile.each_pair do |property,value|
|
87
87
|
if property =~ /Date/
|
88
|
-
add_solr_value(solr_doc, property.underscore, Time.parse(value).utc.xmlschema, :date, [:
|
88
|
+
add_solr_value(solr_doc, property.underscore, Time.parse(value).utc.xmlschema, :date, [:stored_searchable])
|
89
89
|
else
|
90
|
-
add_solr_value(solr_doc, property.underscore, value, :string, [:
|
90
|
+
add_solr_value(solr_doc, property.underscore, value, :string, [:stored_searchable])
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -12,6 +12,18 @@ module Dor
|
|
12
12
|
has_metadata :name => "descMetadata", :type => Dor::DescMetadataDS, :label => 'Descriptive Metadata', :control_group => 'M'
|
13
13
|
end
|
14
14
|
|
15
|
+
require 'stanford-mods/searchworks'
|
16
|
+
|
17
|
+
# intended for read-access, "as SearchWorks would see it", mostly for to_solr()
|
18
|
+
# @param [Nokogiri::XML::Document] content Nokogiri descMetadata document (overriding internal data)
|
19
|
+
# @param [boolean] ns_aware namespace awareness toggle for from_nk_node()
|
20
|
+
def stanford_mods(content=nil, ns_aware=true)
|
21
|
+
m = Stanford::Mods::Record.new
|
22
|
+
desc = content.nil? ? self.descMetadata.ng_xml : content
|
23
|
+
m.from_nk_node(desc.root, ns_aware)
|
24
|
+
m
|
25
|
+
end
|
26
|
+
|
15
27
|
def fetch_descMetadata_datastream
|
16
28
|
candidates = self.datastreams['identityMetadata'].otherId.collect { |oid| oid.to_s }
|
17
29
|
metadata_id = Dor::MetadataService.resolvable(candidates).first
|
@@ -145,7 +157,13 @@ module Dor
|
|
145
157
|
|
146
158
|
def to_solr(solr_doc=Hash.new, *args)
|
147
159
|
super solr_doc, *args
|
148
|
-
|
160
|
+
# initialize multivalue targts if necessary
|
161
|
+
%w[ metadata_format_ssim sw_language_tesim sw_genre_tesim sw_format_tesim
|
162
|
+
sw_subject_temporal_tesim sw_subject_geographic_tesim mods_typeOfResource_tesim].each { |key|
|
163
|
+
solr_doc[key] ||= []
|
164
|
+
}
|
165
|
+
|
166
|
+
solr_doc["metadata_format_ssim"] << self.metadata_format
|
149
167
|
begin
|
150
168
|
dc_doc = self.generate_dublin_core
|
151
169
|
dc_doc.xpath('/oai_dc:dc/*').each do |node|
|
@@ -164,8 +182,29 @@ module Dor
|
|
164
182
|
rescue CrosswalkError => e
|
165
183
|
ActiveFedora.logger.warn "Cannot index #{self.pid}.descMetadata: #{e.message}"
|
166
184
|
end
|
185
|
+
|
186
|
+
begin
|
187
|
+
mods = self.stanford_mods
|
188
|
+
sources = {
|
189
|
+
'sw_language_tesim' => :sw_language_facet,
|
190
|
+
'sw_genre_tesim' => :sw_genre,
|
191
|
+
'sw_format_tesim' => :format_main, # basically sw_typeOfResource_tesim
|
192
|
+
'sw_subject_temporal_tesim' => :era_facet,
|
193
|
+
'sw_subject_geographic_tesim' => :geographic_facet,
|
194
|
+
'mods_typeOfResource_tesim' => [:term_values, :typeOfResource]
|
195
|
+
}
|
196
|
+
sources.each_pair do |solr_key, meth|
|
197
|
+
vals = meth.is_a?(Array) ? mods.send(meth.shift, *meth) : mods.send(meth)
|
198
|
+
solr_doc[solr_key].push *vals unless (vals.nil? || vals.empty?)
|
199
|
+
# asterisk to avoid multi-dimensional array: push values, not the array
|
200
|
+
end
|
201
|
+
solr_doc['sw_pub_date_sort_ssi'] = mods.pub_date_sort
|
202
|
+
end
|
203
|
+
# some fields get explicit "(none)" placeholder values, mostly for faceting
|
204
|
+
%w[sw_language_tesim sw_genre_tesim sw_format_tesim].each { |key| solr_doc[key] = ['(none)'] if solr_doc[key].empty? }
|
167
205
|
solr_doc
|
168
206
|
end
|
207
|
+
|
169
208
|
def update_title(new_title)
|
170
209
|
if not update_simple_field('mods:mods/mods:titleInfo/mods:title',new_title)
|
171
210
|
raise 'Descriptive metadata has no title to update!'
|
@@ -194,7 +233,7 @@ module Dor
|
|
194
233
|
def set_desc_metadata_using_label(force=false)
|
195
234
|
ds=self.descMetadata
|
196
235
|
unless force || ds.new?
|
197
|
-
raise 'Cannot proceed, there is already content in the descriptive metadata datastream
|
236
|
+
raise 'Cannot proceed, there is already content in the descriptive metadata datastream: '+ds.content.to_s
|
198
237
|
end
|
199
238
|
label=self.label
|
200
239
|
builder = Nokogiri::XML::Builder.new { |xml|
|
@@ -214,9 +253,7 @@ module Dor
|
|
214
253
|
if(title_node)
|
215
254
|
title = title_node.content
|
216
255
|
subtitle=xml.at_xpath('//mods:mods/mods:titleInfo/mods:subTitle','mods' => 'http://www.loc.gov/mods/v3')
|
217
|
-
|
218
|
-
title += ' (' + subtitle.content + ')'
|
219
|
-
end
|
256
|
+
title += " (#{subtitle.content})" if subtitle
|
220
257
|
end
|
221
258
|
title
|
222
259
|
end
|
@@ -181,17 +181,16 @@ module Dor
|
|
181
181
|
sortable_milestones.each do |milestone, unordered_dates|
|
182
182
|
dates = unordered_dates.sort
|
183
183
|
#create the published_dt and published_day fields and the like
|
184
|
-
add_solr_value(solr_doc, milestone+'_day', DateTime.parse(dates.last).beginning_of_day.utc.xmlschema.split('T').first, :string, [:
|
185
|
-
add_solr_value(solr_doc, milestone, dates.first, :date, [:
|
184
|
+
add_solr_value(solr_doc, milestone+'_day', DateTime.parse(dates.last).beginning_of_day.utc.xmlschema.split('T').first, :string, [:stored_searchable, :facetable])
|
185
|
+
add_solr_value(solr_doc, milestone, dates.first, :date, [:stored_searchable, :facetable])
|
186
186
|
|
187
187
|
#fields for OAI havester to sort on
|
188
188
|
add_solr_value(solr_doc, "#{milestone}_earliest_dt", dates.first, :date, [:sortable])
|
189
|
-
add_solr_value(solr_doc, "#{milestone}_latest_dt",
|
189
|
+
add_solr_value(solr_doc, "#{milestone}_latest_dt", dates.last, :date, [:sortable])
|
190
190
|
|
191
191
|
#for future faceting
|
192
192
|
add_solr_value(solr_doc, "#{milestone}_earliest", dates.first, :date, [:searchable, :facetable])
|
193
|
-
add_solr_value(solr_doc, "#{milestone}_latest",
|
194
|
-
|
193
|
+
add_solr_value(solr_doc, "#{milestone}_latest", dates.last, :date, [:searchable, :facetable])
|
195
194
|
end
|
196
195
|
add_solr_value(solr_doc,"status",status,:string, [:displayable])
|
197
196
|
|
@@ -24,7 +24,6 @@ module Dor
|
|
24
24
|
raise Dor::Exception, 'Object already opened for versioning' if(new_version_open?)
|
25
25
|
raise Dor::Exception, 'Object currently being accessioned' if(Dor::WorkflowService.get_active_lifecycle('dor', pid, 'submitted'))
|
26
26
|
|
27
|
-
|
28
27
|
vmd_ds = datastreams['versionMetadata']
|
29
28
|
vmd_ds.increment_version
|
30
29
|
vmd_ds.content = vmd_ds.ng_xml.to_s
|
@@ -81,7 +80,7 @@ module Dor
|
|
81
80
|
|
82
81
|
# @return [Boolean] true if the object is in a state that allows it to be modified. States that will allow modification are: has not been submitted for accessioning, has an open version or has sdr-ingest set to hold
|
83
82
|
def allows_modification?
|
84
|
-
if Dor::WorkflowService.get_lifecycle('dor', pid, 'submitted'
|
83
|
+
if Dor::WorkflowService.get_lifecycle('dor', pid, 'submitted') && ! new_version_open? && Dor::WorkflowService.get_workflow_status('dor', pid, 'accessionWF', 'sdr-ingest-transfer')!='hold'
|
85
84
|
false
|
86
85
|
else
|
87
86
|
true
|
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.0.
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Klein
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: active-fedora
|
@@ -384,6 +384,20 @@ dependencies:
|
|
384
384
|
- - "~>"
|
385
385
|
- !ruby/object:Gem::Version
|
386
386
|
version: 1.4.4
|
387
|
+
- !ruby/object:Gem::Dependency
|
388
|
+
name: stanford-mods
|
389
|
+
requirement: !ruby/object:Gem::Requirement
|
390
|
+
requirements:
|
391
|
+
- - "~>"
|
392
|
+
- !ruby/object:Gem::Version
|
393
|
+
version: '1.1'
|
394
|
+
type: :runtime
|
395
|
+
prerelease: false
|
396
|
+
version_requirements: !ruby/object:Gem::Requirement
|
397
|
+
requirements:
|
398
|
+
- - "~>"
|
399
|
+
- !ruby/object:Gem::Version
|
400
|
+
version: '1.1'
|
387
401
|
- !ruby/object:Gem::Dependency
|
388
402
|
name: awesome_print
|
389
403
|
requirement: !ruby/object:Gem::Requirement
|