rdf-spec 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/etc/bendiken.nq +8 -0
- data/etc/bendiken.nt +8 -0
- data/etc/bendiken.ttl +17 -0
- data/etc/bhuga.nq +6 -0
- data/etc/bhuga.nt +6 -0
- data/etc/bhuga.ttl +15 -0
- data/etc/doap.nq +92 -0
- data/etc/doap.nt +3 -22
- data/etc/doap.ttl +53 -0
- data/etc/gkellogg.nq +5 -0
- data/etc/gkellogg.nt +5 -0
- data/etc/gkellogg.ttl +14 -0
- data/etc/test-data.nt +11 -0
- data/lib/rdf/spec/format.rb +22 -1
- data/lib/rdf/spec/queryable.rb +236 -141
- data/lib/rdf/spec/reader.rb +163 -1
- data/lib/rdf/spec/version.rb +1 -1
- data/lib/rdf/spec/writer.rb +169 -1
- data/spec/queryable_spec.rb +1 -3
- data/spec/spec_helper.rb +4 -1
- metadata +56 -96
- data/lib/rdf/spec/list.rb +0 -712
- data/lib/rdf/spec/literal.rb +0 -615
- data/lib/rdf/spec/node.rb +0 -11
- data/lib/rdf/spec/resource.rb +0 -7
- data/lib/rdf/spec/statement.rb +0 -214
- data/lib/rdf/spec/term.rb +0 -7
- data/lib/rdf/spec/uri.rb +0 -198
- data/lib/rdf/spec/value.rb +0 -28
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/etc/bendiken.nq
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<http://ar.to/#self> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://ar.to/#self> .
|
2
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" <http://ar.to/#self> .
|
3
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto.bendiken@gmail.com> <http://ar.to/#self> .
|
4
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d0737cceb55eb7d740578d2db1bc0727e3ed49ce" <http://ar.to/#self> .
|
5
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "a033f652c84a4d73b8c26d318c2395699dd2bdfb" <http://ar.to/#self> .
|
6
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/homepage> <http://ar.to/> <http://ar.to/#self> .
|
7
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/made> <http://rubygems.org/gems/rdf> <http://ar.to/#self> .
|
8
|
+
<http://ar.to/#self> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bendiken/foaf> <http://ar.to/#self> .
|
data/etc/bendiken.nt
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<http://ar.to/#self> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
2
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" .
|
3
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto.bendiken@gmail.com> .
|
4
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d0737cceb55eb7d740578d2db1bc0727e3ed49ce" .
|
5
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "a033f652c84a4d73b8c26d318c2395699dd2bdfb" .
|
6
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/homepage> <http://ar.to/> .
|
7
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/made> <http://rubygems.org/gems/rdf> .
|
8
|
+
<http://ar.to/#self> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bendiken/foaf> .
|
data/etc/bendiken.ttl
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
@base <http://rubygems.org/gems/rdf> .
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
4
|
+
@prefix dc: <http://purl.org/dc/terms/> .
|
5
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
6
|
+
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
7
|
+
@prefix ex: <http://example.org/> .
|
8
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
9
|
+
|
10
|
+
<http://ar.to/#self> a foaf:Person ;
|
11
|
+
foaf:name "Arto Bendiken" ;
|
12
|
+
foaf:mbox <mailto:arto.bendiken@gmail.com> ;
|
13
|
+
foaf:mbox_sha1sum "d0737cceb55eb7d740578d2db1bc0727e3ed49ce",
|
14
|
+
"a033f652c84a4d73b8c26d318c2395699dd2bdfb" ;
|
15
|
+
foaf:homepage <http://ar.to/> ;
|
16
|
+
foaf:made <> ;
|
17
|
+
rdfs:isDefinedBy <http://datagraph.org/bendiken/foaf> .
|
data/etc/bhuga.nq
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
<http://bhuga.net/#ben> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://bhuga.net/#ben> .
|
2
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" <http://bhuga.net/#ben> .
|
3
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> <http://bhuga.net/#ben> .
|
4
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" <http://bhuga.net/#ben> .
|
5
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <http://bhuga.net/> <http://bhuga.net/#ben> .
|
6
|
+
<http://bhuga.net/#ben> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bhuga/foaf> <http://bhuga.net/#ben> .
|
data/etc/bhuga.nt
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
<http://bhuga.net/#ben> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
2
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" .
|
3
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> .
|
4
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" .
|
5
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <http://bhuga.net/> .
|
6
|
+
<http://bhuga.net/#ben> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bhuga/foaf> .
|
data/etc/bhuga.ttl
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
@base <http://rubygems.org/gems/rdf> .
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
4
|
+
@prefix dc: <http://purl.org/dc/terms/> .
|
5
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
6
|
+
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
7
|
+
@prefix ex: <http://example.org/> .
|
8
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
9
|
+
|
10
|
+
<http://bhuga.net/#ben> a foaf:Person ;
|
11
|
+
foaf:name "Ben Lavender" ;
|
12
|
+
foaf:mbox <mailto:blavender@gmail.com> ;
|
13
|
+
foaf:mbox_sha1sum "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" ;
|
14
|
+
foaf:homepage <http://bhuga.net/> ;
|
15
|
+
rdfs:isDefinedBy <http://datagraph.org/bhuga/foaf> .
|
data/etc/doap.nq
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
<http://ar.to/#self> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://ar.to/#self> .
|
2
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" <http://ar.to/#self> .
|
3
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto.bendiken@gmail.com> <http://ar.to/#self> .
|
4
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d0737cceb55eb7d740578d2db1bc0727e3ed49ce" <http://ar.to/#self> .
|
5
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "a033f652c84a4d73b8c26d318c2395699dd2bdfb" <http://ar.to/#self> .
|
6
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/homepage> <http://ar.to/> <http://ar.to/#self> .
|
7
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/made> <http://rubygems.org/gems/rdf> <http://ar.to/#self> .
|
8
|
+
<http://ar.to/#self> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bendiken/foaf> <http://ar.to/#self> .
|
9
|
+
<http://bhuga.net/#ben> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://bhuga.net/#ben> .
|
10
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" <http://bhuga.net/#ben> .
|
11
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> <http://bhuga.net/#ben> .
|
12
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" <http://bhuga.net/#ben> .
|
13
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <http://bhuga.net/> <http://bhuga.net/#ben> .
|
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/#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://greggkellogg.net/#me> .
|
16
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" <http://greggkellogg.net/#me> .
|
17
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@greggkellogg.net> <http://greggkellogg.net/#me> .
|
18
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "b7a856d39fc3f02573271d9901f1f9107147f657" <http://greggkellogg.net/#me> .
|
19
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/homepage> <http://greggkellogg.net/> <http://greggkellogg.net/#me> .
|
20
|
+
<http://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self> .
|
21
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://ar.to/> .
|
22
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://blog.datagraph.org/> .
|
23
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#bug-database> <http://github.com/bendiken/rdf/issues> .
|
24
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Resource_Description_Framework> .
|
25
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Ruby_(programming_language)> .
|
26
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#created> "2007-10-23" .
|
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
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://ar.to/#self> .
|
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/#me> .
|
31
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://ar.to/#self> .
|
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/#me> .
|
34
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <http://rubyforge.org/projects/rdf/> .
|
35
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid1 .
|
36
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid2 .
|
37
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid3 .
|
38
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid4 .
|
39
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid5 .
|
40
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid6 .
|
41
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid7 .
|
42
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid8 .
|
43
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid9 .
|
44
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#homepage> <http://rdf.rubyforge.org/> .
|
45
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
|
46
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://ar.to/#self> .
|
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/#me> .
|
49
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
|
50
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
|
51
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
|
52
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#vendor> <http://datagraph.org/> .
|
53
|
+
<http://rubygems.org/gems/rdf> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#Project> .
|
54
|
+
<http://rubygems.org/gems/rdf> <http://xmlns.com/foaf/0.1/maker> <http://ar.to/#self> .
|
55
|
+
_:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
56
|
+
_:genid1 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "274bd18402fc773ffc0606996aa1fb90b603aa29" .
|
57
|
+
_:genid1 <http://xmlns.com/foaf/0.1/name> "C\u0103lin Ardelean" .
|
58
|
+
_:genid2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
59
|
+
_:genid2 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "6de43e9cf7de53427fea9765706703e4d957c17b" .
|
60
|
+
_:genid2 <http://xmlns.com/foaf/0.1/name> "Danny Gagne" .
|
61
|
+
_:genid3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
62
|
+
_:genid3 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f412d743150d7b27b8468d56e69ca147917ea6fc" .
|
63
|
+
_:genid3 <http://xmlns.com/foaf/0.1/name> "Joey Geiger" .
|
64
|
+
_:genid4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
65
|
+
_:genid4 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d31fdd6af7a279a89bf09fdc9f7c44d9d08bb930" .
|
66
|
+
_:genid4 <http://xmlns.com/foaf/0.1/name> "Fumihiro Kato" .
|
67
|
+
_:genid5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
68
|
+
_:genid5 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "5bdcd8e2af4f5952aaeeffbdd371c41525ec761d" .
|
69
|
+
_:genid5 <http://xmlns.com/foaf/0.1/name> "Naoki Kawamukai" .
|
70
|
+
_:genid6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
71
|
+
_:genid6 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "c69f3255ff0639543cc5edfd8116eac8df16fab8" .
|
72
|
+
_:genid6 <http://xmlns.com/foaf/0.1/name> "Hellekin O. Wolf" .
|
73
|
+
_:genid7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
74
|
+
_:genid7 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f7653fc1ac0e82ebb32f092389bd5fc728eaae12" .
|
75
|
+
_:genid7 <http://xmlns.com/foaf/0.1/name> "John Fieber" .
|
76
|
+
_:genid8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
77
|
+
_:genid8 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "2b4247b6fd5bb4a1383378f325784318680d5ff9" .
|
78
|
+
_:genid8 <http://xmlns.com/foaf/0.1/name> "Keita Urashima" .
|
79
|
+
_:genid9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
80
|
+
_:genid9 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "bedbbf2451e5beb38d59687c0460032aff92cd3c" .
|
81
|
+
_:genid9 <http://xmlns.com/foaf/0.1/name> "Pius Uzamere" .
|
82
|
+
# Test data from SPARQLdata-r2/expr-equals
|
83
|
+
<http://example.org/xi1> <http://example.org/p> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
|
84
|
+
<http://example.org/xi2> <http://example.org/p> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
|
85
|
+
<http://example.org/xi3> <http://example.org/p> "01"^^<http://www.w3.org/2001/XMLSchema#integer> .
|
86
|
+
<http://example.org/xd1> <http://example.org/p> "1.0e0"^^<http://www.w3.org/2001/XMLSchema#double> .
|
87
|
+
<http://example.org/xd2> <http://example.org/p> "1.0"^^<http://www.w3.org/2001/XMLSchema#double> .
|
88
|
+
<http://example.org/xd3> <http://example.org/p> "1"^^<http://www.w3.org/2001/XMLSchema#double> .
|
89
|
+
<http://example.org/xt1> <http://example.org/p> "zzz"^^<http://example.org/myType> .
|
90
|
+
<http://example.org/xp1> <http://example.org/p> "zzz" .
|
91
|
+
<http://example.org/xp2> <http://example.org/p> "1" .
|
92
|
+
<http://example.org/xu> <http://example.org/p> <http://example.org/z> .
|
data/etc/doap.nt
CHANGED
@@ -1,22 +1,3 @@
|
|
1
|
-
<http://ar.to/#self> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
2
|
-
<http://ar.to/#self> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bendiken/foaf> .
|
3
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/homepage> <http://ar.to/> .
|
4
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/made> <http://rubygems.org/gems/rdf> .
|
5
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto.bendiken@gmail.com> .
|
6
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "a033f652c84a4d73b8c26d318c2395699dd2bdfb" .
|
7
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d0737cceb55eb7d740578d2db1bc0727e3ed49ce" .
|
8
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" .
|
9
|
-
<http://bhuga.net/#ben> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
10
|
-
<http://bhuga.net/#ben> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bhuga/foaf> .
|
11
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <http://bhuga.net/> .
|
12
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> .
|
13
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" .
|
14
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" .
|
15
|
-
<http://kellogg-assoc.com/#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
16
|
-
<http://kellogg-assoc.com/#me> <http://xmlns.com/foaf/0.1/homepage> <http://kellogg-assoc.com/> .
|
17
|
-
<http://kellogg-assoc.com/#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@kellogg-assoc.com> .
|
18
|
-
<http://kellogg-assoc.com/#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "35bc44e6d0070e5ad50ccbe0d24403c96af2b9bd" .
|
19
|
-
<http://kellogg-assoc.com/#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
|
20
1
|
<http://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self> .
|
21
2
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://ar.to/> .
|
22
3
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://blog.datagraph.org/> .
|
@@ -27,10 +8,10 @@
|
|
27
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 .
|
28
9
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://ar.to/#self> .
|
29
10
|
<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://
|
11
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://greggkellogg.net/#me> .
|
31
12
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://ar.to/#self> .
|
32
13
|
<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://
|
14
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://greggkellogg.net/#me> .
|
34
15
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <http://rubyforge.org/projects/rdf/> .
|
35
16
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid1 .
|
36
17
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid2 .
|
@@ -45,7 +26,7 @@
|
|
45
26
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
|
46
27
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://ar.to/#self> .
|
47
28
|
<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://
|
29
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://greggkellogg.net/#me> .
|
49
30
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
|
50
31
|
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
|
51
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
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
@base <http://rubygems.org/gems/rdf> .
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
4
|
+
@prefix dc: <http://purl.org/dc/terms/> .
|
5
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
6
|
+
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
7
|
+
|
8
|
+
<> a doap:Project ;
|
9
|
+
doap:name "RDF.rb" ;
|
10
|
+
doap:homepage <http://rdf.rubyforge.org/> ;
|
11
|
+
doap:license <http://creativecommons.org/licenses/publicdomain/> ;
|
12
|
+
doap:shortdesc "A Ruby library for working with Resource Description Framework (RDF) data."@en ;
|
13
|
+
doap:description "RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data."@en ;
|
14
|
+
doap:created "2007-10-23" ;
|
15
|
+
doap:platform "Ruby" ;
|
16
|
+
doap:category <http://dbpedia.org/resource/Resource_Description_Framework>,
|
17
|
+
<http://dbpedia.org/resource/Ruby_(programming_language)> ;
|
18
|
+
doap:download-page <http://rubyforge.org/projects/rdf/> ;
|
19
|
+
doap:bug-database <http://github.com/bendiken/rdf/issues> ;
|
20
|
+
doap:blog <http://ar.to/>, <http://blog.datagraph.org/> ;
|
21
|
+
doap:vendor <http://datagraph.org/> ;
|
22
|
+
doap:developer <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net/#me> ;
|
23
|
+
doap:maintainer <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net/#me> ;
|
24
|
+
doap:documenter <http://ar.to/#self>, <http://bhuga.net/#ben>, <http://greggkellogg.net/#me> ;
|
25
|
+
doap:helper [a foaf:Person ;
|
26
|
+
foaf:name "Călin Ardelean" ;
|
27
|
+
foaf:mbox_sha1sum "274bd18402fc773ffc0606996aa1fb90b603aa29"] ;
|
28
|
+
doap:helper [a foaf:Person ;
|
29
|
+
foaf:name "Danny Gagne" ;
|
30
|
+
foaf:mbox_sha1sum "6de43e9cf7de53427fea9765706703e4d957c17b"] ;
|
31
|
+
doap:helper [a foaf:Person ;
|
32
|
+
foaf:name "Joey Geiger" ;
|
33
|
+
foaf:mbox_sha1sum "f412d743150d7b27b8468d56e69ca147917ea6fc"] ;
|
34
|
+
doap:helper [a foaf:Person ;
|
35
|
+
foaf:name "Fumihiro Kato" ;
|
36
|
+
foaf:mbox_sha1sum "d31fdd6af7a279a89bf09fdc9f7c44d9d08bb930"] ;
|
37
|
+
doap:helper [a foaf:Person ;
|
38
|
+
foaf:name "Naoki Kawamukai" ;
|
39
|
+
foaf:mbox_sha1sum "5bdcd8e2af4f5952aaeeffbdd371c41525ec761d"] ;
|
40
|
+
doap:helper [a foaf:Person ;
|
41
|
+
foaf:name "Hellekin O. Wolf" ;
|
42
|
+
foaf:mbox_sha1sum "c69f3255ff0639543cc5edfd8116eac8df16fab8"] ;
|
43
|
+
doap:helper [a foaf:Person ;
|
44
|
+
foaf:name "John Fieber" ;
|
45
|
+
foaf:mbox_sha1sum "f7653fc1ac0e82ebb32f092389bd5fc728eaae12"] ;
|
46
|
+
doap:helper [a foaf:Person ;
|
47
|
+
foaf:name "Keita Urashima" ;
|
48
|
+
foaf:mbox_sha1sum "2b4247b6fd5bb4a1383378f325784318680d5ff9"] ;
|
49
|
+
doap:helper [a foaf:Person ;
|
50
|
+
foaf:name "Pius Uzamere" ;
|
51
|
+
foaf:mbox_sha1sum "bedbbf2451e5beb38d59687c0460032aff92cd3c"] ;
|
52
|
+
foaf:maker <http://ar.to/#self> ;
|
53
|
+
dc:creator <http://ar.to/#self> .
|
data/etc/gkellogg.nq
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
<http://greggkellogg.net/#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> <http://greggkellogg.net/#me> .
|
2
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" <http://greggkellogg.net/#me> .
|
3
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@greggkellogg.net> <http://greggkellogg.net/#me> .
|
4
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "b7a856d39fc3f02573271d9901f1f9107147f657" <http://greggkellogg.net/#me> .
|
5
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/homepage> <http://greggkellogg.net/> <http://greggkellogg.net/#me> .
|
data/etc/gkellogg.nt
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
<http://greggkellogg.net/#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
2
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
|
3
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@greggkellogg.net> .
|
4
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "b7a856d39fc3f02573271d9901f1f9107147f657" .
|
5
|
+
<http://greggkellogg.net/#me> <http://xmlns.com/foaf/0.1/homepage> <http://greggkellogg.net/> .
|
data/etc/gkellogg.ttl
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
@base <http://rubygems.org/gems/rdf> .
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
4
|
+
@prefix dc: <http://purl.org/dc/terms/> .
|
5
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
6
|
+
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
7
|
+
@prefix ex: <http://example.org/> .
|
8
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
9
|
+
|
10
|
+
<http://greggkellogg.net/#me> a foaf:Person ;
|
11
|
+
foaf:name "Gregg Kellogg" ;
|
12
|
+
foaf:mbox <mailto:gregg@greggkellogg.net> ;
|
13
|
+
foaf:mbox_sha1sum "b7a856d39fc3f02573271d9901f1f9107147f657" ;
|
14
|
+
foaf:homepage <http://greggkellogg.net/> .
|
data/etc/test-data.nt
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Test data from SPARQLdata-r2/expr-equals
|
2
|
+
<http://example.org/xi1> <http://example.org/p> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
|
3
|
+
<http://example.org/xi2> <http://example.org/p> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
|
4
|
+
<http://example.org/xi3> <http://example.org/p> "01"^^<http://www.w3.org/2001/XMLSchema#integer> .
|
5
|
+
<http://example.org/xd1> <http://example.org/p> "1.0e0"^^<http://www.w3.org/2001/XMLSchema#double> .
|
6
|
+
<http://example.org/xd2> <http://example.org/p> "1.0"^^<http://www.w3.org/2001/XMLSchema#double> .
|
7
|
+
<http://example.org/xd3> <http://example.org/p> "1"^^<http://www.w3.org/2001/XMLSchema#double> .
|
8
|
+
<http://example.org/xt1> <http://example.org/p> "zzz"^^<http://example.org/myType> .
|
9
|
+
<http://example.org/xp1> <http://example.org/p> "zzz" .
|
10
|
+
<http://example.org/xp2> <http://example.org/p> "1" .
|
11
|
+
<http://example.org/xu> <http://example.org/p> <http://example.org/z> .
|
data/lib/rdf/spec/format.rb
CHANGED
@@ -3,5 +3,26 @@ require 'rdf/spec'
|
|
3
3
|
share_as :RDF_Format do
|
4
4
|
include RDF::Spec::Matchers
|
5
5
|
|
6
|
-
|
6
|
+
before(:each) do
|
7
|
+
raise raise '+@format_class+ must be defined in a before(:each) block' unless instance_variable_get('@format_class')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".reader" do
|
11
|
+
it "returns a reader" do
|
12
|
+
@format_class.each do |f|
|
13
|
+
f.reader.should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe ".writer" do
|
19
|
+
##
|
20
|
+
# May not return a writer, only does if one is defined by the format
|
21
|
+
it "returns a writer" do
|
22
|
+
@format_class.each do |f|
|
23
|
+
format_namespace = f.name.split('::')[0..-2].inject(Kernel) {|base, const| base.const_get(const)}
|
24
|
+
f.writer.should_not be_nil if format_namespace.const_defined?(:Writer)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
7
28
|
end
|
data/lib/rdf/spec/queryable.rb
CHANGED
@@ -6,14 +6,15 @@ share_as :RDF_Queryable do
|
|
6
6
|
before :each do
|
7
7
|
raise '+@queryable+ must be defined in a before(:each) block' unless instance_variable_get('@queryable')
|
8
8
|
|
9
|
-
@
|
10
|
-
@
|
9
|
+
@doap = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'etc', 'doap.nq'))
|
10
|
+
@doaps = RDF::NQuads::Reader.new(File.open(@doap)).to_a
|
11
|
+
@statements = @doaps
|
11
12
|
|
12
13
|
if @queryable.empty?
|
13
14
|
if @queryable.respond_to?(:<<)
|
14
|
-
@
|
15
|
+
@doaps.each { |statement| @queryable << statement }
|
15
16
|
else
|
16
|
-
raise "@queryable must respond to #<< or be pre-populated with the statements in #{@
|
17
|
+
raise "@queryable must respond to #<< or be pre-populated with the statements in #{@doap} in a before(:each) block"
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -22,150 +23,245 @@ share_as :RDF_Queryable do
|
|
22
23
|
|
23
24
|
##
|
24
25
|
# @see RDF::Queryable#query
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
context "#query when called" do
|
31
|
-
it "should require an argument" do
|
32
|
-
lambda { @queryable.query }.should raise_error(ArgumentError)
|
26
|
+
describe "#query" do
|
27
|
+
it "should respond to #query" do
|
28
|
+
@queryable.should respond_to(:query)
|
33
29
|
end
|
34
30
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
context "when called" do
|
32
|
+
it "requires an argument" do
|
33
|
+
lambda { @queryable.query }.should raise_error(ArgumentError)
|
34
|
+
end
|
39
35
|
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
it "accepts a pattern argument" do
|
37
|
+
lambda { @queryable.query(RDF::Query::Pattern.new(nil, nil, nil)) }.should_not raise_error(ArgumentError)
|
38
|
+
lambda { @queryable.query(RDF::Query::Pattern.new(:s, :p, :o)) }.should_not raise_error(ArgumentError)
|
39
|
+
end
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
it "accepts a statement argument" do
|
42
|
+
lambda { @queryable.query(RDF::Statement.new(nil, nil, nil)) }.should_not raise_error(ArgumentError)
|
43
|
+
end
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
it "accepts a triple argument" do
|
46
|
+
lambda { @queryable.query([nil, nil, nil]) }.should_not raise_error(ArgumentError)
|
47
|
+
end
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
it "accepts a quad argument" do
|
50
|
+
lambda { @queryable.query([nil, nil, nil, nil]) }.should_not raise_error(ArgumentError)
|
51
|
+
end
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
@queryable.query(query)
|
60
|
-
query.should == original_query
|
61
|
-
end
|
53
|
+
it "accepts a hash argument" do
|
54
|
+
lambda { @queryable.query({}) }.should_not raise_error(ArgumentError)
|
55
|
+
end
|
62
56
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
57
|
+
it "does not alter a given hash argument" do
|
58
|
+
query = {:subject => @subject, :predicate => RDF::DOAP.name, :object => RDF::FOAF.Person}
|
59
|
+
original_query = query.dup
|
60
|
+
@queryable.query(query)
|
61
|
+
query.should == original_query
|
62
|
+
end
|
67
63
|
|
68
|
-
|
69
|
-
|
70
|
-
@queryable.query([nil, nil, nil]) do |statement|
|
71
|
-
statement.should be_a_statement
|
64
|
+
it "rejects other kinds of arguments" do
|
65
|
+
lambda { @queryable.query(nil) }.should raise_error(ArgumentError)
|
72
66
|
end
|
73
|
-
end
|
74
|
-
end
|
75
67
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
68
|
+
context "with a block" do
|
69
|
+
it "yields statements" do
|
70
|
+
@queryable.query([nil, nil, nil]) do |statement|
|
71
|
+
statement.should be_a_statement
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
80
75
|
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
context "without a block" do
|
77
|
+
it "returns an enumerator" do
|
78
|
+
@queryable.query([nil, nil, nil]).should be_an_enumerator
|
79
|
+
end
|
84
80
|
|
85
|
-
|
86
|
-
|
87
|
-
|
81
|
+
it "returns an enumerable enumerator" do
|
82
|
+
@queryable.query([nil, nil, nil]).should be_enumerable
|
83
|
+
end
|
84
|
+
|
85
|
+
it "returns a queryable enumerator" do
|
86
|
+
@queryable.query([nil, nil, nil]).should be_queryable
|
87
|
+
end
|
88
|
+
|
89
|
+
it "returns statements" do
|
90
|
+
@queryable.query([nil, nil, nil]).each do |statement|
|
91
|
+
statement.should be_a_statement
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it "returns the correct number of results for array queries" do
|
96
|
+
@queryable.query([nil, nil, nil]).size.should == @statements.size
|
97
|
+
@queryable.query([@subject, nil, nil]).size.should == File.readlines(@doap).grep(/^<http:\/\/rubygems\.org\/gems\/rdf>/).size
|
98
|
+
@queryable.query([RDF::URI("http://ar.to/#self"), nil, nil]).size.should == File.readlines(@doap).grep(/^<http:\/\/ar.to\/\#self>/).size
|
99
|
+
@queryable.query([@subject, RDF::DOAP.name, nil]).size.should == 1
|
100
|
+
#@queryable.query([@subject, RDF::DOAP.developer, nil]).size.should == @queryable.query([nil, nil, RDF::FOAF.Person]).size # FIXME: assumes too much about the doap.nt data
|
101
|
+
@queryable.query([nil, nil, RDF::DOAP.Project]).size.should == 1
|
102
|
+
end
|
88
103
|
|
89
|
-
|
90
|
-
|
91
|
-
|
104
|
+
it "returns the correct number of results for hash queries" do
|
105
|
+
@queryable.query({}).size.should == @statements.size
|
106
|
+
@queryable.query(:subject => @subject) .size.should == File.readlines(@doap).grep(/^<http:\/\/rubygems\.org\/gems\/rdf>/).size
|
107
|
+
@queryable.query(:subject => @subject, :predicate => RDF::DOAP.name).size.should == 1
|
108
|
+
#@queryable.query(:subject => @subject, :predicate => RDF::DOAP.developer).size.should == @queryable.query(:object => RDF::FOAF.Person).size # FIXME: assumes too much about the doap.nt data
|
109
|
+
@queryable.query(:object => RDF::DOAP.Project).size.should == 1
|
110
|
+
end
|
92
111
|
end
|
93
|
-
end
|
94
112
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end
|
113
|
+
context "with specific patterns from SPARQL", :pending => "SPARQL compatibility" do
|
114
|
+
context "triple pattern combinations" do
|
115
|
+
it "?s p o" do
|
116
|
+
@queryable.query(:predicate => RDF::URI("http://example.org/p"), :object => RDF::Literal.new(1)).to_a.should ==
|
117
|
+
[RDF::Statement.new(RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1), RDF::Statement.new(RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1)]
|
118
|
+
end
|
102
119
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
120
|
+
it "s ?p o" do
|
121
|
+
@queryable.query(:subject => RDF::URI("http://example.org/xi2"), :object => RDF::Literal.new(1)).to_a.should ==
|
122
|
+
[RDF::Statement.new(RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1)]
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# From data-r2/expr-equals
|
127
|
+
context "data/r2/expr-equals" do
|
128
|
+
context "graph-1" do
|
129
|
+
before(:each) do
|
130
|
+
@solutions = @queryable.query(:predicate => RDF::URI("http://example.org/p"), :object => RDF::Literal::Integer.new(1)).to_a
|
131
|
+
end
|
132
|
+
|
133
|
+
it "has two solutions" do
|
134
|
+
@solutions.count.should == 2
|
135
|
+
end
|
136
|
+
|
137
|
+
it "has xi1 as a solution" do
|
138
|
+
@solutions.any? {|s| s.subject == RDF::URI("http://example.org/xi1")}.should be_true
|
139
|
+
end
|
140
|
+
|
141
|
+
it "has xi2 as a solution" do
|
142
|
+
@solutions.any? {|s| s.subject == RDF::URI("http://example.org/xi2")}.should be_true
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
context "graph-2" do
|
148
|
+
before(:each) do
|
149
|
+
@solutions = @queryable.query(:predicate => RDF::URI("http://example.org/p"), :object => RDF::Literal::Double.new("1.0e0")).to_a
|
150
|
+
end
|
151
|
+
|
152
|
+
it "has one solution" do
|
153
|
+
@solutions.count.should == 1
|
154
|
+
end
|
155
|
+
|
156
|
+
it "has xd1 as a solution" do
|
157
|
+
@solutions.any? {|s| s.subject == RDF::URI("http://example.org/xd1")}.should be_true
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
109
162
|
end
|
110
163
|
end
|
111
164
|
|
112
165
|
##
|
113
166
|
# @see RDF::Queryable#query_pattern
|
167
|
+
describe "#query_pattern" do
|
168
|
+
it "responds to #query_pattern" do
|
169
|
+
@queryable.should respond_to(:query_pattern)
|
170
|
+
end
|
114
171
|
|
115
|
-
|
116
|
-
|
117
|
-
|
172
|
+
context "when called" do
|
173
|
+
it "requires an argument" do
|
174
|
+
lambda { @queryable.send(:query_pattern) }.should raise_error(ArgumentError)
|
175
|
+
end
|
118
176
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
177
|
+
it "yields to the given block" do
|
178
|
+
called = false
|
179
|
+
@queryable.send(:query_pattern, RDF::Query::Pattern.new) do |statement|
|
180
|
+
called = true
|
181
|
+
break
|
182
|
+
end
|
183
|
+
called.should be_true
|
184
|
+
end
|
123
185
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
186
|
+
it "yields statements" do
|
187
|
+
@queryable.send(:query_pattern, RDF::Query::Pattern.new) do |statement|
|
188
|
+
statement.should be_a_statement
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context "with specific patterns", :pending => "SPARQL compatibility" do
|
193
|
+
# Note that "01" should not match 1, per data-r2/expr-equal/sameTerm
|
194
|
+
{
|
195
|
+
[RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
|
196
|
+
[RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), nil] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
|
197
|
+
[RDF::URI("http://example.org/xi1"), nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1])],
|
198
|
+
[nil, RDF::URI("http://example.org/p"), 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1]), RDF::Statement.from([RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1])],
|
199
|
+
[nil, nil, 1] => [RDF::Statement.from([RDF::URI("http://example.org/xi1"), RDF::URI("http://example.org/p"), 1]), RDF::Statement.from([RDF::URI("http://example.org/xi2"), RDF::URI("http://example.org/p"), 1])],
|
200
|
+
[nil, RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")] => [RDF::Statement.from([RDF::URI("http://example.org/xd1"), RDF::URI("http://example.org/p"), RDF::Literal::Double.new("1.0e0")])],
|
201
|
+
}.each do |pattern, result|
|
202
|
+
pattern = RDF::Query::Pattern.from(pattern)
|
203
|
+
it "returns #{result.inspect} given #{pattern.inspect}" do
|
204
|
+
solutions = []
|
205
|
+
@queryable.send(:query_pattern, pattern) {|s| solutions << s}
|
206
|
+
solutions.should == result
|
207
|
+
end
|
208
|
+
end
|
129
209
|
end
|
130
|
-
called.should be_true
|
131
|
-
end
|
132
210
|
|
133
|
-
|
134
|
-
|
135
|
-
|
211
|
+
context "with context" do
|
212
|
+
it "returns statements from all contexts with no context" do
|
213
|
+
pattern = RDF::Query::Pattern.new(nil, nil, nil, :context => nil)
|
214
|
+
solutions = []
|
215
|
+
@queryable.send(:query_pattern, pattern) {|s| solutions << s}
|
216
|
+
solutions.size.should == @statements.size
|
217
|
+
end
|
218
|
+
|
219
|
+
it "returns statements from named contexts with variable context", :pending => "SPARQL compatibility" do
|
220
|
+
pattern = RDF::Query::Pattern.new(nil, nil, nil, :context => :c)
|
221
|
+
solutions = []
|
222
|
+
@queryable.send(:query_pattern, pattern) {|s| solutions << s}
|
223
|
+
context_statements = @queryable.statements.select {|st| st.has_context?}.length
|
224
|
+
solutions.size.should == context_statements
|
225
|
+
end
|
226
|
+
|
227
|
+
it "returns statements from specific context with URI context" do
|
228
|
+
pattern = RDF::Query::Pattern.new(nil, nil, nil, :context => RDF::URI("http://ar.to/#self"))
|
229
|
+
solutions = []
|
230
|
+
@queryable.send(:query_pattern, pattern) {|s| solutions << s}
|
231
|
+
solutions.size.should == File.readlines(@doap).grep(/^<http:\/\/ar.to\/\#self>/).size
|
232
|
+
end
|
136
233
|
end
|
137
234
|
end
|
138
235
|
end
|
139
236
|
|
140
237
|
##
|
141
238
|
# @see RDF::Queryable#first
|
142
|
-
|
143
|
-
it "should respond to #first" do
|
144
|
-
@queryable.should respond_to(:first)
|
145
|
-
end
|
146
|
-
|
147
|
-
context "#first" do
|
239
|
+
describe "#first" do
|
148
240
|
before :all do
|
149
241
|
@failing_pattern = [RDF::Node.new] * 3
|
150
242
|
end
|
151
243
|
|
152
|
-
it "should
|
244
|
+
it "should respond to #first" do
|
245
|
+
@queryable.should respond_to(:first)
|
246
|
+
end
|
247
|
+
|
248
|
+
it "returns enumerator without a pattern" do
|
153
249
|
lambda { @queryable.first }.should_not raise_error(ArgumentError)
|
154
250
|
@queryable.first.should == @queryable.each.first # uses an Enumerator
|
155
251
|
end
|
156
252
|
|
157
|
-
it "
|
253
|
+
it "returns the correct value when the pattern matches" do
|
158
254
|
matching_patterns = [[nil, nil, nil], @queryable.each.first]
|
159
255
|
matching_patterns.each do |matching_pattern|
|
160
256
|
@queryable.first(matching_pattern).should == @queryable.query(matching_pattern).each.first
|
161
257
|
end
|
162
258
|
end
|
163
259
|
|
164
|
-
it "
|
260
|
+
it "returns nil when the pattern fails to match anything" do
|
165
261
|
@queryable.first(@failing_pattern).should be_nil
|
166
262
|
end
|
167
263
|
|
168
|
-
it "
|
264
|
+
it "returns nil when self is empty" do
|
169
265
|
queryable = [].extend(RDF::Queryable)
|
170
266
|
queryable.first.should be_nil
|
171
267
|
queryable.first(@failing_pattern).should be_nil
|
@@ -174,33 +270,32 @@ share_as :RDF_Queryable do
|
|
174
270
|
|
175
271
|
##
|
176
272
|
# @see RDF::Queryable#first_subject
|
177
|
-
|
178
|
-
it "should respond to #first_subject" do
|
179
|
-
@queryable.should respond_to(:first_subject)
|
180
|
-
end
|
181
|
-
|
182
|
-
context "#first_subject" do
|
273
|
+
describe "#first_subject" do
|
183
274
|
before :all do
|
184
275
|
@failing_pattern = [RDF::Node.new, nil, nil]
|
185
276
|
end
|
186
277
|
|
187
|
-
it "should
|
278
|
+
it "should respond to #first_subject" do
|
279
|
+
@queryable.should respond_to(:first_subject)
|
280
|
+
end
|
281
|
+
|
282
|
+
it "returns enumerator without a pattern" do
|
188
283
|
lambda { @queryable.first_subject }.should_not raise_error(ArgumentError)
|
189
284
|
@queryable.first_subject.should == @queryable.first.subject
|
190
285
|
end
|
191
286
|
|
192
|
-
it "
|
287
|
+
it "returns the correct value when the pattern matches" do
|
193
288
|
matching_patterns = [[nil, nil, nil], [@queryable.first.subject, nil, nil]]
|
194
289
|
matching_patterns.each do |matching_pattern|
|
195
290
|
@queryable.first_subject(matching_pattern).should == @queryable.query(matching_pattern).first.subject
|
196
291
|
end
|
197
292
|
end
|
198
293
|
|
199
|
-
it "
|
294
|
+
it "returns nil when the pattern fails to match anything" do
|
200
295
|
@queryable.first_subject(@failing_pattern).should be_nil
|
201
296
|
end
|
202
297
|
|
203
|
-
it "
|
298
|
+
it "returns nil when self is empty" do
|
204
299
|
queryable = [].extend(RDF::Queryable)
|
205
300
|
queryable.first_subject.should be_nil
|
206
301
|
queryable.first_subject(@failing_pattern).should be_nil
|
@@ -210,32 +305,32 @@ share_as :RDF_Queryable do
|
|
210
305
|
##
|
211
306
|
# @see RDF::Queryable#first_predicate
|
212
307
|
|
213
|
-
|
214
|
-
@queryable.should respond_to(:first_predicate)
|
215
|
-
end
|
216
|
-
|
217
|
-
context "#first_predicate" do
|
308
|
+
describe "#first_predicate" do
|
218
309
|
before :all do
|
219
310
|
@failing_pattern = [nil, RDF::Node.new, nil]
|
220
311
|
end
|
221
312
|
|
222
|
-
it "should
|
313
|
+
it "should respond to #first_predicate" do
|
314
|
+
@queryable.should respond_to(:first_predicate)
|
315
|
+
end
|
316
|
+
|
317
|
+
it "returns enumerator without a pattern" do
|
223
318
|
lambda { @queryable.first_predicate }.should_not raise_error(ArgumentError)
|
224
319
|
@queryable.first_predicate.should == @queryable.first.predicate
|
225
320
|
end
|
226
321
|
|
227
|
-
it "
|
322
|
+
it "returns the correct value when the pattern matches" do
|
228
323
|
matching_patterns = [[nil, nil, nil], [nil, @queryable.first.predicate, nil]]
|
229
324
|
matching_patterns.each do |matching_pattern|
|
230
325
|
@queryable.first_predicate(matching_pattern).should == @queryable.query(matching_pattern).first.predicate
|
231
326
|
end
|
232
327
|
end
|
233
328
|
|
234
|
-
it "
|
329
|
+
it "returns nil when the pattern fails to match anything" do
|
235
330
|
@queryable.first_predicate(@failing_pattern).should be_nil
|
236
331
|
end
|
237
332
|
|
238
|
-
it "
|
333
|
+
it "returns nil when self is empty" do
|
239
334
|
queryable = [].extend(RDF::Queryable)
|
240
335
|
queryable.first_predicate.should be_nil
|
241
336
|
queryable.first_predicate(@failing_pattern).should be_nil
|
@@ -245,32 +340,32 @@ share_as :RDF_Queryable do
|
|
245
340
|
##
|
246
341
|
# @see RDF::Queryable#first_object
|
247
342
|
|
248
|
-
|
249
|
-
@queryable.should respond_to(:first_object)
|
250
|
-
end
|
251
|
-
|
252
|
-
context "#first_object" do
|
343
|
+
describe "#first_object" do
|
253
344
|
before :all do
|
254
345
|
@failing_pattern = [nil, nil, RDF::Node.new]
|
255
346
|
end
|
256
347
|
|
257
|
-
it "should
|
348
|
+
it "should respond to #first_object" do
|
349
|
+
@queryable.should respond_to(:first_object)
|
350
|
+
end
|
351
|
+
|
352
|
+
it "returns enurator without a pattern" do
|
258
353
|
lambda { @queryable.first_object }.should_not raise_error(ArgumentError)
|
259
354
|
@queryable.first_object.should == @queryable.first.object
|
260
355
|
end
|
261
356
|
|
262
|
-
it "
|
357
|
+
it "returns the correct value when the pattern matches" do
|
263
358
|
matching_patterns = [[nil, nil, nil], [nil, nil, @queryable.first.object]]
|
264
359
|
matching_patterns.each do |matching_pattern|
|
265
360
|
@queryable.first_object(matching_pattern).should == @queryable.query(matching_pattern).first.object
|
266
361
|
end
|
267
362
|
end
|
268
363
|
|
269
|
-
it "
|
364
|
+
it "returns nil when the pattern fails to match anything" do
|
270
365
|
@queryable.first_object(@failing_pattern).should be_nil
|
271
366
|
end
|
272
367
|
|
273
|
-
it "
|
368
|
+
it "returns nil when self is empty" do
|
274
369
|
queryable = [].extend(RDF::Queryable)
|
275
370
|
queryable.first_object.should be_nil
|
276
371
|
queryable.first_object(@failing_pattern).should be_nil
|
@@ -280,11 +375,11 @@ share_as :RDF_Queryable do
|
|
280
375
|
##
|
281
376
|
# @see RDF::Queryable#first_literal
|
282
377
|
|
283
|
-
it "
|
378
|
+
it "returns to #first_literal" do
|
284
379
|
@queryable.should respond_to(:first_literal)
|
285
380
|
end
|
286
381
|
|
287
|
-
|
382
|
+
describe "#first_literal" do
|
288
383
|
before :each do
|
289
384
|
# FIXME: these tests should be using the provided @queryable, if possible.
|
290
385
|
@queryable = RDF::Graph.new do |graph|
|
@@ -296,23 +391,23 @@ share_as :RDF_Queryable do
|
|
296
391
|
@failing_pattern = [nil, nil, RDF::Node.new]
|
297
392
|
end
|
298
393
|
|
299
|
-
it "
|
394
|
+
it "returns a literal without a pattern" do
|
300
395
|
lambda { @queryable.first_literal }.should_not raise_error(ArgumentError)
|
301
396
|
@queryable.first_literal.should == @literal
|
302
397
|
end
|
303
398
|
|
304
|
-
it "
|
399
|
+
it "returns the correct value when the pattern matches" do
|
305
400
|
matching_patterns = [[nil, nil, nil], [@subject, nil, nil], [nil, RDF::DC.creator, nil], [nil, nil, @literal]]
|
306
401
|
matching_patterns.each do |matching_pattern|
|
307
402
|
@queryable.first_literal(matching_pattern).should == @literal
|
308
403
|
end
|
309
404
|
end
|
310
405
|
|
311
|
-
it "
|
406
|
+
it "returns nil when the pattern fails to match anything" do
|
312
407
|
@queryable.first_literal(@failing_pattern).should be_nil
|
313
408
|
end
|
314
409
|
|
315
|
-
it "
|
410
|
+
it "returns nil when self is empty" do
|
316
411
|
queryable = [].extend(RDF::Queryable)
|
317
412
|
queryable.first_literal.should be_nil
|
318
413
|
queryable.first_literal(@failing_pattern).should be_nil
|
@@ -322,21 +417,21 @@ share_as :RDF_Queryable do
|
|
322
417
|
##
|
323
418
|
# @see RDF::Queryable#first_value
|
324
419
|
|
325
|
-
|
326
|
-
@queryable.should respond_to(:first_value)
|
327
|
-
end
|
328
|
-
|
329
|
-
context "#first_value" do
|
420
|
+
describe "#first_value" do
|
330
421
|
before :all do
|
331
422
|
@failing_pattern = [nil, nil, RDF::Node.new]
|
332
423
|
end
|
333
424
|
|
334
|
-
it "should
|
425
|
+
it "should respond to #first_value" do
|
426
|
+
@queryable.should respond_to(:first_value)
|
427
|
+
end
|
428
|
+
|
429
|
+
it "returns first literal without a pattern" do
|
335
430
|
lambda { @queryable.first_value }.should_not raise_error(ArgumentError)
|
336
431
|
@queryable.first_value.should == @queryable.first_literal.value
|
337
432
|
end
|
338
433
|
|
339
|
-
it "
|
434
|
+
it "returns the correct value when the pattern matches" do
|
340
435
|
matching_patterns = []
|
341
436
|
@queryable.each do |statement|
|
342
437
|
if statement.object.is_a?(RDF::Literal)
|
@@ -349,11 +444,11 @@ share_as :RDF_Queryable do
|
|
349
444
|
end
|
350
445
|
end
|
351
446
|
|
352
|
-
it "
|
447
|
+
it "returns nil when the pattern fails to match anything" do
|
353
448
|
@queryable.first_value(@failing_pattern).should be_nil
|
354
449
|
end
|
355
450
|
|
356
|
-
it "
|
451
|
+
it "returns nil when self is empty" do
|
357
452
|
queryable = [].extend(RDF::Queryable)
|
358
453
|
queryable.first_value.should be_nil
|
359
454
|
queryable.first_value(@failing_pattern).should be_nil
|