tommorris-rena 0.0.1
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/README.txt +48 -0
- data/Rakefile +50 -0
- data/lib/rena/bnode.rb +63 -0
- data/lib/rena/exceptions/about_each_exception.rb +2 -0
- data/lib/rena/exceptions/uri_relative_exception.rb +2 -0
- data/lib/rena/graph.rb +150 -0
- data/lib/rena/literal.rb +89 -0
- data/lib/rena/namespace.rb +74 -0
- data/lib/rena/rdfxmlparser.rb +182 -0
- data/lib/rena/rexml_hacks.rb +70 -0
- data/lib/rena/triple.rb +72 -0
- data/lib/rena/uriref.rb +41 -0
- data/lib/rena.rb +5 -0
- data/rena.gemspec +16 -0
- data/test/spec/bnode.spec.rb +25 -0
- data/test/spec/graph.spec.rb +108 -0
- data/test/spec/literal.spec.rb +112 -0
- data/test/spec/namespaces.spec.rb +44 -0
- data/test/spec/parser.spec.rb +288 -0
- data/test/spec/rexml_hacks.spec.rb +76 -0
- data/test/spec/triple.spec.rb +32 -0
- data/test/spec/uriref.spec.rb +47 -0
- data/test/test_uris.rb +13 -0
- data/test/xml.rdf +6 -0
- metadata +84 -0
@@ -0,0 +1,288 @@
|
|
1
|
+
require 'lib/rena'
|
2
|
+
|
3
|
+
# w3c test suite: http://www.w3.org/TR/rdf-testcases/
|
4
|
+
|
5
|
+
describe "RDF/XML Parser" do
|
6
|
+
it "should be able to detect whether an XML file is indeed an RDF file" do
|
7
|
+
bad_doc = "<?xml version=\"1.0\"?><RDF><foo /></RDF>"
|
8
|
+
bad_graph = RdfXmlParser.new(bad_doc)
|
9
|
+
bad_graph.is_rdf?.should == false
|
10
|
+
|
11
|
+
good_doc = "<?xml version=\"1.0\"?><rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"></rdf:RDF>"
|
12
|
+
good_graph = RdfXmlParser.new(good_doc)
|
13
|
+
good_graph.is_rdf?.should == true
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should be able to parse a simple single-triple document" do
|
17
|
+
sampledoc = <<-EOF;
|
18
|
+
<?xml version="1.0" ?>
|
19
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
20
|
+
xmlns:ex="http://www.example.org/" xml:lang="en" xml:base="http://www.example.org/foo">
|
21
|
+
<rdf:Description rdf:about="#" ex:name="bar">
|
22
|
+
<ex:belongsTo rdf:resource="http://tommorris.org/" />
|
23
|
+
<ex:sampleText rdf:datatype="http://www.w3.org/2001/XMLSchema#string">foo</ex:sampleText>
|
24
|
+
<ex:hadADodgyRelationshipWith rdf:parseType="Resource">
|
25
|
+
<ex:name>Tom</ex:name>
|
26
|
+
</ex:hadADodgyRelationshipWith>
|
27
|
+
</rdf:Description>
|
28
|
+
</rdf:RDF>
|
29
|
+
EOF
|
30
|
+
|
31
|
+
graph = RdfXmlParser.new(sampledoc)
|
32
|
+
graph.is_rdf?.should == true
|
33
|
+
graph.graph.size == 6
|
34
|
+
# print graph.graph.to_ntriples
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should raise an error if rdf:aboutEach is used, as per the negative parser test rdfms-abouteach-error001 (rdf:aboutEach attribute)" do
|
38
|
+
sampledoc = <<-EOF;
|
39
|
+
<?xml version="1.0" ?>
|
40
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
41
|
+
xmlns:eg="http://example.org/">
|
42
|
+
|
43
|
+
<rdf:Bag rdf:ID="node">
|
44
|
+
<rdf:li rdf:resource="http://example.org/node2"/>
|
45
|
+
</rdf:Bag>
|
46
|
+
|
47
|
+
<rdf:Description rdf:aboutEach="#node">
|
48
|
+
<dc:rights xmlns:dc="http://purl.org/dc/elements/1.1/">me</dc:rights>
|
49
|
+
|
50
|
+
</rdf:Description>
|
51
|
+
|
52
|
+
</rdf:RDF>
|
53
|
+
EOF
|
54
|
+
|
55
|
+
lambda do
|
56
|
+
graph = RdfXmlParser.new(sampledoc)
|
57
|
+
end.should raise_error
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should raise an error if rdf:aboutEachPrefix is used, as per the negative parser test rdfms-abouteach-error002 (rdf:aboutEachPrefix attribute)" do
|
61
|
+
sampledoc = <<-EOF;
|
62
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
63
|
+
xmlns:eg="http://example.org/">
|
64
|
+
|
65
|
+
<rdf:Description rdf:about="http://example.org/node">
|
66
|
+
<eg:property>foo</eg:property>
|
67
|
+
</rdf:Description>
|
68
|
+
|
69
|
+
<rdf:Description rdf:aboutEachPrefix="http://example.org/">
|
70
|
+
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">me</dc:creator>
|
71
|
+
|
72
|
+
</rdf:Description>
|
73
|
+
|
74
|
+
</rdf:RDF>
|
75
|
+
EOF
|
76
|
+
|
77
|
+
lambda do
|
78
|
+
graph = RdfXmlParser.new(sampledoc)
|
79
|
+
end.should raise_error
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should fail if given a non-ID as an ID (as per rdfcore-rdfms-rdf-id-error001)" do
|
83
|
+
sampledoc = <<-EOF;
|
84
|
+
<?xml version="1.0"?>
|
85
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
86
|
+
<rdf:Description rdf:ID='333-555-666' />
|
87
|
+
</rdf:RDF>
|
88
|
+
EOF
|
89
|
+
|
90
|
+
lambda do
|
91
|
+
graph = RdfXmlParser.new(sampledoc)
|
92
|
+
end.should raise_error
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should make sure that the value of rdf:ID attributes match the XML Name production (child-element version)" do
|
96
|
+
sampledoc = <<-EOF;
|
97
|
+
<?xml version="1.0" ?>
|
98
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
99
|
+
xmlns:eg="http://example.org/">
|
100
|
+
<rdf:Description>
|
101
|
+
<eg:prop rdf:ID="q:name" />
|
102
|
+
</rdf:Description>
|
103
|
+
</rdf:RDF>
|
104
|
+
EOF
|
105
|
+
|
106
|
+
lambda do
|
107
|
+
graph = RdfXmlParser.new(sampledoc)
|
108
|
+
end.should raise_error
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should make sure that the value of rdf:ID attributes match the XML Name production (data attribute version)" do
|
112
|
+
sampledoc = <<-EOF;
|
113
|
+
<?xml version="1.0" ?>
|
114
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
115
|
+
xmlns:eg="http://example.org/">
|
116
|
+
<rdf:Description rdf:ID="a/b" eg:prop="val" />
|
117
|
+
</rdf:RDF>
|
118
|
+
EOF
|
119
|
+
|
120
|
+
lambda do
|
121
|
+
graph = RdfXmlParser.new(sampledoc)
|
122
|
+
end.should raise_error
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should handle parseType=Literal according to xml-literal-namespaces-test001.rdf test" do
|
126
|
+
sampledoc = <<-EOF;
|
127
|
+
<?xml version="1.0"?>
|
128
|
+
|
129
|
+
<!--
|
130
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
131
|
+
Technology, Institut National de Recherche en Informatique et en
|
132
|
+
Automatique, Keio University).
|
133
|
+
|
134
|
+
All Rights Reserved.
|
135
|
+
|
136
|
+
Please see the full Copyright clause at
|
137
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
138
|
+
|
139
|
+
Description: Visibly used namespaces must be included in XML
|
140
|
+
Literal values. Treatment of namespaces that are not
|
141
|
+
visibly used (e.g. rdf: in this example) is implementation
|
142
|
+
dependent. Based on example from Issues List.
|
143
|
+
|
144
|
+
|
145
|
+
$Id: test001.rdf,v 1.2 2002/11/22 13:52:15 jcarroll Exp $
|
146
|
+
|
147
|
+
-->
|
148
|
+
<rdf:RDF xmlns="http://www.w3.org/1999/xhtml"
|
149
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
150
|
+
xmlns:html="http://NoHTML.example.org"
|
151
|
+
xmlns:my="http://my.example.org/">
|
152
|
+
<rdf:Description rdf:ID="John_Smith">
|
153
|
+
<my:Name rdf:parseType="Literal">
|
154
|
+
<html:h1>
|
155
|
+
<b>John</b>
|
156
|
+
</html:h1>
|
157
|
+
</my:Name>
|
158
|
+
|
159
|
+
</rdf:Description>
|
160
|
+
</rdf:RDF>
|
161
|
+
EOF
|
162
|
+
|
163
|
+
graph = RdfXmlParser.new(sampledoc, "http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-xml-literal-namespaces/test001.rdf")
|
164
|
+
graph.graph.to_ntriples.should == "<http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-xml-literal-namespaces/test001.rdf#John_Smith> <http://my.example.org/Name> \"<html:h1>\n <b>John</b>\n </html:h1>\"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> .\n"
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should pass rdfms-syntax-incomplete-test001" do
|
168
|
+
sampledoc = <<-EOF;
|
169
|
+
<?xml version="1.0"?>
|
170
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
171
|
+
xmlns:eg="http://example.org/">
|
172
|
+
|
173
|
+
<rdf:Description rdf:nodeID="a">
|
174
|
+
<eg:property rdf:nodeID="a" />
|
175
|
+
</rdf:Description>
|
176
|
+
|
177
|
+
</rdf:RDF>
|
178
|
+
EOF
|
179
|
+
|
180
|
+
lambda do
|
181
|
+
graph = RdfXmlParser.new(sampledoc)
|
182
|
+
end.should_not raise_error
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should pass rdfms-syntax-incomplete-test002" do
|
186
|
+
sampledoc = <<-EOF;
|
187
|
+
<?xml version="1.0"?>
|
188
|
+
|
189
|
+
<!--
|
190
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
191
|
+
Technology, Institut National de Recherche en Informatique et en
|
192
|
+
Automatique, Keio University).
|
193
|
+
|
194
|
+
All Rights Reserved.
|
195
|
+
|
196
|
+
Please see the full Copyright clause at
|
197
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
198
|
+
|
199
|
+
-->
|
200
|
+
<!--
|
201
|
+
|
202
|
+
rdf:nodeID can be used to label a blank node.
|
203
|
+
These have file scope and are distinct from any
|
204
|
+
unlabelled blank nodes.
|
205
|
+
$Id: test002.rdf,v 1.1 2002/07/30 09:46:05 jcarroll Exp $
|
206
|
+
|
207
|
+
-->
|
208
|
+
|
209
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
210
|
+
xmlns:eg="http://example.org/">
|
211
|
+
|
212
|
+
<rdf:Description rdf:nodeID="a">
|
213
|
+
<eg:property1 rdf:nodeID="a" />
|
214
|
+
</rdf:Description>
|
215
|
+
<rdf:Description>
|
216
|
+
<eg:property2>
|
217
|
+
|
218
|
+
<!-- Note the rdf:nodeID="b" is redundant. -->
|
219
|
+
<rdf:Description rdf:nodeID="b">
|
220
|
+
<eg:property3 rdf:nodeID="a" />
|
221
|
+
</rdf:Description>
|
222
|
+
</eg:property2>
|
223
|
+
</rdf:Description>
|
224
|
+
|
225
|
+
</rdf:RDF>
|
226
|
+
EOF
|
227
|
+
|
228
|
+
lambda do
|
229
|
+
graph = RdfXmlParser.new(sampledoc)
|
230
|
+
end.should_not raise_error
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should pass rdfms-syntax-incomplete/test003.rdf" do
|
234
|
+
sampledoc = <<-EOF;
|
235
|
+
<?xml version="1.0"?>
|
236
|
+
|
237
|
+
<!--
|
238
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
239
|
+
Technology, Institut National de Recherche en Informatique et en
|
240
|
+
Automatique, Keio University).
|
241
|
+
|
242
|
+
All Rights Reserved.
|
243
|
+
|
244
|
+
Please see the full Copyright clause at
|
245
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
246
|
+
|
247
|
+
-->
|
248
|
+
<!--
|
249
|
+
|
250
|
+
On an rdf:Description or typed node rdf:nodeID behaves
|
251
|
+
similarly to an rdf:about.
|
252
|
+
$Id: test003.rdf,v 1.2 2003/07/24 15:51:06 jcarroll Exp $
|
253
|
+
|
254
|
+
-->
|
255
|
+
|
256
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
257
|
+
xmlns:eg="http://example.org/">
|
258
|
+
|
259
|
+
<!-- In this example the rdf:nodeID is redundant. -->
|
260
|
+
<rdf:Description rdf:nodeID="a" eg:property1="value" />
|
261
|
+
|
262
|
+
</rdf:RDF>
|
263
|
+
EOF
|
264
|
+
|
265
|
+
lambda do
|
266
|
+
graph = RdfXmlParser.new(sampledoc)
|
267
|
+
end.should_not raise_error
|
268
|
+
end
|
269
|
+
|
270
|
+
# when we have decent Unicode support, add http://www.w3.org/2000/10/rdf-tests/rdfcore/rdfms-rdf-id/error005.rdf
|
271
|
+
|
272
|
+
it "should support reification" do
|
273
|
+
pending
|
274
|
+
end
|
275
|
+
|
276
|
+
it "detect bad bagIDs" do
|
277
|
+
sampledoc = <<-EOF;
|
278
|
+
<?xml version="1.0" ?>
|
279
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
280
|
+
<rdf:Description rdf:bagID='333-555-666' />
|
281
|
+
</rdf:RDF>
|
282
|
+
EOF
|
283
|
+
|
284
|
+
lambda do
|
285
|
+
graph = RdfXmlParser.new(sampledoc)
|
286
|
+
end.should raise_error
|
287
|
+
end
|
288
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'lib/rena'
|
2
|
+
require 'rexml/document'
|
3
|
+
#require 'lib/rexml_hacks'
|
4
|
+
|
5
|
+
describe "REXML" do
|
6
|
+
before do
|
7
|
+
string = <<-EOF;
|
8
|
+
<?xml version="1.0" ?>
|
9
|
+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.org/" xml:lang="en" xml:base="http://example.org/">
|
10
|
+
<rdf:Description>
|
11
|
+
<foo>bar</foo>
|
12
|
+
<bar:bar xmlns:bar="http://foo.com/">foo</bar:bar>
|
13
|
+
<ex:ex>fap</ex:ex>
|
14
|
+
</rdf:Description>
|
15
|
+
</rdf:RDF>
|
16
|
+
EOF
|
17
|
+
|
18
|
+
@doc = REXML::Document.new(string)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have support for xml:base" do
|
22
|
+
@doc.root.elements[1].base?.should == true
|
23
|
+
@doc.root.elements[1].base.should == "http://example.org/"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have support for xml:lang" do
|
27
|
+
@doc.root.elements[1].lang?.should == true
|
28
|
+
@doc.root.elements[1].lang.should == "en"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should allow individual writing-out of XML" do
|
32
|
+
# puts @doc.root.elements[1].write
|
33
|
+
|
34
|
+
sampledoc = <<-EOF;
|
35
|
+
<?xml version="1.0"?>
|
36
|
+
|
37
|
+
<!--
|
38
|
+
Copyright World Wide Web Consortium, (Massachusetts Institute of
|
39
|
+
Technology, Institut National de Recherche en Informatique et en
|
40
|
+
Automatique, Keio University).
|
41
|
+
|
42
|
+
All Rights Reserved.
|
43
|
+
|
44
|
+
Please see the full Copyright clause at
|
45
|
+
<http://www.w3.org/Consortium/Legal/copyright-software.html>
|
46
|
+
|
47
|
+
Description: Visibly used namespaces must be included in XML
|
48
|
+
Literal values. Treatment of namespaces that are not
|
49
|
+
visibly used (e.g. rdf: in this example) is implementation
|
50
|
+
dependent. Based on example from Issues List.
|
51
|
+
|
52
|
+
|
53
|
+
$Id: test001.rdf,v 1.2 2002/11/22 13:52:15 jcarroll Exp $
|
54
|
+
|
55
|
+
-->
|
56
|
+
<rdf:RDF xmlns="http://www.w3.org/1999/xhtml"
|
57
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
58
|
+
xmlns:html="http://NoHTML.example.org"
|
59
|
+
xmlns:my="http://my.example.org/">
|
60
|
+
<rdf:Description rdf:ID="John_Smith">
|
61
|
+
<my:Name rdf:parseType="Literal">
|
62
|
+
<html:h1>
|
63
|
+
<b>John</b>
|
64
|
+
</html:h1>
|
65
|
+
</my:Name>
|
66
|
+
|
67
|
+
</rdf:Description>
|
68
|
+
</rdf:RDF>
|
69
|
+
EOF
|
70
|
+
doc2 = REXML::Document.new(sampledoc)
|
71
|
+
expectedoutput = "<html:h1 xmlns:html=\'http://NoHTML.example.org\' xmlns:my=\'http://my.example.org/\' xmlns:rdf=\'http://www.w3.org/1999/02/22-rdf-syntax-ns#\'>\n <b xmlns=\'http://www.w3.org/1999/xhtml\'>John</b>\n </html:h1>"
|
72
|
+
doc2.root.elements[1].elements[1].elements[1].write.should == expectedoutput
|
73
|
+
|
74
|
+
# pending
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'lib/rena'
|
2
|
+
|
3
|
+
describe "Triples" do
|
4
|
+
it "should have a subject" do
|
5
|
+
f = Triple.new(BNode.new, URIRef.new('http://xmlns.com/foaf/0.1/knows'), BNode.new)
|
6
|
+
f.subject.class.should == BNode
|
7
|
+
# puts f.to_ntriples
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should require that the subject is a URIRef or BNode" do
|
11
|
+
lambda do
|
12
|
+
Triple.new(Literal.new("foo"), URIRef.new("http://xmlns.com/foaf/0.1/knows"), BNode.new)
|
13
|
+
end.should raise_error
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should require that the predicate is a URIRef" do
|
17
|
+
lambda do
|
18
|
+
Triple.new(BNode.new, BNode.new, BNode.new)
|
19
|
+
end.should raise_error
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should require that the object is a URIRef, BNode, Literal or Typed Literal" do
|
23
|
+
lambda do
|
24
|
+
Triple.new(BNode.new, URIRef.new("http://xmlns.com/foaf/0.1/knows"), [])
|
25
|
+
end.should raise_error
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should emit an NTriple" do
|
29
|
+
f = Triple.new(URIRef.new("http://tommorris.org/foaf#me"), URIRef.new("http://xmlns.com/foaf/0.1/name"), Literal.new("Tom Morris"))
|
30
|
+
f.to_ntriples.should == "<http://tommorris.org/foaf#me> <http://xmlns.com/foaf/0.1/name> \"Tom Morris\" ."
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'lib/rena'
|
2
|
+
#require 'lib/uriref'
|
3
|
+
|
4
|
+
describe "URI References" do
|
5
|
+
it "should output NTriples" do
|
6
|
+
f = URIRef.new("http://tommorris.org/foaf/")
|
7
|
+
f.to_ntriples.should == "<http://tommorris.org/foaf/>"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should handle Unicode symbols inside URLs" do
|
11
|
+
lambda do
|
12
|
+
f = URIRef.new("http://example.org/#Andr%E9")
|
13
|
+
end.should_not raise_error
|
14
|
+
end
|
15
|
+
|
16
|
+
# it "do not contain any control characters (#x00 - #x1F, #x74-#x9F)" do
|
17
|
+
# lambda do
|
18
|
+
# f = URIRef.new("http://tommorris.org/blog/")
|
19
|
+
# f.test_string("http://tommorris.org/blog")
|
20
|
+
# end.should_not raise_error
|
21
|
+
#
|
22
|
+
# lambda do
|
23
|
+
# f = URIRef.new("http://xmlns.com/foaf/0.1/knows")
|
24
|
+
# f.test_string("http://xmlns.com/foaf/0.1/knows")
|
25
|
+
# end.should_not raise_error
|
26
|
+
# end
|
27
|
+
|
28
|
+
it "produce a valid URI character sequence (per RFC 2396 §2.1) representing an absolute URI with optional fragment identifier" do
|
29
|
+
pending "TODO: figure out a series of tests for RFC 2396 §2.1 adherence"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should throw errors on suspicious protocols and non-protocols" do
|
33
|
+
lambda do
|
34
|
+
URIRef.new("javascript:alert(\"pass\")")
|
35
|
+
end.should raise_error
|
36
|
+
end
|
37
|
+
|
38
|
+
it "must not be a relative URI" do
|
39
|
+
lambda do
|
40
|
+
URIRef.new("foo")
|
41
|
+
end.should raise_error
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should discourage use of %-escaped characters" do
|
45
|
+
pending "TODO: figure out a way to discourage %-escaped character usage"
|
46
|
+
end
|
47
|
+
end
|
data/test/test_uris.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'uri'
|
3
|
+
require 'cgi'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'addressable/uri'
|
6
|
+
|
7
|
+
class TestUris < Test::Unit::TestCase
|
8
|
+
def test_encoding
|
9
|
+
f = Addressable::URI.parse("http://example.org/André")
|
10
|
+
assert_equal("http://example.org/André", f.to_s)
|
11
|
+
assert_equal(false, f.relative?)
|
12
|
+
end
|
13
|
+
end
|
data/test/xml.rdf
ADDED
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tommorris-rena
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tom Morris
|
8
|
+
- Pius Uzamere
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2008-07-13 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: addressable
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.1
|
24
|
+
version:
|
25
|
+
description: Rena is a Ruby library for manipulating RDF files.
|
26
|
+
email: tom@tommorris.org
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- README.txt
|
35
|
+
- Rakefile
|
36
|
+
- rena.gemspec
|
37
|
+
- lib/rena.rb
|
38
|
+
- lib/rena/bnode.rb
|
39
|
+
- lib/rena/graph.rb
|
40
|
+
- lib/rena/literal.rb
|
41
|
+
- lib/rena/namespace.rb
|
42
|
+
- lib/rena/rdfxmlparser.rb
|
43
|
+
- lib/rena/rexml_hacks.rb
|
44
|
+
- lib/rena/triple.rb
|
45
|
+
- lib/rena/uriref.rb
|
46
|
+
- lib/rena/exceptions/about_each_exception.rb
|
47
|
+
- lib/rena/exceptions/uri_relative_exception.rb
|
48
|
+
has_rdoc: true
|
49
|
+
homepage: http://github.com/tommorris/rena
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 1.2.0
|
71
|
+
signing_key:
|
72
|
+
specification_version: 2
|
73
|
+
summary: Ruby RDF library.
|
74
|
+
test_files:
|
75
|
+
- test/test_uris.rb
|
76
|
+
- test/xml.rdf
|
77
|
+
- test/spec/bnode.spec.rb
|
78
|
+
- test/spec/graph.spec.rb
|
79
|
+
- test/spec/literal.spec.rb
|
80
|
+
- test/spec/namespaces.spec.rb
|
81
|
+
- test/spec/parser.spec.rb
|
82
|
+
- test/spec/rexml_hacks.spec.rb
|
83
|
+
- test/spec/triple.spec.rb
|
84
|
+
- test/spec/uriref.spec.rb
|