active-fedora 6.6.0.rc5 → 6.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +17 -3
- data/lib/active_fedora/associations.rb +2 -1
- data/lib/active_fedora/base.rb +1 -5
- data/lib/active_fedora/indexing.rb +1 -1
- data/lib/active_fedora/nested_attributes.rb +9 -0
- data/lib/active_fedora/predicates.rb +13 -0
- data/lib/active_fedora/relationship_graph.rb +25 -18
- data/lib/active_fedora/rels_ext_datastream.rb +1 -15
- data/lib/active_fedora/semantic_node.rb +1 -1
- data/lib/active_fedora/unsaved_digital_object.rb +1 -1
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/associations_spec.rb +51 -5
- data/spec/integration/nested_attribute_spec.rb +4 -0
- data/spec/integration/ntriples_datastream_spec.rb +1 -1
- data/spec/unit/base_extra_spec.rb +1 -1
- data/spec/unit/base_spec.rb +4 -4
- data/spec/unit/datastream_spec.rb +1 -1
- data/spec/unit/predicates_spec.rb +26 -1
- data/spec/unit/relationship_graph_spec.rb +5 -5
- data/spec/unit/rels_ext_datastream_spec.rb +0 -24
- data/spec/unit/semantic_node_spec.rb +3 -3
- data/spec/unit/solr_config_options_spec.rb +2 -1
- data/spec/unit/unsaved_digital_object_spec.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef5496bb9123668b10de796159b394a50a1ec1da
|
4
|
+
data.tar.gz: 70b9bf4b2d64f1f0a6ffd3b5eb81dca852f47cd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87b4be4a4d26c6424cdfa4d7ca73981760fa36d9f91b3e62ecf8396153ee581914f594cdb9a4edaaca1c73f52332ffba2b78af3f0dd57bee176add2e0381d1c
|
7
|
+
data.tar.gz: 15f245fddca1d9fb480cca04e41708e4e2fc1ec8cecd23409346101295bedecd286517e55b19d1420ba4511d076842f141d1171f9d16198b5ff6b3d9d3a11bc6
|
data/History.txt
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
v6.6.0
|
1
|
+
v6.6.0
|
2
|
+
Add _destroy method for building nested forms [Justin Coyne]
|
3
|
+
Removed the pid placeholder `__DO_NOT_USE__` [Justin Coyne]
|
4
|
+
Allow relationships to accept instances of RDF::URI as their predicates [Justin Coyne]
|
5
|
+
Remove internal deprecation [Justin Coyne]
|
2
6
|
Gracefully handle an ObjectNotFound in find_all [Justin Coyne]
|
3
7
|
Revert "Removed unused code that breaks certain use cases (Fixes #234)." [Jeremy Friesen]
|
4
8
|
Removed unset opts parameter from call to reify_solr_results, introduced in PR #236. [David Chandek-Stark]
|
@@ -7,7 +11,18 @@ Fix deprecation warning when using the ids setter of a has_many collection relat
|
|
7
11
|
Fix deprecation warning when loading a has_many association [Justin Coyne]
|
8
12
|
Explicitly set cast to false on reload to avoid deprecation warnings [Justin Coyne]
|
9
13
|
Cast relationship results if class is ActiveFedora::Base [Justin Coyne]
|
10
|
-
|
14
|
+
Adding a loop for getting more than solr_page_size (default 200) results in an has and belongs to many association [Carolyn Cole]
|
15
|
+
Fixed syntax error on hash [Justin Coyne]
|
16
|
+
Set cast parameter to avoid a deprecation warning [Justin Coyne]
|
17
|
+
Only deprecate the cast parameter to find when on ActiveFedora::Base [Justin Coyne]
|
18
|
+
Deprecate .find's cast default option [Jeremy Friesen]
|
19
|
+
Remove outdated fixture loading line from README. [Steven Anderson]
|
20
|
+
Support for extended cmodels (read-only) [Steven Anderson]
|
21
|
+
Fix tense on deprecation warning [Steven Anderson]
|
22
|
+
Fix tense on deprecation warning [Justin Coyne]
|
23
|
+
delegate and delegate_to should use 'multiple' rather than 'unique'. Ref #147 [Justin Coyne]
|
24
|
+
Deprecated find(:all), find(:first), find(:last) [Justin Coyne]
|
25
|
+
Prevent infinite loop when Fedora and Solr are out of sync (fixes #199) [Michael B. Klein]
|
11
26
|
|
12
27
|
v6.5.1 (2013-09-10)
|
13
28
|
|
@@ -74,7 +89,6 @@ An rdf node should be able to set rdf:about [Justin Coyne]
|
|
74
89
|
|
75
90
|
Remove RdfObject#get_values, it's inherited [Justin Coyne]
|
76
91
|
|
77
|
-
|
78
92
|
v6.4.4 (2013-07-29)
|
79
93
|
|
80
94
|
Bumping to version 6.4.4 [Jeremy Friesen]
|
@@ -227,7 +227,8 @@ module ActiveFedora
|
|
227
227
|
end
|
228
228
|
|
229
229
|
redefine_method("#{reflection.name}_id=") do |new_value|
|
230
|
-
|
230
|
+
options = reflection.klass == ActiveFedora::Base ? {cast: true} : {}
|
231
|
+
obj = new_value.blank? ? nil : reflection.klass.find(new_value, options)
|
231
232
|
send("#{reflection.name}=", obj)
|
232
233
|
end
|
233
234
|
redefine_method("#{reflection.name}_id") do
|
data/lib/active_fedora/base.rb
CHANGED
@@ -71,11 +71,6 @@ module ActiveFedora
|
|
71
71
|
@marked_for_destruction
|
72
72
|
end
|
73
73
|
|
74
|
-
def reload(options = nil)
|
75
|
-
@marked_for_destruction = false
|
76
|
-
super
|
77
|
-
end
|
78
|
-
|
79
74
|
# Constructor. You may supply a custom +:pid+, or we call the Fedora Rest API for the
|
80
75
|
# next available Fedora pid, and mark as new object.
|
81
76
|
# Also, if +attrs+ does not contain +:pid+ but does contain +:namespace+ it will pass the
|
@@ -96,6 +91,7 @@ module ActiveFedora
|
|
96
91
|
|
97
92
|
# Reloads the object from Fedora.
|
98
93
|
def reload
|
94
|
+
raise ActiveFedora::ObjectNotFoundError, "Can't reload an object that hasn't been saved" unless persisted?
|
99
95
|
clear_association_cache
|
100
96
|
init_with(self.class.find(self.pid, cast: false).inner_object)
|
101
97
|
end
|
@@ -49,7 +49,7 @@ module ActiveFedora
|
|
49
49
|
# @param [Hash] solr_doc @deafult an empty Hash
|
50
50
|
def solrize_relationships(solr_doc = Hash.new)
|
51
51
|
relationships.each_statement do |statement|
|
52
|
-
predicate =
|
52
|
+
predicate = Predicates.short_predicate(statement.predicate)
|
53
53
|
literal = statement.object.kind_of?(RDF::Literal)
|
54
54
|
val = literal ? statement.object.value : statement.object.to_str
|
55
55
|
::Solrizer::Extractor.insert_solr_field_value(solr_doc, solr_name(predicate, :symbol), val )
|
@@ -92,6 +92,15 @@ module ActiveFedora
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
# Returns ActiveFedora::Base#marked_for_destruction? It's
|
96
|
+
# used in conjunction with fields_for to build a form element for the
|
97
|
+
# destruction of this association.
|
98
|
+
#
|
99
|
+
# See ActionView::Helpers::FormHelper::fields_for for more info.
|
100
|
+
def _destroy
|
101
|
+
marked_for_destruction?
|
102
|
+
end
|
103
|
+
|
95
104
|
private
|
96
105
|
|
97
106
|
# Attribute hash keys that should not be assigned as normal attributes.
|
@@ -1,5 +1,18 @@
|
|
1
1
|
module ActiveFedora
|
2
2
|
module Predicates
|
3
|
+
def self.short_predicate(predicate)
|
4
|
+
# for this regex to short-circuit correctly, namespaces must be sorted into descending order by length
|
5
|
+
if match = /^(#{Predicates.predicate_mappings.keys.sort.reverse.join('|')})(.+)$/.match(predicate.to_str)
|
6
|
+
namespace = match[1]
|
7
|
+
predicate = match[2]
|
8
|
+
Predicates.predicate_mappings[namespace].invert[predicate]
|
9
|
+
elsif predicate.kind_of? RDF::URI
|
10
|
+
predicate.to_s.split('/', 4).last.gsub(/(\/|#)/, '_').underscore
|
11
|
+
else
|
12
|
+
raise "Unable to parse predicate: #{predicate}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
3
16
|
def self.find_graph_predicate(predicate)
|
4
17
|
#TODO, these could be cached
|
5
18
|
case predicate
|
@@ -10,44 +10,47 @@ module ActiveFedora
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def has_predicate?(predicate)
|
13
|
-
relationships.has_key? predicate
|
13
|
+
relationships.has_key? uri_predicate(predicate)
|
14
14
|
end
|
15
15
|
|
16
16
|
def add(predicate, object, literal=false)
|
17
|
-
|
18
|
-
|
17
|
+
uri = uri_predicate(predicate)
|
18
|
+
unless has_predicate? uri
|
19
|
+
relationships[uri] = []
|
19
20
|
end
|
20
21
|
object = RDF::Literal.new(object) if literal
|
21
|
-
unless relationships[
|
22
|
+
unless relationships[uri].include?(object)
|
22
23
|
@dirty = true
|
23
|
-
relationships[
|
24
|
+
relationships[uri] << object
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
# Remove the statement matching the predicate and object
|
28
|
-
# [
|
29
|
-
#
|
29
|
+
# @param predicate [Symbol, URI] the predicate to delete
|
30
|
+
# @param object the object to delete, if nil, all statements with this predicate are deleted.
|
30
31
|
def delete(predicate, object = nil)
|
31
|
-
|
32
|
+
uri = uri_predicate(predicate)
|
33
|
+
return unless has_predicate? uri
|
32
34
|
if object.nil?
|
33
35
|
@dirty = true
|
34
|
-
relationships.delete(
|
36
|
+
relationships.delete(uri)
|
35
37
|
return
|
36
38
|
end
|
37
|
-
if relationships[
|
39
|
+
if relationships[uri].include?(object)
|
38
40
|
@dirty = true
|
39
|
-
relationships[
|
41
|
+
relationships[uri].delete(object)
|
40
42
|
end
|
41
|
-
if object.respond_to?(:internal_uri) && relationships[
|
43
|
+
if object.respond_to?(:internal_uri) && relationships[uri].include?(object.internal_uri)
|
42
44
|
@dirty = true
|
43
|
-
relationships[
|
45
|
+
relationships[uri].delete(object.internal_uri)
|
44
46
|
elsif object.is_a? String
|
45
|
-
relationships[
|
47
|
+
relationships[uri].delete_if{|obj| obj.respond_to?(:internal_uri) && obj.internal_uri == object}
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
51
|
def [](predicate)
|
50
|
-
|
52
|
+
uri = uri_predicate(predicate)
|
53
|
+
relationships[uri]
|
51
54
|
end
|
52
55
|
|
53
56
|
def to_graph(subject_uri)
|
@@ -65,7 +68,7 @@ module ActiveFedora
|
|
65
68
|
|
66
69
|
# Create an RDF statement
|
67
70
|
# @param uri a string represending the subject
|
68
|
-
# @param predicate a predicate
|
71
|
+
# @param predicate [Symbol, URI] a predicate
|
69
72
|
# @param target an object to store
|
70
73
|
def build_statement(uri, predicate, target)
|
71
74
|
raise "Not allowed anymore" if uri == :self
|
@@ -87,10 +90,14 @@ module ActiveFedora
|
|
87
90
|
end
|
88
91
|
object = RDF::URI.new(target)
|
89
92
|
end
|
90
|
-
|
91
|
-
RDF::Statement.new(subject, predicate, object)
|
93
|
+
RDF::Statement.new(subject, uri_predicate(predicate), object)
|
92
94
|
|
93
95
|
end
|
94
96
|
|
97
|
+
def uri_predicate(predicate)
|
98
|
+
return predicate if predicate.kind_of? RDF::URI
|
99
|
+
ActiveFedora::Predicates.find_graph_predicate(predicate)
|
100
|
+
end
|
101
|
+
|
95
102
|
end
|
96
103
|
end
|
@@ -52,9 +52,8 @@ module ActiveFedora
|
|
52
52
|
RDF::RDFXML::Reader.new(xml) do |reader|
|
53
53
|
reader.each_statement do |statement|
|
54
54
|
literal = statement.object.kind_of?(RDF::Literal)
|
55
|
-
predicate = self.short_predicate(statement.predicate)
|
56
55
|
object = literal ? statement.object.value : statement.object.to_str
|
57
|
-
tmpl.model.add_relationship(predicate, object, literal)
|
56
|
+
tmpl.model.add_relationship(statement.predicate, object, literal)
|
58
57
|
end
|
59
58
|
end
|
60
59
|
tmpl.relationships_are_not_dirty!
|
@@ -91,19 +90,6 @@ module ActiveFedora
|
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
94
|
-
def self.short_predicate(predicate)
|
95
|
-
# for this regex to short-circuit correctly, namespaces must be sorted into descending order by length
|
96
|
-
if match = /^(#{Predicates.predicate_mappings.keys.sort.reverse.join('|')})(.+)$/.match(predicate.to_str)
|
97
|
-
namespace = match[1]
|
98
|
-
predicate = match[2]
|
99
|
-
pred = Predicates.predicate_mappings[namespace].invert[predicate]
|
100
|
-
pred
|
101
|
-
else
|
102
|
-
raise "Unable to parse predicate: #{predicate}"
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
93
|
# ** EXPERIMENTAL **
|
108
94
|
#
|
109
95
|
# This is utilized by ActiveFedora::Base.load_instance_from_solr to load
|
@@ -23,7 +23,7 @@ module ActiveFedora
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# Add a relationship to the Object.
|
26
|
-
# @param predicate
|
26
|
+
# @param predicate [Symbol] The short version of the predicate
|
27
27
|
# @param target Either a string URI or an object that is a kind of ActiveFedora::Base
|
28
28
|
def add_relationship(predicate, target, literal=false)
|
29
29
|
object_relations.add(predicate, target, literal)
|
@@ -4,7 +4,7 @@ module ActiveFedora
|
|
4
4
|
include DigitalObject::DatastreamBootstrap
|
5
5
|
attr_accessor :original_class, :ownerId, :state, :datastreams, :label, :namespace
|
6
6
|
|
7
|
-
PLACEHOLDER =
|
7
|
+
PLACEHOLDER = nil
|
8
8
|
|
9
9
|
def initialize(original_class, namespace, pid=nil)
|
10
10
|
@pid = pid
|
@@ -1,6 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActiveFedora::Base do
|
4
|
+
describe "use a URI as the property" do
|
5
|
+
before do
|
6
|
+
class Book < ActiveFedora::Base
|
7
|
+
belongs_to :author, :property=>RDF::DC.creator, :class_name=>'Person'
|
8
|
+
end
|
9
|
+
|
10
|
+
class Person < ActiveFedora::Base
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
Object.send(:remove_const, :Book)
|
16
|
+
Object.send(:remove_const, :Person)
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:person) { Person.create}
|
20
|
+
let(:book) { Book.new(author: person) }
|
21
|
+
|
22
|
+
it "should go" do
|
23
|
+
book.save
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
4
28
|
describe "complex example" do
|
5
29
|
before do
|
6
30
|
class Library < ActiveFedora::Base
|
@@ -473,6 +497,32 @@ describe ActiveFedora::Base do
|
|
473
497
|
end
|
474
498
|
end
|
475
499
|
|
500
|
+
describe "belongs_to when class_name is ActiveFedora::Base" do
|
501
|
+
before :all do
|
502
|
+
class Textbook < ActiveFedora::Base
|
503
|
+
belongs_to :container, :property=>:is_part_of, :class_name=>'ActiveFedora::Base'
|
504
|
+
end
|
505
|
+
class Shelf < ActiveFedora::Base; end
|
506
|
+
end
|
507
|
+
|
508
|
+
after :all do
|
509
|
+
Object.send(:remove_const, :Textbook)
|
510
|
+
Object.send(:remove_const, :Shelf)
|
511
|
+
end
|
512
|
+
|
513
|
+
after do
|
514
|
+
shelf.destroy
|
515
|
+
end
|
516
|
+
|
517
|
+
let(:shelf) { Shelf.create}
|
518
|
+
subject { Textbook.new }
|
519
|
+
|
520
|
+
it "Should not raise a deprecation message" do
|
521
|
+
Deprecation.should_not_receive(:warn) # a deprecation in 6.6.0 that's going away in 7.0.0
|
522
|
+
subject.container_id = shelf.id
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
476
526
|
describe "single direction habtm" do
|
477
527
|
before :all do
|
478
528
|
class Course < ActiveFedora::Base
|
@@ -801,10 +851,6 @@ describe ActiveFedora::Base do
|
|
801
851
|
@simple_collection = SimpleCollection.create
|
802
852
|
@complex_collection = ComplexCollection.create
|
803
853
|
|
804
|
-
#Need to add the simpler cmodel here as currently inheritance support is read-only.
|
805
|
-
#See ActiveFedora pull request 207 on how to do this programmatically.
|
806
|
-
@complex_collection.add_relationship(:has_model, @complex_object.class.superclass.to_class_uri)
|
807
|
-
|
808
854
|
@simple_object = SimpleObject.create
|
809
855
|
@simple_object_second = SimpleObject.create
|
810
856
|
@complex_object = ComplexObject.create
|
@@ -860,4 +906,4 @@ describe ActiveFedora::Base do
|
|
860
906
|
end
|
861
907
|
end
|
862
908
|
end
|
863
|
-
end
|
909
|
+
end
|
@@ -147,8 +147,8 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
it "should write rdf with proper subjects" do
|
150
|
-
@subject.rdf.type = "Frog"
|
151
150
|
@subject.inner_object.pid = 'test:99'
|
151
|
+
@subject.rdf.type = "Frog"
|
152
152
|
@subject.save!
|
153
153
|
@subject.reload
|
154
154
|
@subject.rdf.graph.dump(:ntriples).should == "<http://oregondigital.org/ns/99> <http://purl.org/dc/terms/type> \"Frog\" .\n"
|
@@ -60,7 +60,7 @@ describe ActiveFedora::Base do
|
|
60
60
|
it "should delete object from repository and index" do
|
61
61
|
@test_object.inner_object.stub(:delete)
|
62
62
|
mock_conn = double("SolrConnection")
|
63
|
-
mock_conn.should_receive(:delete_by_id).with(
|
63
|
+
mock_conn.should_receive(:delete_by_id).with(nil)
|
64
64
|
mock_conn.should_receive(:commit)
|
65
65
|
mock_ss = double("SolrService")
|
66
66
|
mock_ss.stub(:conn).and_return(mock_conn)
|
data/spec/unit/base_spec.rb
CHANGED
@@ -202,10 +202,9 @@ describe ActiveFedora::Base do
|
|
202
202
|
|
203
203
|
### Methods for ActiveModel::Conversions
|
204
204
|
it "should have to_param once it's saved" do
|
205
|
-
|
206
205
|
@test_object.to_param.should be_nil
|
207
|
-
@test_object.inner_object.stub(:new? => false)
|
208
|
-
@test_object.to_param.should ==
|
206
|
+
@test_object.inner_object.stub(:new? => false, :pid => 'foo:123')
|
207
|
+
@test_object.to_param.should == 'foo:123'
|
209
208
|
end
|
210
209
|
|
211
210
|
it "should have to_key once it's saved" do
|
@@ -448,12 +447,13 @@ describe ActiveFedora::Base do
|
|
448
447
|
it "should add pid, system_create_date, system_modified_date and object_state from object attributes" do
|
449
448
|
@test_object.should_receive(:create_date).and_return("2012-03-04T03:12:02Z")
|
450
449
|
@test_object.should_receive(:modified_date).and_return("2012-03-07T03:12:02Z")
|
450
|
+
@test_object.stub(pid: 'changeme:123')
|
451
451
|
@test_object.state = "D"
|
452
452
|
solr_doc = @test_object.to_solr
|
453
453
|
solr_doc[ActiveFedora::SolrService.solr_name("system_create", :stored_sortable, type: :date)].should eql("2012-03-04T03:12:02Z")
|
454
454
|
solr_doc[ActiveFedora::SolrService.solr_name("system_modified", :stored_sortable, type: :date)].should eql("2012-03-07T03:12:02Z")
|
455
455
|
solr_doc[ActiveFedora::SolrService.solr_name("object_state", :stored_sortable)].should eql("D")
|
456
|
-
solr_doc[:id].should eql("
|
456
|
+
solr_doc[:id].should eql("changeme:123")
|
457
457
|
end
|
458
458
|
|
459
459
|
it "should omit base metadata and RELS-EXT if :model_only==true" do
|
@@ -19,7 +19,7 @@ describe ActiveFedora::Datastream do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should be inspectable" do
|
22
|
-
@test_datastream.inspect.should match /#<ActiveFedora::Datastream @pid=\"
|
22
|
+
@test_datastream.inspect.should match /#<ActiveFedora::Datastream @pid=\"\" @dsid=\"abcd\" @controlGroup=\"M\" changed=\"true\" @mimeType=\"\" >/
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#validate_content_present' do
|
@@ -1,7 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
3
|
describe ActiveFedora::Predicates do
|
4
|
+
describe "#short_predicate" do
|
5
|
+
it 'should parse strings' do
|
6
|
+
ActiveFedora::Predicates.short_predicate('http://www.openarchives.org/OAI/2.0/itemID').should == :oai_item_id
|
7
|
+
end
|
8
|
+
it 'should parse uris' do
|
9
|
+
ActiveFedora::Predicates.short_predicate(RDF::DC.creator).should == 'dc_terms_creator'
|
10
|
+
ActiveFedora::Predicates.short_predicate(RDF::SKOS.hasTopConcept).should == '2004_02_skos_core_has_top_concept'
|
11
|
+
end
|
12
|
+
before(:all) do
|
13
|
+
@original_mapping = ActiveFedora::Predicates.predicate_config[:predicate_mapping]
|
14
|
+
end
|
15
|
+
after(:all) do
|
16
|
+
ActiveFedora::Predicates.predicate_config[:predicate_mapping] = @original_mapping
|
17
|
+
end
|
18
|
+
it "should find predicates regardless of order loaded or shared namespace prefixes" do
|
19
|
+
ActiveFedora::Predicates.predicate_config[:predicate_mapping] = {
|
20
|
+
"http://example.org/"=>{:ceo => 'Manager'},
|
21
|
+
"http://example.org/zoo/wolves/"=>{:alpha => 'Manager'},
|
22
|
+
"http://example.org/zoo/"=>{:keeper => 'Manager'}
|
23
|
+
}
|
24
|
+
ActiveFedora::Predicates.short_predicate("http://example.org/zoo/Manager").should == :keeper
|
25
|
+
ActiveFedora::Predicates.short_predicate("http://example.org/zoo/wolves/Manager").should == :alpha
|
26
|
+
ActiveFedora::Predicates.short_predicate("http://example.org/Manager").should == :ceo
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
5
30
|
it 'should provide .default_predicate_namespace' do
|
6
31
|
ActiveFedora::Predicates.default_predicate_namespace.should == 'info:fedora/fedora-system:def/relations-external#'
|
7
32
|
end
|
@@ -13,8 +13,8 @@ describe ActiveFedora::RelationshipGraph do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should initialize new relation keys" do
|
16
|
-
@graph[:
|
17
|
-
@graph[:
|
16
|
+
@graph[:has_description].should be_empty
|
17
|
+
@graph[:has_description].should respond_to(:<<)
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -22,11 +22,11 @@ describe ActiveFedora::RelationshipGraph do
|
|
22
22
|
it "should add relationships" do
|
23
23
|
@n2 = ActiveFedora::Base.new
|
24
24
|
@graph.add(:has_part, @n1)
|
25
|
-
@graph
|
25
|
+
@graph[:has_part].should == [@n1]
|
26
26
|
@graph.add(:has_part, @n2)
|
27
|
-
@graph
|
27
|
+
@graph[:has_part].should == [@n1, @n2]
|
28
28
|
@graph.add(:has_part, @n2)
|
29
|
-
@graph
|
29
|
+
@graph[:has_part].should == [@n1, @n2]
|
30
30
|
@graph.dirty.should be_true
|
31
31
|
end
|
32
32
|
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActiveFedora::RelsExtDatastream do
|
4
|
-
describe "short_predicate" do
|
5
|
-
it 'should parse' do
|
6
|
-
ActiveFedora::RelsExtDatastream.short_predicate('http://www.openarchives.org/OAI/2.0/itemID').should == :oai_item_id
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
4
|
before(:all) do
|
11
5
|
@pid = "test:sample_pid"
|
12
6
|
|
@@ -172,22 +166,4 @@ describe ActiveFedora::RelsExtDatastream do
|
|
172
166
|
end
|
173
167
|
end
|
174
168
|
|
175
|
-
describe "#short_predicate" do
|
176
|
-
before(:all) do
|
177
|
-
@original_mapping = ActiveFedora::Predicates.predicate_config[:predicate_mapping]
|
178
|
-
end
|
179
|
-
after(:all) do
|
180
|
-
ActiveFedora::Predicates.predicate_config[:predicate_mapping] = @original_mapping
|
181
|
-
end
|
182
|
-
it "should find predicates regardless of order loaded or shared namespace prefixes" do
|
183
|
-
ActiveFedora::Predicates.predicate_config[:predicate_mapping] = {
|
184
|
-
"http://example.org/"=>{:ceo => 'Manager'},
|
185
|
-
"http://example.org/zoo/wolves/"=>{:alpha => 'Manager'},
|
186
|
-
"http://example.org/zoo/"=>{:keeper => 'Manager'}
|
187
|
-
}
|
188
|
-
ActiveFedora::RelsExtDatastream.short_predicate("http://example.org/zoo/Manager").should == :keeper
|
189
|
-
ActiveFedora::RelsExtDatastream.short_predicate("http://example.org/zoo/wolves/Manager").should == :alpha
|
190
|
-
ActiveFedora::RelsExtDatastream.short_predicate("http://example.org/Manager").should == :ceo
|
191
|
-
end
|
192
|
-
end
|
193
169
|
end
|
@@ -90,7 +90,7 @@ describe ActiveFedora::SemanticNode do
|
|
90
90
|
it "should not be written into the graph until it is saved" do
|
91
91
|
@n1 = ActiveFedora::Base.new
|
92
92
|
@node.add_relationship(:has_part, @n1)
|
93
|
-
@node.relationships.statements.to_a.first.object.to_s.should == 'info:fedora/
|
93
|
+
@node.relationships.statements.to_a.first.object.to_s.should == 'info:fedora/'
|
94
94
|
@n1.save
|
95
95
|
@node.relationships.statements.to_a.first.object.to_s.should == @n1.internal_uri
|
96
96
|
end
|
@@ -117,12 +117,12 @@ describe ActiveFedora::SemanticNode do
|
|
117
117
|
before do
|
118
118
|
@node.add_relationship(:is_member_of, 'demo:9')
|
119
119
|
@node.add_relationship(:is_member_of, 'demo:7')
|
120
|
-
@node.add_relationship(:
|
120
|
+
@node.add_relationship(:has_description, 'demo:9')
|
121
121
|
end
|
122
122
|
it "should clear the specified relationship" do
|
123
123
|
@node.clear_relationship(:is_member_of)
|
124
124
|
@node.relationships(:is_member_of).should == []
|
125
|
-
@node.relationships(:
|
125
|
+
@node.relationships(:has_description).should == ['demo:9']
|
126
126
|
end
|
127
127
|
|
128
128
|
end
|
@@ -27,8 +27,9 @@ describe ActiveFedora do
|
|
27
27
|
SOLR_DOCUMENT_ID = "id"
|
28
28
|
end
|
29
29
|
it "should be used by ActiveFedora::Base.to_solr" do
|
30
|
+
@test_object.stub(pid: 'changeme:123')
|
30
31
|
SOLR_DOCUMENT_ID = "MY_SAMPLE_ID"
|
31
|
-
@test_object.to_solr[SOLR_DOCUMENT_ID.to_sym].
|
32
|
+
@test_object.to_solr[SOLR_DOCUMENT_ID.to_sym].should == 'changeme:123'
|
32
33
|
@test_object.to_solr[:id].should be_nil
|
33
34
|
end
|
34
35
|
|
@@ -16,8 +16,8 @@ describe ActiveFedora::UnsavedDigitalObject do
|
|
16
16
|
@obj.ownerId.should == 'D'
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should have a default pid" do
|
20
|
-
@obj.pid.should
|
19
|
+
it "should not have a default pid" do
|
20
|
+
@obj.pid.should be_nil
|
21
21
|
end
|
22
22
|
it "should be able to set the pid" do
|
23
23
|
@obj.pid = "my:new_object"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.6.0
|
4
|
+
version: 6.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-10-
|
13
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsolr
|
@@ -550,9 +550,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
550
550
|
version: 1.9.3
|
551
551
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
552
552
|
requirements:
|
553
|
-
- - '
|
553
|
+
- - '>='
|
554
554
|
- !ruby/object:Gem::Version
|
555
|
-
version:
|
555
|
+
version: '0'
|
556
556
|
requirements: []
|
557
557
|
rubyforge_project:
|
558
558
|
rubygems_version: 2.0.5
|