rdf-spec 0.3.4.1 → 0.3.5
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/VERSION +1 -1
- data/etc/doap.nq +8 -8
- data/etc/doap.nt +3 -3
- data/etc/doap.ttl +3 -3
- data/lib/rdf/spec/durable.rb +4 -2
- data/lib/rdf/spec/enumerable.rb +28 -7
- data/lib/rdf/spec/indexable.rb +23 -1
- data/lib/rdf/spec/mutable.rb +26 -54
- data/lib/rdf/spec/queryable.rb +13 -9
- data/lib/rdf/spec/readable.rb +11 -1
- data/lib/rdf/spec/transaction.rb +52 -1
- data/lib/rdf/spec/version.rb +2 -5
- data/lib/rdf/spec/writable.rb +83 -1
- data/spec/spec_helper.rb +1 -0
- metadata +11 -16
- data/lib/rdf/spec/graph.rb +0 -53
- data/spec/countable_spec.rb +0 -12
- data/spec/enumerable_spec.rb +0 -12
- data/spec/queryable_spec.rb +0 -11
- data/spec/repository_spec.rb +0 -11
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.5
|
data/etc/doap.nq
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" <http://bhuga.net/#ben> .
|
|
13
13
|
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <http://bhuga.net/> <http://bhuga.net/#ben> .
|
|
14
14
|
<http://bhuga.net/#ben> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bhuga/foaf> <http://bhuga.net/#ben> .
|
|
15
|
-
<http://greggkellogg.net
|
|
16
|
-
<http://greggkellogg.net
|
|
17
|
-
<http://greggkellogg.net
|
|
18
|
-
<http://greggkellogg.net
|
|
19
|
-
<http://greggkellogg.net
|
|
15
|
+
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://greggkellogg.net/foaf#me> .
|
|
16
|
+
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" <http://greggkellogg.net/foaf#me> .
|
|
17
|
+
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@greggkellogg.net> <http://greggkellogg.net/foaf#me> .
|
|
18
|
+
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "b7a856d39fc3f02573271d9901f1f9107147f657" <http://greggkellogg.net/foaf#me> .
|
|
19
|
+
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/homepage> <http://greggkellogg.net/> <http://greggkellogg.net/foaf#me> .
|
|
20
20
|
<http://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self> .
|
|
21
21
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://ar.to/> .
|
|
22
22
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://blog.datagraph.org/> .
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#description> "RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data."@en .
|
|
28
28
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://ar.to/#self> .
|
|
29
29
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://bhuga.net/#ben> .
|
|
30
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://greggkellogg.net
|
|
30
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://greggkellogg.net/foaf#me> .
|
|
31
31
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://ar.to/#self> .
|
|
32
32
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://bhuga.net/#ben> .
|
|
33
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://greggkellogg.net
|
|
33
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://greggkellogg.net/foaf#me> .
|
|
34
34
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <http://rubyforge.org/projects/rdf/> .
|
|
35
35
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid1 .
|
|
36
36
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid2 .
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
|
|
46
46
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://ar.to/#self> .
|
|
47
47
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://bhuga.net/#ben> .
|
|
48
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://greggkellogg.net
|
|
48
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://greggkellogg.net/foaf#me> .
|
|
49
49
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
|
|
50
50
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
|
|
51
51
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
|
data/etc/doap.nt
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#description> "RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data."@en .
|
|
9
9
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://ar.to/#self> .
|
|
10
10
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://bhuga.net/#ben> .
|
|
11
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://greggkellogg.net
|
|
11
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://greggkellogg.net/foaf#me> .
|
|
12
12
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://ar.to/#self> .
|
|
13
13
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://bhuga.net/#ben> .
|
|
14
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://greggkellogg.net
|
|
14
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://greggkellogg.net/foaf#me> .
|
|
15
15
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <http://rubyforge.org/projects/rdf/> .
|
|
16
16
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid1 .
|
|
17
17
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid2 .
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
|
|
27
27
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://ar.to/#self> .
|
|
28
28
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://bhuga.net/#ben> .
|
|
29
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://greggkellogg.net
|
|
29
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://greggkellogg.net/foaf#me> .
|
|
30
30
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
|
|
31
31
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
|
|
32
32
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
|
data/etc/doap.ttl
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
doap:bug-database <http://github.com/bendiken/rdf/issues> ;
|
|
20
20
|
doap:blog <http://ar.to/>, <http://blog.datagraph.org/> ;
|
|
21
21
|
doap:vendor <http://datagraph.org/> ;
|
|
22
|
-
doap:developer <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net
|
|
23
|
-
doap:maintainer <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net
|
|
24
|
-
doap:documenter <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net
|
|
22
|
+
doap:developer <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net/foaf#me> ;
|
|
23
|
+
doap:maintainer <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net/foaf#me> ;
|
|
24
|
+
doap:documenter <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net/foaf#me> ;
|
|
25
25
|
doap:helper [a foaf:Person ;
|
|
26
26
|
foaf:name "Călin Ardelean" ;
|
|
27
27
|
foaf:mbox_sha1sum "274bd18402fc773ffc0606996aa1fb90b603aa29"] ;
|
data/lib/rdf/spec/durable.rb
CHANGED
|
@@ -42,7 +42,9 @@ share_as :RDF_Durable do
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
it "should save contents between instantiations" do
|
|
45
|
-
@load_durable.call.
|
|
46
|
-
|
|
45
|
+
if @load_durable.call.durable?
|
|
46
|
+
@load_durable.call.load(@filename)
|
|
47
|
+
@load_durable.call.count.should == File.readlines(@filename).size
|
|
48
|
+
end
|
|
47
49
|
end
|
|
48
50
|
end
|
data/lib/rdf/spec/enumerable.rb
CHANGED
|
@@ -17,8 +17,13 @@ share_as :RDF_Enumerable do
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
@supports_context = @enumerable.respond_to?(:supports?) && @enumerable.supports?(:context)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "#supports?" do
|
|
24
|
+
it "responds to #supports?" do
|
|
25
|
+
@enumerable.respond_to?(:support?)
|
|
26
|
+
end
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
context "when counting statements" do
|
|
@@ -70,11 +75,13 @@ share_as :RDF_Enumerable do
|
|
|
70
75
|
@enumerable.has_statement?(statement).should be_true
|
|
71
76
|
end
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
if @supports_context
|
|
79
|
+
context = RDF::URI.new("urn:context:1")
|
|
80
|
+
@statements.each do |statement|
|
|
81
|
+
s = statement.dup
|
|
82
|
+
s.context = context
|
|
83
|
+
@enumerable.has_statement?(s).should be_false
|
|
84
|
+
end
|
|
78
85
|
end
|
|
79
86
|
|
|
80
87
|
unknown_statement = RDF::Statement.new(RDF::Node.new, RDF::URI.new("http://example.org/unknown"), RDF::Node.new)
|
|
@@ -410,4 +417,18 @@ share_as :RDF_Enumerable do
|
|
|
410
417
|
@enumerable.to_hash.keys.size.should == @enumerable.subjects.to_a.size
|
|
411
418
|
end
|
|
412
419
|
end
|
|
420
|
+
|
|
421
|
+
context "when dumping" do
|
|
422
|
+
it "should respond to #dump" do
|
|
423
|
+
@enumerable.should respond_to(:dump)
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
it "should implement #dump" do
|
|
427
|
+
@enumerable.dump(:ntriples).should == RDF::NTriples::Writer.buffer() {|w| w << @enumerable}
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
it "raises error on unknown format" do
|
|
431
|
+
lambda {@enumerable.dump(:foobar)}.should raise_error(RDF::WriterError, /No writer found/)
|
|
432
|
+
end
|
|
433
|
+
end
|
|
413
434
|
end
|
data/lib/rdf/spec/indexable.rb
CHANGED
|
@@ -3,5 +3,27 @@ require 'rdf/spec'
|
|
|
3
3
|
share_as :RDF_Indexable do
|
|
4
4
|
include RDF::Spec::Matchers
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
before :each do
|
|
7
|
+
raise '+@indexable+ must be defined in a before(:each) block' unless instance_variable_get('@indexable')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "responds to #indexed?" do
|
|
11
|
+
@indexable.respond_to?(:indexed?)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "implements #indexed?" do
|
|
15
|
+
!!@indexable.indexed?.should == @indexable.indexed?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "responds to #index!" do
|
|
19
|
+
@indexable.respond_to?(:index!)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "does not raise error on #index! if #indexed?" do
|
|
23
|
+
lambda {@indexable.index!}.should_not raise_error if @indexable.indexed?
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "raises error on #index! if not #indexed?" do
|
|
27
|
+
lambda {@indexable.index!}.should raise_error unless @indexable.indexed?
|
|
28
|
+
end
|
|
7
29
|
end
|
data/lib/rdf/spec/mutable.rb
CHANGED
|
@@ -12,8 +12,27 @@ share_as :RDF_Mutable do
|
|
|
12
12
|
@subject = RDF::URI('http://rubygems.org/gems/rdf')
|
|
13
13
|
@context = RDF::URI('http://example.org/context')
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
@supports_context = @mutable.respond_to?(:supports?) && @mutable.supports?(:context)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
context "readability" do
|
|
19
|
+
require 'rdf/spec/readable'
|
|
20
|
+
|
|
21
|
+
before :each do
|
|
22
|
+
@readable = @mutable
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it_should_behave_like RDF_Readable
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context "writability" do
|
|
29
|
+
require 'rdf/spec/writable'
|
|
30
|
+
|
|
31
|
+
before :each do
|
|
32
|
+
@writable = @mutable
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it_should_behave_like RDF_Writable
|
|
17
36
|
end
|
|
18
37
|
|
|
19
38
|
it "should be empty initially" do
|
|
@@ -58,59 +77,12 @@ share_as :RDF_Mutable do
|
|
|
58
77
|
end
|
|
59
78
|
|
|
60
79
|
it "should load statements with a context override" do
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
context "when inserting statements" do
|
|
68
|
-
before :each do
|
|
69
|
-
@statements = RDF::NTriples::Reader.new(File.open(@filename)).to_a
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
it "should support #insert" do
|
|
73
|
-
@mutable.should respond_to(:insert)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "should not raise errors" do
|
|
77
|
-
lambda { @mutable.insert(@statements.first) }.should_not raise_error
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "should support inserting one statement at a time" do
|
|
81
|
-
@mutable.insert(@statements.first)
|
|
82
|
-
@mutable.should have_statement(@statements.first)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it "should support inserting multiple statements at a time" do
|
|
86
|
-
@mutable.insert(*@statements)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
it "should insert statements successfully" do
|
|
90
|
-
@mutable.insert(*@statements)
|
|
91
|
-
@mutable.count.should == @statements.size
|
|
80
|
+
if @supports_context
|
|
81
|
+
@mutable.load @filename, :context => @context
|
|
82
|
+
@mutable.should have_context(@context)
|
|
83
|
+
@mutable.query(:context => @context).size.should == @mutable.size
|
|
84
|
+
end
|
|
92
85
|
end
|
|
93
|
-
|
|
94
|
-
it "should not insert a statement twice" do
|
|
95
|
-
@mutable.insert(@statements.first)
|
|
96
|
-
@mutable.insert(@statements.first)
|
|
97
|
-
@mutable.count.should == 1
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
it "should treat statements with a different context as distinct" do
|
|
101
|
-
s1 = @statements.first.dup
|
|
102
|
-
s1.context = nil
|
|
103
|
-
s2 = @statements.first.dup
|
|
104
|
-
s2.context = RDF::URI.new("urn:context:1")
|
|
105
|
-
s3 = @statements.first.dup
|
|
106
|
-
s3.context = RDF::URI.new("urn:context:2")
|
|
107
|
-
@mutable.insert(s1)
|
|
108
|
-
@mutable.insert(s2)
|
|
109
|
-
@mutable.insert(s3)
|
|
110
|
-
# If contexts are not suported, all three are redundant
|
|
111
|
-
@mutable.count.should == (@supports_context ? 3 : 1)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
86
|
end
|
|
115
87
|
|
|
116
88
|
context "when deleting statements" do
|
data/lib/rdf/spec/queryable.rb
CHANGED
|
@@ -225,18 +225,22 @@ share_as :RDF_Queryable do
|
|
|
225
225
|
end
|
|
226
226
|
|
|
227
227
|
it "returns statements from named contexts with variable context" do
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
unless @queryable.contexts.to_a.empty?
|
|
229
|
+
pattern = RDF::Query::Pattern.new(nil, nil, nil, :context => :c)
|
|
230
|
+
solutions = []
|
|
231
|
+
@queryable.send(:query_pattern, pattern) {|s| solutions << s}
|
|
232
|
+
context_statements = @queryable.statements.select {|st| st.has_context?}.length
|
|
233
|
+
solutions.size.should == context_statements
|
|
234
|
+
end
|
|
233
235
|
end
|
|
234
236
|
|
|
235
237
|
it "returns statements from specific context with URI context" do
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
unless @queryable.contexts.to_a.empty?
|
|
239
|
+
pattern = RDF::Query::Pattern.new(nil, nil, nil, :context => RDF::URI("http://ar.to/#self"))
|
|
240
|
+
solutions = []
|
|
241
|
+
@queryable.send(:query_pattern, pattern) {|s| solutions << s}
|
|
242
|
+
solutions.size.should == File.readlines(@doap).grep(/^<http:\/\/ar.to\/\#self>/).size
|
|
243
|
+
end
|
|
240
244
|
end
|
|
241
245
|
end
|
|
242
246
|
end
|
data/lib/rdf/spec/readable.rb
CHANGED
|
@@ -3,5 +3,15 @@ require 'rdf/spec'
|
|
|
3
3
|
share_as :RDF_Readable do
|
|
4
4
|
include RDF::Spec::Matchers
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
before :each do
|
|
7
|
+
raise '+@readable+ must be defined in a before(:each) block' unless instance_variable_get('@readable')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "responds to #readable?" do
|
|
11
|
+
@readable.respond_to?(:readable?)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "implements #readable?" do
|
|
15
|
+
!!@readable.readable?.should == @readable.readable?
|
|
16
|
+
end
|
|
7
17
|
end
|
data/lib/rdf/spec/transaction.rb
CHANGED
|
@@ -3,5 +3,56 @@ require 'rdf/spec'
|
|
|
3
3
|
share_as :RDF_Transaction do
|
|
4
4
|
include RDF::Spec::Matchers
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
before :each do
|
|
7
|
+
raise '+@transaction+ must be defined in a before(:each) block' unless instance_variable_get('@transaction')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "#initialize" do
|
|
11
|
+
it "accepts a graph"
|
|
12
|
+
it "accepts a context"
|
|
13
|
+
it "accepts inserts"
|
|
14
|
+
it "accepts deletes"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "#graph" do
|
|
18
|
+
it "is mutable"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "#deletes" do
|
|
22
|
+
it "is mutable"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe "#inserts" do
|
|
26
|
+
it "is mutable"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe "#readable?" do
|
|
30
|
+
it "returns false" do
|
|
31
|
+
@transaction.readable?.should be_false
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe "#execute" do
|
|
36
|
+
it "deletes statements"
|
|
37
|
+
it "inserts statements"
|
|
38
|
+
it "calls before_execute"
|
|
39
|
+
it "calls after_execute"
|
|
40
|
+
it "returns self"
|
|
41
|
+
it "does not delete statements on failures"
|
|
42
|
+
it "does not insert statements on failures"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe "#delete_statement" do
|
|
46
|
+
it "adds statement to #deletes"
|
|
47
|
+
it "does not remove statement from graph"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe "#insert_statement" do
|
|
51
|
+
it "adds statement to #inserts"
|
|
52
|
+
it "does not add statement to graph"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "does not respond to #load"
|
|
56
|
+
it "does not respond to #update"
|
|
57
|
+
it "does not respond to #clear"
|
|
7
58
|
end
|
data/lib/rdf/spec/version.rb
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
module RDF; module Spec
|
|
2
2
|
module VERSION
|
|
3
|
-
|
|
4
|
-
MINOR =
|
|
5
|
-
TINY = 3
|
|
6
|
-
EXTRA = nil
|
|
7
|
-
|
|
3
|
+
VERSION_FILE = File.expand_path("../../../../VERSION", __FILE__)
|
|
4
|
+
MAJOR, MINOR, TINY, EXTRA = File.read(VERSION_FILE).chop.split(".")
|
|
8
5
|
STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
|
|
9
6
|
|
|
10
7
|
##
|
data/lib/rdf/spec/writable.rb
CHANGED
|
@@ -3,5 +3,87 @@ require 'rdf/spec'
|
|
|
3
3
|
share_as :RDF_Writable do
|
|
4
4
|
include RDF::Spec::Matchers
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
before :each do
|
|
7
|
+
raise '+@writable+ must be defined in a before(:each) block' unless instance_variable_get('@writable')
|
|
8
|
+
|
|
9
|
+
@filename = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'etc', 'doap.nt'))
|
|
10
|
+
|
|
11
|
+
@supports_context = @writable.respond_to?(:supports?) && @writable.supports?(:context)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "responds to #writable?" do
|
|
15
|
+
@writable.respond_to?(:readable?)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "implements #writable?" do
|
|
19
|
+
!!@writable.writable?.should == @writable.writable?
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "#<<" do
|
|
23
|
+
it "inserts a reader"
|
|
24
|
+
it "inserts a graph"
|
|
25
|
+
it "inserts an enumerable"
|
|
26
|
+
it "inserts data responding to #to_rdf"
|
|
27
|
+
it "inserts a statement"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context "when inserting statements" do
|
|
31
|
+
before :each do
|
|
32
|
+
@statements = RDF::NTriples::Reader.new(File.open(@filename)).to_a
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "should support #insert" do
|
|
36
|
+
@writable.should respond_to(:insert)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should not raise errors" do
|
|
40
|
+
if @writable.writable?
|
|
41
|
+
lambda { @writable.insert(@statements.first) }.should_not raise_error
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "should support inserting one statement at a time" do
|
|
46
|
+
if @writable.writable?
|
|
47
|
+
@writable.insert(@statements.first)
|
|
48
|
+
@writable.should have_statement(@statements.first)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should support inserting multiple statements at a time" do
|
|
53
|
+
if @writable.writable?
|
|
54
|
+
@writable.insert(*@statements)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should insert statements successfully" do
|
|
59
|
+
if @writable.writable?
|
|
60
|
+
@writable.insert(*@statements)
|
|
61
|
+
@writable.count.should == @statements.size
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "should not insert a statement twice" do
|
|
66
|
+
if @writable.writable?
|
|
67
|
+
@writable.insert(@statements.first)
|
|
68
|
+
@writable.insert(@statements.first)
|
|
69
|
+
@writable.count.should == 1
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "should treat statements with a different context as distinct" do
|
|
74
|
+
if @writable.writable?
|
|
75
|
+
s1 = @statements.first.dup
|
|
76
|
+
s1.context = nil
|
|
77
|
+
s2 = @statements.first.dup
|
|
78
|
+
s2.context = RDF::URI.new("urn:context:1")
|
|
79
|
+
s3 = @statements.first.dup
|
|
80
|
+
s3.context = RDF::URI.new("urn:context:2")
|
|
81
|
+
@writable.insert(s1)
|
|
82
|
+
@writable.insert(s2)
|
|
83
|
+
@writable.insert(s3)
|
|
84
|
+
# If contexts are not suported, all three are redundant
|
|
85
|
+
@writable.count.should == (@supports_context ? 3 : 1)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
7
89
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rdf-spec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -11,41 +11,41 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2012-
|
|
14
|
+
date: 2012-02-07 00:00:00.000000000Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rspec
|
|
18
|
-
requirement: &
|
|
18
|
+
requirement: &2151960340 !ruby/object:Gem::Requirement
|
|
19
19
|
none: false
|
|
20
20
|
requirements:
|
|
21
21
|
- - ! '>='
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: 2.
|
|
23
|
+
version: 2.8.0
|
|
24
24
|
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
|
-
version_requirements: *
|
|
26
|
+
version_requirements: *2151960340
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: yard
|
|
29
|
-
requirement: &
|
|
29
|
+
requirement: &2151959880 !ruby/object:Gem::Requirement
|
|
30
30
|
none: false
|
|
31
31
|
requirements:
|
|
32
32
|
- - ! '>='
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: 0.7.
|
|
34
|
+
version: 0.7.5
|
|
35
35
|
type: :development
|
|
36
36
|
prerelease: false
|
|
37
|
-
version_requirements: *
|
|
37
|
+
version_requirements: *2151959880
|
|
38
38
|
- !ruby/object:Gem::Dependency
|
|
39
39
|
name: rdf
|
|
40
|
-
requirement: &
|
|
40
|
+
requirement: &2151959420 !ruby/object:Gem::Requirement
|
|
41
41
|
none: false
|
|
42
42
|
requirements:
|
|
43
43
|
- - ~>
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: 0.3.
|
|
45
|
+
version: 0.3.5
|
|
46
46
|
type: :development
|
|
47
47
|
prerelease: false
|
|
48
|
-
version_requirements: *
|
|
48
|
+
version_requirements: *2151959420
|
|
49
49
|
description: RDF.rb plugin that provides RSpec matchers and shared examples for RDF
|
|
50
50
|
objects.
|
|
51
51
|
email: public-rdf-ruby@w3.org
|
|
@@ -75,7 +75,6 @@ files:
|
|
|
75
75
|
- lib/rdf/spec/durable.rb
|
|
76
76
|
- lib/rdf/spec/enumerable.rb
|
|
77
77
|
- lib/rdf/spec/format.rb
|
|
78
|
-
- lib/rdf/spec/graph.rb
|
|
79
78
|
- lib/rdf/spec/indexable.rb
|
|
80
79
|
- lib/rdf/spec/inferable.rb
|
|
81
80
|
- lib/rdf/spec/matchers.rb
|
|
@@ -91,10 +90,6 @@ files:
|
|
|
91
90
|
- lib/rdf/spec/writable.rb
|
|
92
91
|
- lib/rdf/spec/writer.rb
|
|
93
92
|
- lib/rdf/spec.rb
|
|
94
|
-
- spec/countable_spec.rb
|
|
95
|
-
- spec/enumerable_spec.rb
|
|
96
|
-
- spec/queryable_spec.rb
|
|
97
|
-
- spec/repository_spec.rb
|
|
98
93
|
- spec/spec_helper.rb
|
|
99
94
|
- spec/version_spec.rb
|
|
100
95
|
homepage: http://rdf.rubyforge.org/spec/
|
data/lib/rdf/spec/graph.rb
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'rdf/spec'
|
|
2
|
-
|
|
3
|
-
share_as :RDF_Graph do
|
|
4
|
-
before :each do
|
|
5
|
-
raise '+@new+ must be defined in a before(:each) block' unless instance_variable_get('@new')
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
context "unnamed graphs" do
|
|
9
|
-
it "should be instantiable" do
|
|
10
|
-
lambda { @new.call }.should_not raise_error
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "should be unnamed" do
|
|
14
|
-
graph = @new.call
|
|
15
|
-
graph.unnamed?.should be_true
|
|
16
|
-
graph.named?.should be_false
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "should not have a context" do
|
|
20
|
-
graph = @new.call
|
|
21
|
-
graph.context.should be_nil
|
|
22
|
-
graph.contexts.size.should == 0
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context "named graphs" do
|
|
27
|
-
it "should be instantiable" do
|
|
28
|
-
lambda { @new.call }.should_not raise_error
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "should be named" do
|
|
32
|
-
graph = @new.call("http://rdf.rubyforge.org/")
|
|
33
|
-
graph.unnamed?.should be_false
|
|
34
|
-
graph.named?.should be_true
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it "should have a context" do
|
|
38
|
-
graph = @new.call("http://rdf.rubyforge.org/")
|
|
39
|
-
graph.context.should_not be_nil
|
|
40
|
-
graph.contexts.size.should == 1
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "should be #anonymous? with a Node context" do
|
|
44
|
-
graph = @new.call(RDF::Node.new)
|
|
45
|
-
graph.should be_anonymous
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "should not be #anonymous? with a URI context" do
|
|
49
|
-
graph = @new.call("http://rdf.rubyforge.org/")
|
|
50
|
-
graph.should_not be_anonymous
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
data/spec/countable_spec.rb
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
2
|
-
require 'rdf/spec/countable'
|
|
3
|
-
|
|
4
|
-
describe RDF::Countable do
|
|
5
|
-
before :each do
|
|
6
|
-
@statements = RDF::NTriples::Reader.new(File.open('etc/doap.nt')).to_a
|
|
7
|
-
@countable = @statements.dup.extend(RDF::Countable)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# @see lib/rdf/spec/countable.rb
|
|
11
|
-
it_should_behave_like RDF_Countable
|
|
12
|
-
end
|
data/spec/enumerable_spec.rb
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
2
|
-
require 'rdf/spec/enumerable'
|
|
3
|
-
|
|
4
|
-
describe RDF::Enumerable do
|
|
5
|
-
before :each do
|
|
6
|
-
@statements = RDF::NTriples::Reader.new(File.open('etc/doap.nt')).to_a
|
|
7
|
-
@enumerable = @statements.dup.extend(RDF::Enumerable)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# @see lib/rdf/spec/enumerable.rb
|
|
11
|
-
it_should_behave_like RDF_Enumerable
|
|
12
|
-
end
|
data/spec/queryable_spec.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
2
|
-
require 'rdf/spec/queryable'
|
|
3
|
-
|
|
4
|
-
describe RDF::Queryable do
|
|
5
|
-
before :each do
|
|
6
|
-
@queryable = RDF::Repository.new
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# @see lib/rdf/spec/queryable.rb
|
|
10
|
-
it_should_behave_like RDF_Queryable
|
|
11
|
-
end
|
data/spec/repository_spec.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
|
2
|
-
require 'rdf/spec/repository'
|
|
3
|
-
|
|
4
|
-
describe RDF::Repository do
|
|
5
|
-
before :each do
|
|
6
|
-
@repository = RDF::Repository.new
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# @see lib/rdf/spec/repository.rb
|
|
10
|
-
it_should_behave_like RDF_Repository
|
|
11
|
-
end
|