active-fedora 3.3.2 → 4.0.0.rc1
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.
- data/Gemfile.lock +21 -22
- data/History.txt +9 -0
- data/README.textile +1 -1
- data/TODO +1 -0
- data/active-fedora.gemspec +3 -3
- data/config/fedora.yml +9 -3
- data/lib/active_fedora.rb +43 -33
- data/lib/active_fedora/base.rb +80 -31
- data/lib/active_fedora/config.rb +38 -0
- data/lib/active_fedora/content_model.rb +0 -6
- data/lib/active_fedora/datastream.rb +22 -0
- data/lib/active_fedora/delegating.rb +24 -25
- data/lib/active_fedora/digital_object.rb +2 -1
- data/lib/active_fedora/file_management.rb +1 -0
- data/lib/active_fedora/fixture_exporter.rb +1 -1
- data/lib/active_fedora/fixture_loader.rb +3 -3
- data/lib/active_fedora/metadata_datastream.rb +6 -0
- data/lib/active_fedora/model.rb +24 -5
- data/lib/active_fedora/nokogiri_datastream.rb +1 -0
- data/lib/active_fedora/ntriples_rdf_datastream.rb +0 -1
- data/lib/active_fedora/persistence.rb +2 -1
- data/lib/active_fedora/predicates.rb +27 -27
- data/lib/active_fedora/rdf_datastream.rb +104 -30
- data/lib/active_fedora/rels_ext_datastream.rb +14 -10
- data/lib/active_fedora/rubydora_connection.rb +4 -27
- data/lib/active_fedora/service_definitions.rb +2 -3
- data/lib/active_fedora/solr_digital_object.rb +22 -8
- data/lib/active_fedora/solr_service.rb +1 -1
- data/lib/active_fedora/unsaved_digital_object.rb +1 -4
- data/lib/active_fedora/version.rb +1 -1
- data/lib/tasks/active_fedora.rake +6 -6
- data/lib/tasks/active_fedora_dev.rake +0 -1
- data/spec/fixtures/mixed_rdf_descMetadata.nt +6 -0
- data/spec/fixtures/rails_root/config/fedora.yml +3 -1
- data/spec/fixtures/sharded_fedora.yml +11 -0
- data/spec/integration/base_file_management_spec.rb +6 -3
- data/spec/integration/base_find_by_fields_spec.rb +15 -16
- data/spec/integration/base_spec.rb +11 -178
- data/spec/integration/datastream_collections_spec.rb +1 -1
- data/spec/integration/full_featured_model_spec.rb +1 -2
- data/spec/integration/model_spec.rb +8 -9
- data/spec/integration/mods_article_integration_spec.rb +1 -1
- data/spec/integration/nokogiri_datastream_spec.rb +1 -1
- data/spec/integration/ntriples_datastream_spec.rb +80 -0
- data/spec/integration/rels_ext_datastream_spec.rb +0 -1
- data/spec/integration/semantic_node_spec.rb +18 -26
- data/spec/integration/solr_service_spec.rb +51 -1
- data/{lib/active_fedora → spec}/samples/hydra-mods_article_datastream.rb +0 -0
- data/{lib/active_fedora → spec}/samples/hydra-rights_metadata_datastream.rb +0 -0
- data/{lib/active_fedora → spec}/samples/marpa-dc_datastream.rb +0 -0
- data/spec/samples/models/hydrangea_article.rb +2 -2
- data/spec/samples/samples.rb +2 -0
- data/{lib/active_fedora → spec}/samples/special_thing.rb +3 -3
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/active_fedora_spec.rb +17 -50
- data/spec/unit/base_extra_spec.rb +4 -0
- data/spec/unit/base_file_management_spec.rb +5 -2
- data/spec/unit/base_spec.rb +692 -628
- data/spec/unit/config_spec.rb +19 -0
- data/spec/unit/content_model_spec.rb +1 -24
- data/spec/unit/datastream_collections_spec.rb +11 -14
- data/spec/unit/datastreams_spec.rb +49 -54
- data/spec/unit/model_spec.rb +24 -53
- data/spec/unit/nokogiri_datastream_spec.rb +6 -1
- data/spec/unit/ntriples_datastream_spec.rb +73 -0
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +1 -1
- data/spec/unit/relationships_spec.rb +6 -3
- data/spec/unit/rels_ext_datastream_spec.rb +19 -0
- data/spec/unit/rubydora_connection_spec.rb +2 -56
- data/spec/unit/solr_service_spec.rb +3 -1
- data/spec/unit/unsaved_digital_object_spec.rb +2 -2
- metadata +46 -33
- data/lib/active_fedora/dcrdf_datastream.rb +0 -11
- data/lib/active_fedora/relationship.rb +0 -47
- data/lib/active_fedora/samples.rb +0 -3
- data/spec/integration/dc_rdf_datastream_spec.rb +0 -24
- data/spec/unit/dc_rdf_datastream_spec.rb +0 -50
- data/spec/unit/relationship_spec.rb +0 -92
@@ -1,11 +0,0 @@
|
|
1
|
-
module ActiveFedora
|
2
|
-
class DCRDFDatastream < NtriplesRDFDatastream
|
3
|
-
|
4
|
-
# given a symbol, resolve the predicate as a RDF::URI
|
5
|
-
# if the predicate is not in DC, return nil
|
6
|
-
def resolve_predicate(name)
|
7
|
-
RDF::DC.send(name) if RDF::DC.respond_to? name
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
11
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'uri'
|
2
|
-
module ActiveFedora
|
3
|
-
|
4
|
-
class Relationship
|
5
|
-
|
6
|
-
attr_accessor :subject, :predicate, :object, :is_literal, :data_type
|
7
|
-
def initialize(attr={})
|
8
|
-
ActiveSupport::Deprecation.warn("ActiveFedora::Releationship is deprecated and will be removed in the next release")
|
9
|
-
attr = {:is_literal => false}.merge(attr)
|
10
|
-
@is_literal = attr[:is_literal] # must happen first
|
11
|
-
self.subject = attr[:subject]
|
12
|
-
@predicate = attr[:predicate]
|
13
|
-
self.object = attr[:object]
|
14
|
-
@data_type = attr[:data_type]
|
15
|
-
end
|
16
|
-
|
17
|
-
def subject=(subject)
|
18
|
-
@subject = generate_uri(subject)
|
19
|
-
end
|
20
|
-
|
21
|
-
def subject_pid=(pid)
|
22
|
-
@subject = "info:fedora/#{pid}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def object=(object)
|
26
|
-
@object = (is_literal)? object : generate_uri(object)
|
27
|
-
end
|
28
|
-
|
29
|
-
def object_pid=(pid)
|
30
|
-
@object = "info:fedora/#{pid}"
|
31
|
-
end
|
32
|
-
|
33
|
-
def generate_uri(input)
|
34
|
-
if input.class == Symbol || input == nil
|
35
|
-
return input
|
36
|
-
elsif input.is_a? URI::Generic
|
37
|
-
return input.to_s
|
38
|
-
elsif input.respond_to?(:pid)
|
39
|
-
return "info:fedora/#{input.pid}"
|
40
|
-
else
|
41
|
-
input.include?("info:fedora") ? input : "info:fedora/#{input}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ActiveFedora::DCRDFDatastream do
|
4
|
-
before do
|
5
|
-
class RdfTest < ActiveFedora::Base
|
6
|
-
has_metadata :name=>'rdf', :type=>ActiveFedora::DCRDFDatastream
|
7
|
-
delegate :description, :to=>'rdf'
|
8
|
-
delegate :title, :to=>'rdf', :unique=>true
|
9
|
-
end
|
10
|
-
@subject = RdfTest.new
|
11
|
-
end
|
12
|
-
|
13
|
-
after do
|
14
|
-
Object.send(:remove_const, :RdfTest)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should set and recall values" do
|
18
|
-
@subject.title = 'War and Peace'
|
19
|
-
@subject.save
|
20
|
-
|
21
|
-
loaded = RdfTest.find(@subject.pid)
|
22
|
-
loaded.title.should == 'War and Peace'
|
23
|
-
end
|
24
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe ActiveFedora::DCRDFDatastream do
|
4
|
-
|
5
|
-
describe "an instance with content" do
|
6
|
-
before do
|
7
|
-
@subject = ActiveFedora::DCRDFDatastream.new(@inner_object, 'dc_rdf')
|
8
|
-
@subject.content = File.new('spec/fixtures/dublin_core_rdf_descMetadata.nt').read
|
9
|
-
@subject.stubs(:pid => 'test:1')
|
10
|
-
@subject.stubs(:new? => false)
|
11
|
-
end
|
12
|
-
it "should have controlGroup" do
|
13
|
-
@subject.controlGroup.should == 'M'
|
14
|
-
end
|
15
|
-
it "should have mimeType" do
|
16
|
-
@subject.mimeType.should == 'text/plain'
|
17
|
-
end
|
18
|
-
it "should have dsid" do
|
19
|
-
@subject.dsid.should == 'dc_rdf'
|
20
|
-
end
|
21
|
-
it "should have fields" do
|
22
|
-
@subject.publisher.should == ["Penn State"]
|
23
|
-
end
|
24
|
-
it "should have method missing" do
|
25
|
-
lambda{@subject.frank}.should raise_exception NoMethodError
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should set fields" do
|
29
|
-
@subject.publisher= "St. Martin's Press"
|
30
|
-
@subject.publisher.should == ["St. Martin's Press"]
|
31
|
-
end
|
32
|
-
it "should append fields" do
|
33
|
-
@subject.append(RDF::DC.publisher, "St. Martin's Press")
|
34
|
-
@subject.publisher.should == ["Penn State", "St. Martin's Press"]
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "a new instance" do
|
40
|
-
before do
|
41
|
-
@subject = ActiveFedora::DCRDFDatastream.new(@inner_object, 'dc_rdf')
|
42
|
-
@subject.stubs(:pid => 'test:1')
|
43
|
-
end
|
44
|
-
it "should save and reload" do
|
45
|
-
@subject.publisher= ["St. Martin's Press"]
|
46
|
-
@subject.save
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require 'active_fedora'
|
4
|
-
require 'active_fedora/relationship'
|
5
|
-
require "rexml/document"
|
6
|
-
require 'mocha'
|
7
|
-
require 'uri'
|
8
|
-
|
9
|
-
include Mocha::API
|
10
|
-
|
11
|
-
describe ActiveFedora::Relationship do
|
12
|
-
|
13
|
-
%/
|
14
|
-
module ModelSpec
|
15
|
-
class AudioRecord
|
16
|
-
include ActiveFedora::Model
|
17
|
-
|
18
|
-
relationship "parents", :is_part_of, [nil, :oral_history]
|
19
|
-
end
|
20
|
-
|
21
|
-
class OralHistory
|
22
|
-
include ActiveFedora::Model
|
23
|
-
|
24
|
-
relationship "parts", :is_part_of, [:audio_record], :inbound => true
|
25
|
-
end
|
26
|
-
/%
|
27
|
-
before(:each) do
|
28
|
-
ActiveSupport::Deprecation.expects(:warn).with("ActiveFedora::Releationship is deprecated and will be removed in the next release").twice
|
29
|
-
|
30
|
-
@test_relationship = ActiveFedora::Relationship.new
|
31
|
-
@test_literal = ActiveFedora::Relationship.new(:is_literal=>true)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should provide #new" do
|
35
|
-
ActiveFedora::Relationship.should respond_to(:new)
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "#new" do
|
39
|
-
ActiveSupport::Deprecation.expects(:warn).with("ActiveFedora::Releationship is deprecated and will be removed in the next release").twice
|
40
|
-
test_relationship = ActiveFedora::Relationship.new(:subject => "demo:5", :predicate => "isMemberOf", :object => "demo:10")
|
41
|
-
|
42
|
-
test_relationship.subject.should == "info:fedora/demo:5"
|
43
|
-
test_relationship.predicate.should == "isMemberOf"
|
44
|
-
test_relationship.object.should == "info:fedora/demo:10"
|
45
|
-
test_relationship.is_literal.should == false
|
46
|
-
test_literal = ActiveFedora::Relationship.new(:is_literal=>true)
|
47
|
-
test_literal.is_literal.should == true
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "#subject=" do
|
51
|
-
it "should turn strings into fedora URIs" do
|
52
|
-
@test_relationship.subject = "demo:6"
|
53
|
-
@test_relationship.subject.should == "info:fedora/demo:6"
|
54
|
-
@test_relationship.subject = "info:fedora/demo:7"
|
55
|
-
@test_relationship.subject.should == "info:fedora/demo:7"
|
56
|
-
end
|
57
|
-
it "should use the pid of the passed object if it responds to #pid" do
|
58
|
-
mock_fedora_object = stub("mock_fedora_object", :pid => "demo:stub_pid")
|
59
|
-
@test_relationship.subject = mock_fedora_object
|
60
|
-
@test_relationship.subject.should == "info:fedora/#{mock_fedora_object.pid}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "#object=" do
|
65
|
-
it "should turn strings into Fedora URIs" do
|
66
|
-
@test_relationship.object = "demo:11"
|
67
|
-
@test_relationship.object.should == "info:fedora/demo:11"
|
68
|
-
end
|
69
|
-
it "should use the pid of the passed object if it responds to #pid" do
|
70
|
-
mock_fedora_object = stub("mock_fedora_object", :pid => "demo:stub_pid")
|
71
|
-
@test_relationship.object = mock_fedora_object
|
72
|
-
@test_relationship.object.should == "info:fedora/#{mock_fedora_object.pid}"
|
73
|
-
end
|
74
|
-
it "should let URI objects stringify themselves" do
|
75
|
-
@test_relationship.object = URI.parse("http://projecthydra.org")
|
76
|
-
@test_relationship.object.should == "http://projecthydra.org"
|
77
|
-
end
|
78
|
-
it "should not turn literal property objects into Fedora URIs" do
|
79
|
-
@test_literal.object = "foo"
|
80
|
-
@test_literal.object.should == "foo"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe "#predicate=" do
|
85
|
-
it "should default to setting the argument itself as the new subject" do
|
86
|
-
@test_relationship.predicate = "isComponentOf"
|
87
|
-
@test_relationship.predicate.should == "isComponentOf"
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
end
|