active-fedora 5.5.0.rc2 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,4 @@
1
- 5.5.0 (Unreleased)
1
+ 5.5.0
2
2
  Added support for complex rdf structures.
3
3
  Changed RdfDatastream to_solr so that it uses the dsid as the solr prefix, not the datastream class name
4
4
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency('rsolr')
19
19
  s.add_dependency('om', '~> 1.8.0')
20
20
  s.add_dependency('nom-xml', '>=0.5.1')
21
- s.add_dependency('solrizer', '~>2.1.0.rc1')
21
+ s.add_dependency('solrizer', '~>2.1.0')
22
22
  s.add_dependency("activeresource", '>= 3.0.0')
23
23
  s.add_dependency("activesupport", '>= 3.0.0')
24
24
  s.add_dependency("builder", '~> 3.0.0')
@@ -16,7 +16,7 @@ module ActiveFedora
16
16
  # Register a ruby block that evaluates to the subject of the graph
17
17
  # By default, the block returns the current object's pid
18
18
  # @yield [ds] 'ds' is the datastream instance
19
- # This should override the method in rdf_object, which just creates a b-node by default
19
+ # This should override the method in RdfObject, which just creates a b-node by default
20
20
  def rdf_subject &block
21
21
  if block_given?
22
22
  return @subject_block = block
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "5.5.0.rc2"
2
+ VERSION = "5.5.0"
3
3
  end
@@ -0,0 +1,38 @@
1
+ <rdf:RDF
2
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
3
+ xmlns:dams="http://library.ucsd.edu/ontology/dams#"
4
+ xmlns:mads="http://www.loc.gov/mads/rdf/v1#"
5
+ xmlns:damsid="http://library.ucsd.edu/ark:/20775/">
6
+ <dams:Object rdf:about="http://library.ucsd.edu/ark:/20775/">
7
+ <dams:title rdf:parseType="Resource">
8
+ <rdf:value>example title</rdf:value>
9
+ <dams:relatedTitle rdf:parseType="Resource">
10
+ <rdf:value xml:lang="fr">example translated relatedTitle</rdf:value>
11
+ <dams:type>translated</dams:type>
12
+ </dams:relatedTitle>
13
+ </dams:title>
14
+
15
+ <dams:date rdf:parseType="Resource">
16
+ <dams:beginDate>2012-11-27</dams:beginDate>
17
+ <dams:endDate>2012-11-30</dams:endDate>
18
+ <rdf:value>2012-11-29</rdf:value>
19
+ </dams:date>
20
+
21
+ <dams:language rdf:resource="http://library.ucsd.edu/ark:/20775/bb12345678"/>
22
+ <dams:typeOfResource>image</dams:typeOfResource>
23
+ <dams:otherResource>
24
+ <dams:RelatedResource>
25
+ <dams:type>online exhibit</dams:type>
26
+ <dams:description>foo</dams:description>
27
+ <dams:uri>http://library.ucsd.edu/test/foo/</dams:uri>
28
+ </dams:RelatedResource>
29
+ </dams:otherResource>
30
+ <dams:relationship>
31
+ <dams:Relationship>
32
+ <dams:role rdf:resource="http://library.ucsd.edu/ark:/20775/bd55639754"/>
33
+ <dams:name rdf:resource="http://library.ucsd.edu/ark:/20775/bb08080808"/>
34
+ </dams:Relationship>
35
+ </dams:relationship>
36
+ <dams:assembledCollection rdf:resource="http://library.ucsd.edu/ark:/20775/bb03030303"/>
37
+ </dams:Object>
38
+ </rdf:RDF>
@@ -94,6 +94,10 @@ describe ActiveFedora::NtriplesRDFDatastream do
94
94
  @subject.content = File.new('spec/fixtures/mixed_rdf_descMetadata.nt').read
95
95
  end
96
96
 
97
+ after do
98
+ Object.send(:remove_const, :MyDatastream)
99
+ end
100
+
97
101
  it "should have fields" do
98
102
  @subject.title.should == ["Title of datastream"]
99
103
  end
@@ -153,6 +157,9 @@ describe ActiveFedora::NtriplesRDFDatastream do
153
157
  @subject = MyDatastream.new(@inner_object, 'solr_rdf')
154
158
  @subject.content = File.new('spec/fixtures/solr_rdf_descMetadata.nt').read
155
159
  end
160
+ after(:all) do
161
+ Object.send(:remove_const, :MyDatastream)
162
+ end
156
163
  before(:each) do
157
164
  @subject.stub(:pid => 'test:1')
158
165
  end
@@ -1,10 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::RdfxmlRDFDatastream do
4
- describe "a new instance" do
4
+ describe "a new instance" do
5
5
  before(:each) do
6
6
  class MyRdfxmlDatastream < ActiveFedora::RdfxmlRDFDatastream
7
- register_vocabularies RDF::DC
8
7
  map_predicates do |map|
9
8
  map.publisher(:in => RDF::DC)
10
9
  end
@@ -19,5 +18,110 @@ describe ActiveFedora::RdfxmlRDFDatastream do
19
18
  @subject.publisher = ["St. Martin's Press"]
20
19
  @subject.serialize.should =~ /<rdf:RDF/
21
20
  end
