rdf-spec 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/CREDITS +1 -0
- data/README +12 -11
- data/VERSION +1 -1
- data/etc/doap.nt +28 -10
- data/lib/rdf/spec.rb +5 -4
- data/lib/rdf/spec/countable.rb +0 -1
- data/lib/rdf/spec/durable.rb +0 -1
- data/lib/rdf/spec/enumerable.rb +2 -3
- data/lib/rdf/spec/format.rb +0 -1
- data/lib/rdf/spec/graph.rb +0 -1
- data/lib/rdf/spec/indexable.rb +7 -0
- data/lib/rdf/spec/inferable.rb +7 -0
- data/lib/rdf/spec/list.rb +0 -1
- data/lib/rdf/spec/literal.rb +449 -291
- data/lib/rdf/spec/matchers.rb +4 -4
- data/lib/rdf/spec/mutable.rb +0 -1
- data/lib/rdf/spec/node.rb +0 -1
- data/lib/rdf/spec/query.rb +0 -1
- data/lib/rdf/spec/queryable.rb +3 -4
- data/lib/rdf/spec/readable.rb +0 -1
- data/lib/rdf/spec/reader.rb +0 -1
- data/lib/rdf/spec/repository.rb +0 -1
- data/lib/rdf/spec/resource.rb +0 -1
- data/lib/rdf/spec/statement.rb +0 -1
- data/lib/rdf/spec/term.rb +7 -0
- data/lib/rdf/spec/transaction.rb +7 -0
- data/lib/rdf/spec/uri.rb +125 -1
- data/lib/rdf/spec/value.rb +0 -1
- data/lib/rdf/spec/version.rb +2 -2
- data/lib/rdf/spec/vocab.rb +0 -1
- data/lib/rdf/spec/writable.rb +0 -1
- data/lib/rdf/spec/writer.rb +0 -1
- data/spec/spec_helper.rb +3 -0
- metadata +27 -23
- data/CONTRIBUTORS +0 -2
data/lib/rdf/spec/matchers.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspec' # @see http://rubygems.org/gems/rspec
|
2
2
|
|
3
3
|
module RDF; module Spec
|
4
4
|
##
|
@@ -13,7 +13,7 @@ module RDF; module Spec
|
|
13
13
|
# @return [void]
|
14
14
|
def self.define(name, &declarations)
|
15
15
|
define_method name do |*expected|
|
16
|
-
::
|
16
|
+
::RSpec::Matchers::Matcher.new(name, *expected, &declarations)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -177,5 +177,5 @@ module RDF; module Spec
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
end
|
180
|
-
end #
|
181
|
-
end; end #
|
180
|
+
end # Matchers
|
181
|
+
end; end # RDF::Spec
|
data/lib/rdf/spec/mutable.rb
CHANGED
data/lib/rdf/spec/node.rb
CHANGED
data/lib/rdf/spec/query.rb
CHANGED
data/lib/rdf/spec/queryable.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'rdf/spec'
|
2
|
-
require 'spec'
|
3
2
|
|
4
3
|
share_as :RDF_Queryable do
|
5
4
|
include RDF::Spec::Matchers
|
@@ -290,9 +289,9 @@ share_as :RDF_Queryable do
|
|
290
289
|
# FIXME: these tests should be using the provided @queryable, if possible.
|
291
290
|
@queryable = RDF::Graph.new do |graph|
|
292
291
|
@subject = RDF::Node.new
|
293
|
-
graph << [subject, RDF.type, RDF::DOAP.Project]
|
294
|
-
graph << [subject, RDF::DC.creator, RDF::URI.new('http://example.org/#jhacker')]
|
295
|
-
graph << [subject, RDF::DC.creator, @literal = RDF::Literal.new('J. Random Hacker')]
|
292
|
+
graph << [@subject, RDF.type, RDF::DOAP.Project]
|
293
|
+
graph << [@subject, RDF::DC.creator, RDF::URI.new('http://example.org/#jhacker')]
|
294
|
+
graph << [@subject, RDF::DC.creator, @literal = RDF::Literal.new('J. Random Hacker')]
|
296
295
|
end
|
297
296
|
@failing_pattern = [nil, nil, RDF::Node.new]
|
298
297
|
end
|
data/lib/rdf/spec/readable.rb
CHANGED
data/lib/rdf/spec/reader.rb
CHANGED
data/lib/rdf/spec/repository.rb
CHANGED
data/lib/rdf/spec/resource.rb
CHANGED
data/lib/rdf/spec/statement.rb
CHANGED
data/lib/rdf/spec/uri.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rdf'
|
2
1
|
require 'rdf/spec'
|
3
2
|
|
4
3
|
share_as :RDF_URI do
|
@@ -71,4 +70,129 @@ share_as :RDF_URI do
|
|
71
70
|
it "should not be #anonymous?" do
|
72
71
|
@new.call('http://example.org').should_not be_anonymous
|
73
72
|
end
|
73
|
+
|
74
|
+
context "using the smart separator (/)" do
|
75
|
+
{
|
76
|
+
# #!! means that I'm not sure I like the semantics, but they are cases for
|
77
|
+
# arguably invalid input, probably without 'correct' answers.
|
78
|
+
|
79
|
+
%w(http://foo a) => "http://foo/a",
|
80
|
+
%w(http://foo /a) => "http://foo/a",
|
81
|
+
%w(http://foo #a) => "http://foo#a",
|
82
|
+
|
83
|
+
%w(http://foo/ a) => "http://foo/a",
|
84
|
+
%w(http://foo/ /a) => "http://foo/a",
|
85
|
+
%w(http://foo/ #a) => "http://foo#a", #!!
|
86
|
+
|
87
|
+
%w(http://foo# a) => "http://foo#a",
|
88
|
+
%w(http://foo# /a) => "http://foo/a", #!!
|
89
|
+
%w(http://foo# #a) => "http://foo#a",
|
90
|
+
|
91
|
+
%w(http://foo/bar a) => "http://foo/bar/a",
|
92
|
+
%w(http://foo/bar /a) => "http://foo/bar/a",
|
93
|
+
%w(http://foo/bar #a) => "http://foo/bar#a",
|
94
|
+
|
95
|
+
%w(http://foo/bar/ a) => "http://foo/bar/a",
|
96
|
+
%w(http://foo/bar/ /a) => "http://foo/bar/a",
|
97
|
+
%w(http://foo/bar/ #a) => "http://foo/bar#a", #!!
|
98
|
+
|
99
|
+
%w(http://foo/bar# a) => "http://foo/bar#a",
|
100
|
+
%w(http://foo/bar# /a) => "http://foo/bar/a", #!!
|
101
|
+
%w(http://foo/bar# #a) => "http://foo/bar#a",
|
102
|
+
|
103
|
+
%w(urn:isbn: 0451450523) => "urn:isbn:0451450523",
|
104
|
+
%w(urn:isbn: :0451450523) => "urn:isbn:0451450523",
|
105
|
+
|
106
|
+
%w(urn:isbn 0451450523) => "urn:isbn:0451450523",
|
107
|
+
%w(urn:isbn :0451450523) => "urn:isbn:0451450523",
|
108
|
+
}.each_pair do |input, result|
|
109
|
+
it "should create <#{result}> from <#{input[0]}> and '#{input[1]}'" do
|
110
|
+
(RDF::URI.new(input[0]) / input[1]).to_s.should == result
|
111
|
+
(RDF::URI.new(input[0]) / RDF::URI.new(input[1])).to_s.should == result
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should raise an ArgumentError when receiving an absolute URI as a fragment" do
|
116
|
+
lambda { RDF::URI.new('http://example.org') / RDF::URI.new('http://example.com') }.should raise_error ArgumentError
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context "using concatenation (#+)" do
|
121
|
+
{
|
122
|
+
%w(http://foo/ a) => "http://foo/a",
|
123
|
+
%w(http://foo/ /a) => "http://foo//a",
|
124
|
+
%w(http://foo/ #a) => "http://foo/#a",
|
125
|
+
|
126
|
+
%w(urn:isbn :0451450523) => "urn:isbn:0451450523",
|
127
|
+
%w(urn:isbn 0451450523) => "urn:isbn0451450523",
|
128
|
+
|
129
|
+
%w(http://example.org/test test) => "http://example.org/testtest",
|
130
|
+
}.each_pair do |input, result|
|
131
|
+
it "should create <#{result}> from <#{input[0]}> and '#{input[1]}'" do
|
132
|
+
(RDF::URI.new(input[0]) + input[1]).to_s.should == result
|
133
|
+
(RDF::URI.new(input[0]) + RDF::URI.new(input[1])).to_s.should == result
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context "using normalized merging (#join)" do
|
139
|
+
|
140
|
+
before :all do
|
141
|
+
@writer = RDF::Writer.for(:ntriples)
|
142
|
+
end
|
143
|
+
|
144
|
+
before :each do
|
145
|
+
@subject = RDF::URI.new("http://example.org")
|
146
|
+
end
|
147
|
+
|
148
|
+
it "appends fragment to uri" do
|
149
|
+
@subject.join("foo").to_s.should == "http://example.org/foo"
|
150
|
+
end
|
151
|
+
|
152
|
+
it "appends another fragment" do
|
153
|
+
@subject.join("foo#bar").to_s.should == "http://example.org/foo#bar"
|
154
|
+
end
|
155
|
+
|
156
|
+
it "appends another URI" do
|
157
|
+
@subject.join(RDF::URI.new("foo#bar")).to_s.should == "http://example.org/foo#bar"
|
158
|
+
end
|
159
|
+
|
160
|
+
{
|
161
|
+
%w(http://foo ) => "<http://foo>",
|
162
|
+
%w(http://foo a) => "<http://foo/a>",
|
163
|
+
%w(http://foo /a) => "<http://foo/a>",
|
164
|
+
%w(http://foo #a) => "<http://foo#a>",
|
165
|
+
|
166
|
+
%w(http://foo/ ) => "<http://foo/>",
|
167
|
+
%w(http://foo/ a) => "<http://foo/a>",
|
168
|
+
%w(http://foo/ /a) => "<http://foo/a>",
|
169
|
+
%w(http://foo/ #a) => "<http://foo/#a>",
|
170
|
+
|
171
|
+
%w(http://foo# ) => "<http://foo#>",
|
172
|
+
%w(http://foo# a) => "<http://foo/a>",
|
173
|
+
%w(http://foo# /a) => "<http://foo/a>",
|
174
|
+
%w(http://foo# #a) => "<http://foo#a>",
|
175
|
+
|
176
|
+
%w(http://foo/bar ) => "<http://foo/bar>",
|
177
|
+
%w(http://foo/bar a) => "<http://foo/a>",
|
178
|
+
%w(http://foo/bar /a) => "<http://foo/a>",
|
179
|
+
%w(http://foo/bar #a) => "<http://foo/bar#a>",
|
180
|
+
|
181
|
+
%w(http://foo/bar/ ) => "<http://foo/bar/>",
|
182
|
+
%w(http://foo/bar/ a) => "<http://foo/bar/a>",
|
183
|
+
%w(http://foo/bar/ /a) => "<http://foo/a>",
|
184
|
+
%w(http://foo/bar/ #a) => "<http://foo/bar/#a>",
|
185
|
+
|
186
|
+
%w(http://foo/bar# ) => "<http://foo/bar#>",
|
187
|
+
%w(http://foo/bar# a) => "<http://foo/a>",
|
188
|
+
%w(http://foo/bar# /a) => "<http://foo/a>",
|
189
|
+
%w(http://foo/bar# #a) => "<http://foo/bar#a>",
|
190
|
+
|
191
|
+
}.each_pair do |input, result|
|
192
|
+
it "creates #{result} from <#{input[0]}> and '#{input[1]}'" do
|
193
|
+
@writer.serialize(RDF::URI.new(input[0]).join(input[1].to_s)).should == result
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
74
198
|
end
|
data/lib/rdf/spec/value.rb
CHANGED
data/lib/rdf/spec/version.rb
CHANGED
data/lib/rdf/spec/vocab.rb
CHANGED
data/lib/rdf/spec/writable.rb
CHANGED
data/lib/rdf/spec/writer.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -4,75 +4,75 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 2
|
8
7
|
- 3
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Arto Bendiken
|
13
13
|
- Ben Lavender
|
14
|
+
- Gregg Kellogg
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-12-27 00:00:00 +01:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
23
|
+
name: rspec
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
28
29
|
segments:
|
29
|
-
-
|
30
|
-
-
|
31
|
-
|
32
|
-
|
33
|
-
type: :development
|
30
|
+
- 2
|
31
|
+
- 1
|
32
|
+
version: "2.1"
|
33
|
+
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: yard
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
segments:
|
43
|
-
- 1
|
44
|
-
- 3
|
45
43
|
- 0
|
46
|
-
|
44
|
+
- 6
|
45
|
+
- 0
|
46
|
+
version: 0.6.0
|
47
47
|
type: :development
|
48
48
|
version_requirements: *id002
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
50
|
+
name: rspec
|
51
51
|
prerelease: false
|
52
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
segments:
|
57
|
-
- 0
|
58
57
|
- 2
|
59
|
-
-
|
60
|
-
|
58
|
+
- 1
|
59
|
+
- 0
|
60
|
+
version: 2.1.0
|
61
61
|
type: :development
|
62
62
|
version_requirements: *id003
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
64
|
+
name: rdf
|
65
65
|
prerelease: false
|
66
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - ~>
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
segments:
|
71
|
-
-
|
71
|
+
- 0
|
72
72
|
- 3
|
73
73
|
- 0
|
74
|
-
version:
|
75
|
-
type: :
|
74
|
+
version: 0.3.0
|
75
|
+
type: :development
|
76
76
|
version_requirements: *id004
|
77
77
|
description: RDF.rb plugin that provides RSpec matchers and shared examples for RDF objects.
|
78
78
|
email: public-rdf-ruby@w3.org
|
@@ -84,7 +84,7 @@ extra_rdoc_files: []
|
|
84
84
|
|
85
85
|
files:
|
86
86
|
- AUTHORS
|
87
|
-
-
|
87
|
+
- CREDITS
|
88
88
|
- README
|
89
89
|
- UNLICENSE
|
90
90
|
- VERSION
|
@@ -94,6 +94,8 @@ files:
|
|
94
94
|
- lib/rdf/spec/enumerable.rb
|
95
95
|
- lib/rdf/spec/format.rb
|
96
96
|
- lib/rdf/spec/graph.rb
|
97
|
+
- lib/rdf/spec/indexable.rb
|
98
|
+
- lib/rdf/spec/inferable.rb
|
97
99
|
- lib/rdf/spec/list.rb
|
98
100
|
- lib/rdf/spec/literal.rb
|
99
101
|
- lib/rdf/spec/matchers.rb
|
@@ -106,6 +108,8 @@ files:
|
|
106
108
|
- lib/rdf/spec/repository.rb
|
107
109
|
- lib/rdf/spec/resource.rb
|
108
110
|
- lib/rdf/spec/statement.rb
|
111
|
+
- lib/rdf/spec/term.rb
|
112
|
+
- lib/rdf/spec/transaction.rb
|
109
113
|
- lib/rdf/spec/uri.rb
|
110
114
|
- lib/rdf/spec/value.rb
|
111
115
|
- lib/rdf/spec/version.rb
|
data/CONTRIBUTORS
DELETED