hydra-pbcore 2.2.0 → 2.2.1
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.
@@ -106,11 +106,11 @@ class Document < ActiveFedora::OmDatastream
|
|
106
106
|
t.coll_num(:path=>"pbcoreRelationIdentifier", :attributes=>{ :annotation=>"Collection Number" })
|
107
107
|
t.acc_num(:path=>"pbcoreRelationIdentifier", :attributes=>{ :annotation=>"Accession Number" })
|
108
108
|
end
|
109
|
-
t.series(:
|
110
|
-
t.collection(:
|
111
|
-
t.archival_series(:
|
112
|
-
t.collection_number(:
|
113
|
-
t.accession_number(:
|
109
|
+
t.series(:proxy=>[:pbcoreRelation, :event_series], :index_as => [:searchable, :displayable])
|
110
|
+
t.collection(:proxy=>[:pbcoreRelation, :arch_coll], :index_as => [:searchable, :displayable])
|
111
|
+
t.archival_series(:proxy=>[:pbcoreRelation, :arch_ser], :index_as => [:searchable, :displayable])
|
112
|
+
t.collection_number(:proxy=>[:pbcoreRelation, :coll_num], :index_as => [:searchable, :displayable])
|
113
|
+
t.accession_number(:proxy=>[:pbcoreRelation, :acc_num], :index_as => [:searchable, :displayable])
|
114
114
|
|
115
115
|
t.pbcoreCoverage
|
116
116
|
# Terms for time and place
|
data/lib/hydra_pbcore/methods.rb
CHANGED
@@ -1,7 +1,19 @@
|
|
1
1
|
module HydraPbcore::Methods
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Used to delete nodes based on their OM term defintion.
|
4
|
+
#
|
5
|
+
# Default behavior is to delete on the xml defining the term. In
|
6
|
+
# some cases, terms can have dependent xml that is part of the term's
|
7
|
+
# parent. For example, pbcoreReation templates use the
|
8
|
+
# pbcoreRelation xml node to define a term, however the term's
|
9
|
+
# definition is dependent on the xml inside pbcoreRelation. When
|
10
|
+
# we delete the term, the pbcoreRelation has to go along with it.
|
11
|
+
#
|
12
|
+
# In that case, we can pass the option:
|
13
|
+
# :include_parent? => true
|
14
|
+
# Which will delete the term as well as its closest parent
|
15
|
+
def remove_node(type, index = 0, opts = {})
|
16
|
+
opts[:include_parent?] ? self.find_by_terms(type.to_sym).slice(index.to_i).parent.remove : self.find_by_terms(type.to_sym).slice(index.to_i).remove
|
5
17
|
end
|
6
18
|
|
7
19
|
# Returns a new Nokogiri::XML object with the contents of self, plus any additional instanstations,
|
data/lib/hydra_pbcore/version.rb
CHANGED
@@ -200,6 +200,66 @@
|
|
200
200
|
<pbcoreDescriptionDocument-0-lc-subject-genre-display type="array">
|
201
201
|
<pbcoreDescriptionDocument-0-lc-subject-genre-display>inserted</pbcoreDescriptionDocument-0-lc-subject-genre-display>
|
202
202
|
</pbcoreDescriptionDocument-0-lc-subject-genre-display>
|
203
|
+
<pbcoreDescriptionDocument-series-t type="array">
|
204
|
+
<pbcoreDescriptionDocument-series-t>inserted</pbcoreDescriptionDocument-series-t>
|
205
|
+
</pbcoreDescriptionDocument-series-t>
|
206
|
+
<pbcoreDescriptionDocument-series-display type="array">
|
207
|
+
<pbcoreDescriptionDocument-series-display>inserted</pbcoreDescriptionDocument-series-display>
|
208
|
+
</pbcoreDescriptionDocument-series-display>
|
209
|
+
<pbcoreDescriptionDocument-0-series-t type="array">
|
210
|
+
<pbcoreDescriptionDocument-0-series-t>inserted</pbcoreDescriptionDocument-0-series-t>
|
211
|
+
</pbcoreDescriptionDocument-0-series-t>
|
212
|
+
<pbcoreDescriptionDocument-0-series-display type="array">
|
213
|
+
<pbcoreDescriptionDocument-0-series-display>inserted</pbcoreDescriptionDocument-0-series-display>
|
214
|
+
</pbcoreDescriptionDocument-0-series-display>
|
215
|
+
<pbcoreDescriptionDocument-collection-t type="array">
|
216
|
+
<pbcoreDescriptionDocument-collection-t>inserted</pbcoreDescriptionDocument-collection-t>
|
217
|
+
</pbcoreDescriptionDocument-collection-t>
|
218
|
+
<pbcoreDescriptionDocument-collection-display type="array">
|
219
|
+
<pbcoreDescriptionDocument-collection-display>inserted</pbcoreDescriptionDocument-collection-display>
|
220
|
+
</pbcoreDescriptionDocument-collection-display>
|
221
|
+
<pbcoreDescriptionDocument-0-collection-t type="array">
|
222
|
+
<pbcoreDescriptionDocument-0-collection-t>inserted</pbcoreDescriptionDocument-0-collection-t>
|
223
|
+
</pbcoreDescriptionDocument-0-collection-t>
|
224
|
+
<pbcoreDescriptionDocument-0-collection-display type="array">
|
225
|
+
<pbcoreDescriptionDocument-0-collection-display>inserted</pbcoreDescriptionDocument-0-collection-display>
|
226
|
+
</pbcoreDescriptionDocument-0-collection-display>
|
227
|
+
<pbcoreDescriptionDocument-archival-series-t type="array">
|
228
|
+
<pbcoreDescriptionDocument-archival-series-t>inserted</pbcoreDescriptionDocument-archival-series-t>
|
229
|
+
</pbcoreDescriptionDocument-archival-series-t>
|
230
|
+
<pbcoreDescriptionDocument-archival-series-display type="array">
|
231
|
+
<pbcoreDescriptionDocument-archival-series-display>inserted</pbcoreDescriptionDocument-archival-series-display>
|
232
|
+
</pbcoreDescriptionDocument-archival-series-display>
|
233
|
+
<pbcoreDescriptionDocument-0-archival-series-t type="array">
|
234
|
+
<pbcoreDescriptionDocument-0-archival-series-t>inserted</pbcoreDescriptionDocument-0-archival-series-t>
|
235
|
+
</pbcoreDescriptionDocument-0-archival-series-t>
|
236
|
+
<pbcoreDescriptionDocument-0-archival-series-display type="array">
|
237
|
+
<pbcoreDescriptionDocument-0-archival-series-display>inserted</pbcoreDescriptionDocument-0-archival-series-display>
|
238
|
+
</pbcoreDescriptionDocument-0-archival-series-display>
|
239
|
+
<pbcoreDescriptionDocument-collection-number-t type="array">
|
240
|
+
<pbcoreDescriptionDocument-collection-number-t>inserted</pbcoreDescriptionDocument-collection-number-t>
|
241
|
+
</pbcoreDescriptionDocument-collection-number-t>
|
242
|
+
<pbcoreDescriptionDocument-collection-number-display type="array">
|
243
|
+
<pbcoreDescriptionDocument-collection-number-display>inserted</pbcoreDescriptionDocument-collection-number-display>
|
244
|
+
</pbcoreDescriptionDocument-collection-number-display>
|
245
|
+
<pbcoreDescriptionDocument-0-collection-number-t type="array">
|
246
|
+
<pbcoreDescriptionDocument-0-collection-number-t>inserted</pbcoreDescriptionDocument-0-collection-number-t>
|
247
|
+
</pbcoreDescriptionDocument-0-collection-number-t>
|
248
|
+
<pbcoreDescriptionDocument-0-collection-number-display type="array">
|
249
|
+
<pbcoreDescriptionDocument-0-collection-number-display>inserted</pbcoreDescriptionDocument-0-collection-number-display>
|
250
|
+
</pbcoreDescriptionDocument-0-collection-number-display>
|
251
|
+
<pbcoreDescriptionDocument-accession-number-t type="array">
|
252
|
+
<pbcoreDescriptionDocument-accession-number-t>inserted</pbcoreDescriptionDocument-accession-number-t>
|
253
|
+
</pbcoreDescriptionDocument-accession-number-t>
|
254
|
+
<pbcoreDescriptionDocument-accession-number-display type="array">
|
255
|
+
<pbcoreDescriptionDocument-accession-number-display>inserted</pbcoreDescriptionDocument-accession-number-display>
|
256
|
+
</pbcoreDescriptionDocument-accession-number-display>
|
257
|
+
<pbcoreDescriptionDocument-0-accession-number-t type="array">
|
258
|
+
<pbcoreDescriptionDocument-0-accession-number-t>inserted</pbcoreDescriptionDocument-0-accession-number-t>
|
259
|
+
</pbcoreDescriptionDocument-0-accession-number-t>
|
260
|
+
<pbcoreDescriptionDocument-0-accession-number-display type="array">
|
261
|
+
<pbcoreDescriptionDocument-0-accession-number-display>inserted</pbcoreDescriptionDocument-0-accession-number-display>
|
262
|
+
</pbcoreDescriptionDocument-0-accession-number-display>
|
203
263
|
<pbcoreDescriptionDocument-event-place-t type="array">
|
204
264
|
<pbcoreDescriptionDocument-event-place-t>inserted</pbcoreDescriptionDocument-event-place-t>
|
205
265
|
</pbcoreDescriptionDocument-event-place-t>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HydraPbcore::Methods do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@object = HydraPbcore::Datastream::Document.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ".remove_node" do
|
10
|
+
|
11
|
+
it "should delete nodes given a term" do
|
12
|
+
@object.insert_publisher "bar"
|
13
|
+
@object.publisher.first.should == "bar"
|
14
|
+
@object.remove_node :publisher
|
15
|
+
@object.publisher.should be_empty
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should delete nodes all with their parents" do
|
19
|
+
@object.insert_relation("foo", "Archival Collection")
|
20
|
+
@object.collection.first.should == "foo"
|
21
|
+
@object.remove_node :collection, 0, {:include_parent? => TRUE}
|
22
|
+
@object.find_by_terms(:pbcoreRelation).should be_empty
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-pbcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active-fedora
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- spec/instantiation_spec.rb
|
202
202
|
- spec/integration/conversions_spec.rb
|
203
203
|
- spec/mapper_spec.rb
|
204
|
+
- spec/methods_spec.rb
|
204
205
|
- spec/spec_helper.rb
|
205
206
|
- spec/templates_spec.rb
|
206
207
|
- tmp/.gitkeep
|
@@ -218,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
219
|
version: '0'
|
219
220
|
segments:
|
220
221
|
- 0
|
221
|
-
hash:
|
222
|
+
hash: -2492019924904625279
|
222
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
224
|
none: false
|
224
225
|
requirements:
|
@@ -227,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
228
|
version: '0'
|
228
229
|
segments:
|
229
230
|
- 0
|
230
|
-
hash:
|
231
|
+
hash: -2492019924904625279
|
231
232
|
requirements: []
|
232
233
|
rubyforge_project:
|
233
234
|
rubygems_version: 1.8.23
|
@@ -269,6 +270,7 @@ test_files:
|
|
269
270
|
- spec/instantiation_spec.rb
|
270
271
|
- spec/integration/conversions_spec.rb
|
271
272
|
- spec/mapper_spec.rb
|
273
|
+
- spec/methods_spec.rb
|
272
274
|
- spec/spec_helper.rb
|
273
275
|
- spec/templates_spec.rb
|
274
276
|
has_rdoc:
|