22
- end
21
+ end
22
+
23
+ describe "a complex data model" do
24
+ before do
25
+ class DAMS < RDF::Vocabulary("http://library.ucsd.edu/ontology/dams#")
26
+ property :title
27
+ property :relatedTitle
28
+ property :type
29
+ property :date
30
+ property :beginDate
31
+ property :endDate
32
+ property :language
33
+ property :typeOfResource
34
+ property :otherResource
35
+ property :RelatedResource
36
+ property :description
37
+ property :uri
38
+ property :relationship
39
+ property :Relationship
40
+ property :role
41
+ property :name
42
+ property :assembledCollection
43
+ property :Object
44
+ property :value
45
+ end
46
+
47
+ module RDF
48
+ # This enables RDF to respond_to? :value
49
+ def self.value
50
+ self[:value]
51
+ end
52
+ end
53
+
54
+ class MyDatastream < ActiveFedora::RdfxmlRDFDatastream
55
+ map_predicates do |map|
56
+ map.resource_type(:in => DAMS, :to => 'typeOfResource')
57
+ map.title(:in => DAMS, :class_name => 'Description')
58
+ end
59
+
60
+ rdf_subject { |ds| RDF::URI.new(ds.about) }
61
+
62
+ attr_reader :about
63
+
64
+ def initialize(digital_object=nil, dsid=nil, options={})
65
+ @about = options.delete(:about)
66
+ super
67
+ end
68
+
69
+ after_initialize :type_resource
70
+ def type_resource
71
+ graph.insert([RDF::URI.new(about), RDF.type, DAMS.Object])
72
+ end
73
+
74
+ def content=(content)
75
+ super
76
+ @about = graph.statements.first.subject
77
+ end
78
+ class Description
79
+ include ActiveFedora::RdfObject
80
+ map_predicates do |map|
81
+ rdf_type DAMS.Description
82
+ map.value(:in=> RDF) do |index|
83
+ index.as :searchable
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ after do
91
+ Object.send(:remove_const, :MyDatastream)
92
+ Object.send(:remove_const, :DAMS)
93
+ end
94
+
95
+ describe "a new instance" do
96
+ subject { MyDatastream.new(stub('inner object', :pid=>'test:1', :new? =>true), 'descMetadata', about:"http://library.ucsd.edu/ark:/20775/") }
97
+ it "should have a subject" do
98
+ subject.rdf_subject.to_s.should == "http://library.ucsd.edu/ark:/20775/"
99
+ end
100
+
101
+ end
102
+
103
+ describe "an instance with content" do
104
+ subject do
105
+ subject = MyDatastream.new(stub('inner object', :pid=>'test:1', :new? =>true), 'descMetadata')
106
+ subject.content = File.new('spec/fixtures/damsObjectModel.xml').read
107
+ subject
108
+ end
109
+ it "should have a subject" do
110
+ subject.rdf_subject.to_s.should == "http://library.ucsd.edu/ark:/20775/"
111
+ end
112
+ it "should have controlGroup" do
113
+ subject.controlGroup.should == 'X'
114
+ end
115
+ it "should have mimeType" do
116
+ subject.mimeType.should == 'text/xml'
117
+ end
118
+ it "should have dsid" do
119
+ subject.dsid.should == 'descMetadata'
120
+ end
121
+ it "should have fields" do
122
+ subject.resource_type.should == ["image"]
123
+ subject.title.first.value.should == ["example title"]
124
+ end
125
+ end
126
+ end
23
127
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.0.rc2
5
- prerelease: 6
4
+ version: 5.5.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Zumwalt
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-17 00:00:00.000000000 Z
14
+ date: 2013-01-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rsolr
@@ -68,7 +68,7 @@ dependencies:
68
68
  requirements:
69
69
  - - ~>
70
70
  - !ruby/object:Gem::Version
71
- version: 2.1.0.rc1
71
+ version: 2.1.0
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
@@ -76,7 +76,7 @@ dependencies:
76
76
  requirements:
77
77
  - - ~>
78
78
  - !ruby/object:Gem::Version
79
- version: 2.1.0.rc1
79
+ version: 2.1.0
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: activeresource
82
82
  requirement: !ruby/object:Gem::Requirement
@@ -412,6 +412,7 @@ files:
412
412
  - solr/conf/solrconfig.xml
413
413
  - spec/config_helper.rb
414
414
  - spec/fixtures/changeme155.xml
415
+ - spec/fixtures/damsObjectModel.xml
415
416
  - spec/fixtures/dino.jpg
416
417
  - spec/fixtures/dino_jpg_no_file_ext
417
418
  - spec/fixtures/dublin_core_rdf_descMetadata.nt
@@ -559,9 +560,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
559
560
  required_rubygems_version: !ruby/object:Gem::Requirement
560
561
  none: false
561
562
  requirements:
562
- - - ! '>'
563
+ - - ! '>='
563
564
  - !ruby/object:Gem::Version
564
- version: 1.3.1
565
+ version: '0'
566
+ segments:
567
+ - 0
568
+ hash: -3492358049671334193
565
569
  requirements: []
566
570
  rubyforge_project: rubyfedora
567
571
  rubygems_version: 1.8.24
@@ -571,6 +575,7 @@ summary: A convenience libary for manipulating documents in the Fedora Repositor
571
575
  test_files:
572
576
  - spec/config_helper.rb
573
577
  - spec/fixtures/changeme155.xml
578
+ - spec/fixtures/damsObjectModel.xml
574
579
  - spec/fixtures/dino.jpg
575
580
  - spec/fixtures/dino_jpg_no_file_ext
576
581
  - spec/fixtures/dublin_core_rdf_descMetadata.nt