active-fedora 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CONSOLE_GETTING_STARTED.textile +92 -59
- data/Gemfile.lock +1 -2
- data/README.textile +2 -2
- data/config/fedora.yml +1 -1
- data/config/predicate_mappings.yml +17 -20
- data/lib/active_fedora.rb +2 -5
- data/lib/active_fedora/samples/hydra-mods_article_datastream.rb +3 -3
- data/lib/active_fedora/samples/sample_af_obj_relationship_query_param.rb +11 -0
- data/lib/active_fedora/samples/special_thing.rb +4 -2
- data/lib/active_fedora/semantic_node.rb +254 -15
- data/lib/active_fedora/version.rb +1 -1
- data/spec/fixtures/rails_root/config/fedora.yml +4 -4
- data/spec/integration/nokogiri_datastream_spec.rb +2 -1
- data/spec/integration/semantic_node_spec.rb +259 -2
- data/spec/unit/active_fedora_spec.rb +2 -2
- data/spec/unit/semantic_node_spec.rb +13 -6
- metadata +8 -6
@@ -79,7 +79,7 @@ describe ActiveFedora do
|
|
79
79
|
end
|
80
80
|
it "should load the passed config if explicit config passed in" do
|
81
81
|
ActiveFedora.init('./spec/fixtures/rails_root/config/fedora.yml')
|
82
|
-
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@
|
82
|
+
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@localhost:8983/fedora"
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -115,7 +115,7 @@ describe ActiveFedora do
|
|
115
115
|
ActiveFedora.init()
|
116
116
|
ActiveFedora.solr.class.should == ActiveFedora::SolrService
|
117
117
|
ActiveFedora.fedora.class.should == Fedora::Repository
|
118
|
-
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@
|
118
|
+
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@localhost:8983/fedora"
|
119
119
|
end
|
120
120
|
it "should load the default file if no config is found at Rails.root" do
|
121
121
|
Rails.expects(:root).returns(File.join(File.dirname(__FILE__),"../fixtures/bad/path/to/rails_root"))
|
@@ -187,6 +187,7 @@ describe ActiveFedora::SemanticNode do
|
|
187
187
|
end
|
188
188
|
|
189
189
|
#can only duplicate predicates if not both inbound or not both outbound
|
190
|
+
=begin
|
190
191
|
class MockHasRelationshipDuplicatePredicate < SpecNode2
|
191
192
|
has_relationship "testing", :has_member, :type=>SpecNode2
|
192
193
|
had_exception = false
|
@@ -197,7 +198,9 @@ describe ActiveFedora::SemanticNode do
|
|
197
198
|
end
|
198
199
|
raise "Did not raise exception if duplicate predicate used" unless had_exception
|
199
200
|
end
|
200
|
-
|
201
|
+
=end
|
202
|
+
|
203
|
+
=begin
|
201
204
|
#can only duplicate predicates if not both inbound or not both outbound
|
202
205
|
class MockHasRelationshipDuplicatePredicate2 < SpecNode2
|
203
206
|
has_relationship "testing", :has_member, :type=>SpecNode2, :inbound=>true
|
@@ -209,6 +212,7 @@ describe ActiveFedora::SemanticNode do
|
|
209
212
|
end
|
210
213
|
raise "Did not raise exception if duplicate predicate used" unless had_exception
|
211
214
|
end
|
215
|
+
=end
|
212
216
|
|
213
217
|
it 'should create relationship descriptions both inbound and outbound' do
|
214
218
|
@test_object2 = MockHasRelationship.new
|
@@ -265,7 +269,8 @@ describe ActiveFedora::SemanticNode do
|
|
265
269
|
mock_repo.expects(:find_model).with("_PID3_", "AudioRecord").returns("AR3")
|
266
270
|
SpecNode.create_inbound_relationship_finders("parts", :is_part_of, :inbound => true)
|
267
271
|
local_node = SpecNode.new()
|
268
|
-
local_node.expects(:
|
272
|
+
local_node.expects(:pid).returns("test:sample_pid")
|
273
|
+
SpecNode.expects(:named_relationships_desc).returns({:inbound=>{"parts"=>{:predicate=>:is_part_of}}}).at_least_once()
|
269
274
|
ActiveFedora::SolrService.instance.conn.expects(:query).with("is_part_of_s:info\\:fedora/test\\:sample_pid", :rows=>25).returns(solr_result)
|
270
275
|
Fedora::Repository.expects(:instance).returns(mock_repo).times(3)
|
271
276
|
Kernel.expects(:const_get).with("AudioRecord").returns("AudioRecord").times(3)
|
@@ -278,7 +283,8 @@ describe ActiveFedora::SemanticNode do
|
|
278
283
|
local_node = SpecNode.new
|
279
284
|
mock_repo = mock("repo")
|
280
285
|
mock_repo.expects(:find_model).never
|
281
|
-
local_node.expects(:
|
286
|
+
local_node.expects(:pid).returns("test:sample_pid")
|
287
|
+
SpecNode.expects(:named_relationships_desc).returns({:inbound=>{"constituents"=>{:predicate=>:is_constituent_of}}}).at_least_once()
|
282
288
|
ActiveFedora::SolrService.instance.conn.expects(:query).with("is_constituent_of_s:info\\:fedora/test\\:sample_pid", :rows=>101).returns(solr_result)
|
283
289
|
local_node.constituents(:response_format => :solr, :rows=>101).should equal(solr_result)
|
284
290
|
end
|
@@ -287,7 +293,8 @@ describe ActiveFedora::SemanticNode do
|
|
287
293
|
it "resulting _ids finder should search against solr and return an array of fedora PIDs" do
|
288
294
|
SpecNode.create_inbound_relationship_finders("parts", :is_part_of, :inbound => true)
|
289
295
|
local_node = SpecNode.new
|
290
|
-
local_node.expects(:
|
296
|
+
local_node.expects(:pid).returns("test:sample_pid")
|
297
|
+
SpecNode.expects(:named_relationships_desc).returns({:inbound=>{"parts"=>{:predicate=>:is_part_of}}}).at_least_once()
|
291
298
|
ActiveFedora::SolrService.instance.conn.expects(:query).with("is_part_of_s:info\\:fedora/test\\:sample_pid", :rows=>25).returns(mock("solr result", :hits => [Hash["id"=>"pid1"], Hash["id"=>"pid2"]]))
|
292
299
|
local_node.parts(:response_format => :id_array).should == ["pid1", "pid2"]
|
293
300
|
end
|
@@ -399,10 +406,10 @@ describe ActiveFedora::SemanticNode do
|
|
399
406
|
end
|
400
407
|
it "(:response_format => :solr) should construct a solr query that combines inbound and outbound searches" do
|
401
408
|
# get the id array for outbound relationships then construct solr query by combining id array with inbound relationship search
|
402
|
-
@local_node.expects(:
|
409
|
+
@local_node.expects(:outbound_relationships).returns({:has_part=>["mypid:1"]}).at_least_once()
|
403
410
|
id_array_query = ActiveFedora::SolrService.construct_query_for_pids(["mypid:1"])
|
404
411
|
solr_result = mock("solr result")
|
405
|
-
ActiveFedora::SolrService.instance.conn.expects(:query).with("is_part_of_s:info\\:fedora/test\\:sample_pid
|
412
|
+
ActiveFedora::SolrService.instance.conn.expects(:query).with("#{id_array_query} OR (is_part_of_s:info\\:fedora/test\\:sample_pid)", :rows=>25).returns(solr_result)
|
406
413
|
@local_node.all_parts(:response_format=>:solr)
|
407
414
|
end
|
408
415
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 1
|
10
|
+
version: 2.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Zumwalt
|
@@ -16,7 +16,8 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-06
|
19
|
+
date: 2011-07-06 00:00:00 -05:00
|
20
|
+
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: solr-ruby
|
@@ -465,6 +466,7 @@ files:
|
|
465
466
|
- lib/active_fedora/samples/hydra-mods_article_datastream.rb
|
466
467
|
- lib/active_fedora/samples/hydra-rights_metadata_datastream.rb
|
467
468
|
- lib/active_fedora/samples/marpa-dc_datastream.rb
|
469
|
+
- lib/active_fedora/samples/sample_af_obj_relationship_query_param.rb
|
468
470
|
- lib/active_fedora/samples/special_thing.rb
|
469
471
|
- lib/active_fedora/semantic_node.rb
|
470
472
|
- lib/active_fedora/solr_service.rb
|
@@ -586,6 +588,7 @@ files:
|
|
586
588
|
- spec/unit/semantic_node_spec.rb
|
587
589
|
- spec/unit/solr_config_options_spec.rb
|
588
590
|
- spec/unit/solr_service_spec.rb
|
591
|
+
has_rdoc: true
|
589
592
|
homepage: http://yourmediashelf.com/activefedora
|
590
593
|
licenses: []
|
591
594
|
|
@@ -615,7 +618,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
615
618
|
requirements: []
|
616
619
|
|
617
620
|
rubyforge_project: rubyfedora
|
618
|
-
rubygems_version: 1.
|
621
|
+
rubygems_version: 1.6.2
|
619
622
|
signing_key:
|
620
623
|
specification_version: 3
|
621
624
|
summary: A convenience libary for manipulating MODS (Metadata Object Description Schema) documents.
|
@@ -718,4 +721,3 @@ test_files:
|
|
718
721
|
- spec/unit/semantic_node_spec.rb
|
719
722
|
- spec/unit/solr_config_options_spec.rb
|
720
723
|
- spec/unit/solr_service_spec.rb
|
721
|
-
has_rdoc:
|