rdf 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README +6 -4
- data/VERSION +1 -1
- data/etc/doap.nt +75 -75
- data/lib/rdf.rb +22 -4
- data/lib/rdf/format.rb +2 -2
- data/lib/rdf/mixin/queryable.rb +33 -8
- data/lib/rdf/model/literal.rb +0 -13
- data/lib/rdf/model/literal/double.rb +1 -1
- data/lib/rdf/model/literal/integer.rb +2 -2
- data/lib/rdf/model/literal/time.rb +1 -1
- data/lib/rdf/model/statement.rb +30 -4
- data/lib/rdf/model/uri.rb +0 -10
- data/lib/rdf/model/value.rb +21 -0
- data/lib/rdf/nquads.rb +2 -2
- data/lib/rdf/ntriples.rb +1 -2
- data/lib/rdf/ntriples/writer.rb +17 -0
- data/lib/rdf/repository.rb +1 -1
- data/lib/rdf/writer.rb +28 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjhkODc5NDgzOGExZWVlYWY3OGJkMDZlMDA2MGQ1ZGU0ODBiNTllZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGQyMmQ4M2I2MjQ3OTM0MGUzNjVmMDNhNjkxNzFkODA4ODZlZDhmMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDZmYzJhZDcxZGJkMTkxNzVmNTE0OTdmMTJiZWY0ZGQ4Yzg4NWQ4MzQxZjAy
|
10
|
+
MGMwMzkyNjU5MzY2OWQ1ZWMzYmQzNzk0YTQwYzQzN2M4MzE3ODk1YzcyNzVh
|
11
|
+
YTc0MTYxMWRlMWFlYTkwMzU1NzY5YmIxZThkMTM1Yjc4MDBlNTM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTAwZWFlMDYwMDNhZmU2NDI1NTdjMDZlZDEzZTllNmZjNGQ0Yzg2ZjhlMGY2
|
14
|
+
MTI2ZmFlMWJmYzY2NDNhZTUzNjU1NGQ1YzFmM2Y2MzQxZjBkYTQwNjc5MmIy
|
15
|
+
NmUxNGNmM2UwODgxODEzNDg3YTkxMTc1Njk3ODVkZTVkODM5N2I=
|
data/README
CHANGED
@@ -17,7 +17,7 @@ This is a pure-Ruby library for working with [Resource Description Framework
|
|
17
17
|
* 100% pure Ruby with minimal dependencies and no bloat.
|
18
18
|
* 100% free and unencumbered [public domain](http://unlicense.org/) software.
|
19
19
|
* Provides a clean, well-designed RDF object model and related APIs.
|
20
|
-
* Supports parsing and serializing N-Triples out of the box, with more
|
20
|
+
* Supports parsing and serializing [N-Triples][] and [N-Quads][] out of the box, with more
|
21
21
|
serialization format support available through add-on plugins.
|
22
22
|
* Includes in-memory graph and repository implementations, with more storage
|
23
23
|
adapter support available through add-on plugins.
|
@@ -41,7 +41,7 @@ This is a pure-Ruby library for working with [Resource Description Framework
|
|
41
41
|
When installed, RDF.rb includes a `rdf` shell script which acts as a wrapper to perform a number of different
|
42
42
|
operations on RDF files using available readers and writers.
|
43
43
|
|
44
|
-
* `serialize`: Parse an RDF input and re-serializing to N-Triples or another available format using `--output-format` option.
|
44
|
+
* `serialize`: Parse an RDF input and re-serializing to [N-Triples][] or another available format using `--output-format` option.
|
45
45
|
* `count`: Parse and RDF input and count the number of statements.
|
46
46
|
* `subjects`: Returns unique subjects from parsed input.
|
47
47
|
* `objects`: Returns unique objects from parsed input.
|
@@ -52,7 +52,7 @@ operations on RDF files using available readers and writers.
|
|
52
52
|
require 'rdf'
|
53
53
|
include RDF
|
54
54
|
|
55
|
-
### Writing RDF data using the N-Triples format
|
55
|
+
### Writing RDF data using the [N-Triples][] format
|
56
56
|
|
57
57
|
require 'rdf/ntriples'
|
58
58
|
graph = RDF::Graph.new << [:hello, RDF::DC.title, "Hello, world!"]
|
@@ -62,7 +62,7 @@ or
|
|
62
62
|
|
63
63
|
RDF::Writer.open("hello.nt") { |writer| writer << graph }
|
64
64
|
|
65
|
-
### Reading RDF data in the N-Triples format
|
65
|
+
### Reading RDF data in the [N-Triples][] format
|
66
66
|
|
67
67
|
require 'rdf/ntriples'
|
68
68
|
graph = RDF::Graph.load("http://ruby-rdf.github.com/rdf/etc/doap.nt")
|
@@ -359,6 +359,8 @@ This is free and unencumbered public domain software. For more information,
|
|
359
359
|
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
360
360
|
|
361
361
|
[RDF]: http://www.w3.org/RDF/
|
362
|
+
[N-Triples]: http://www.w3.org/TR/n-triples/
|
363
|
+
[N-Quads]: http://www.w3.org/TR/n-quads/
|
362
364
|
[YARD]: http://yardoc.org/
|
363
365
|
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
364
366
|
[PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.8
|
data/etc/doap.nt
CHANGED
@@ -1,85 +1,85 @@
|
|
1
|
+
<http://rubygems.org/gems/rdf> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#Project> .
|
2
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
|
3
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#homepage> <http://rubygems.org/gems/rdf> .
|
4
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
|
5
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
|
6
|
+
<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 .
|
7
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#created> "2007-10-23" .
|
8
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
|
9
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Resource_Description_Framework> .
|
10
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Ruby_(programming_language)> .
|
11
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/rdf-concepts/> .
|
12
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/n-quads/> .
|
13
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/n-triples/> .
|
14
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <http://rubyforge.org/projects/rdf/> .
|
15
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#bug-database> <http://github.com/ruby-rdf/rdf/issues> .
|
16
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://ar.to/> .
|
17
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://blog.datagraph.org/> .
|
18
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#vendor> <http://datagraph.org/> .
|
19
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://ar.to/#self> .
|
20
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://bhuga.net/#ben> .
|
21
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://greggkellogg.net/foaf#me> .
|
22
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://ar.to/#self> .
|
23
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://bhuga.net/#ben> .
|
24
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://greggkellogg.net/foaf#me> .
|
25
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://ar.to/#self> .
|
26
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://bhuga.net/#ben> .
|
27
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://greggkellogg.net/foaf#me> .
|
28
|
+
_:g70186318075540 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
29
|
+
_:g70186318075540 <http://xmlns.com/foaf/0.1/name> "Călin Ardelean" .
|
30
|
+
_:g70186318075540 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "274bd18402fc773ffc0606996aa1fb90b603aa29" .
|
31
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186318075540 .
|
32
|
+
_:g70186318591960 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
33
|
+
_:g70186318591960 <http://xmlns.com/foaf/0.1/name> "Danny Gagne" .
|
34
|
+
_:g70186318591960 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "6de43e9cf7de53427fea9765706703e4d957c17b" .
|
35
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186318591960 .
|
36
|
+
_:g70186318228820 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
37
|
+
_:g70186318228820 <http://xmlns.com/foaf/0.1/name> "Joey Geiger" .
|
38
|
+
_:g70186318228820 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f412d743150d7b27b8468d56e69ca147917ea6fc" .
|
39
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186318228820 .
|
40
|
+
_:g70186318408440 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
41
|
+
_:g70186318408440 <http://xmlns.com/foaf/0.1/name> "Fumihiro Kato" .
|
42
|
+
_:g70186318408440 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d31fdd6af7a279a89bf09fdc9f7c44d9d08bb930" .
|
43
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186318408440 .
|
44
|
+
_:g70186318725620 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
45
|
+
_:g70186318725620 <http://xmlns.com/foaf/0.1/name> "Naoki Kawamukai" .
|
46
|
+
_:g70186318725620 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "5bdcd8e2af4f5952aaeeffbdd371c41525ec761d" .
|
47
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186318725620 .
|
48
|
+
_:g70186319866820 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
49
|
+
_:g70186319866820 <http://xmlns.com/foaf/0.1/name> "Hellekin O. Wolf" .
|
50
|
+
_:g70186319866820 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "c69f3255ff0639543cc5edfd8116eac8df16fab8" .
|
51
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186319866820 .
|
52
|
+
_:g70186321042840 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
53
|
+
_:g70186321042840 <http://xmlns.com/foaf/0.1/name> "John Fieber" .
|
54
|
+
_:g70186321042840 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f7653fc1ac0e82ebb32f092389bd5fc728eaae12" .
|
55
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186321042840 .
|
56
|
+
_:g70186319319640 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
57
|
+
_:g70186319319640 <http://xmlns.com/foaf/0.1/name> "Keita Urashima" .
|
58
|
+
_:g70186319319640 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "2b4247b6fd5bb4a1383378f325784318680d5ff9" .
|
59
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186319319640 .
|
60
|
+
_:g70186321063140 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
61
|
+
_:g70186321063140 <http://xmlns.com/foaf/0.1/name> "Pius Uzamere" .
|
62
|
+
_:g70186321063140 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "bedbbf2451e5beb38d59687c0460032aff92cd3c" .
|
63
|
+
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186321063140 .
|
64
|
+
<http://rubygems.org/gems/rdf> <http://xmlns.com/foaf/0.1/maker> <http://ar.to/#self> .
|
65
|
+
<http://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self> .
|
1
66
|
<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://
|
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> .
|
67
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" .
|
5
68
|
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto@bendiken.net> .
|
6
69
|
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "a033f652c84a4d73b8c26d318c2395699dd2bdfb" .
|
7
70
|
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d0737cceb55eb7d740578d2db1bc0727e3ed49ce" .
|
8
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/
|
71
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/homepage> <http://ar.to/> .
|
72
|
+
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/made> <http://rubygems.org/gems/rdf> .
|
73
|
+
<http://ar.to/#self> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bendiken/foaf> .
|
9
74
|
<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://
|
11
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <http://bhuga.net/> .
|
75
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" .
|
12
76
|
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> .
|
13
77
|
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" .
|
14
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/
|
78
|
+
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <http://bhuga.net/> .
|
79
|
+
<http://bhuga.net/#ben> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bhuga/foaf> .
|
15
80
|
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
16
|
-
<http://greggkellogg.net/foaf#me> <http://
|
17
|
-
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/homepage> <http://greggkellogg.net/> .
|
81
|
+
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
|
18
82
|
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@greggkellogg.net> .
|
19
83
|
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "35bc44e6d0070e5ad50ccbe0d24403c96af2b9bd" .
|
20
|
-
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/
|
21
|
-
<http://
|
22
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://ar.to/> .
|
23
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <http://blog.datagraph.org/> .
|
24
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#bug-database> <http://github.com/ruby-rdf/rdf/issues> .
|
25
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Resource_Description_Framework> .
|
26
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Ruby_(programming_language)> .
|
27
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#created> "2007-10-23" .
|
28
|
-
<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 .
|
29
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://ar.to/#self> .
|
30
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://bhuga.net/#ben> .
|
31
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <http://greggkellogg.net/foaf#me> .
|
32
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://ar.to/#self> .
|
33
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://bhuga.net/#ben> .
|
34
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <http://greggkellogg.net/foaf#me> .
|
35
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <http://rubyforge.org/projects/rdf/> .
|
36
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid1 .
|
37
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid2 .
|
38
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid3 .
|
39
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid4 .
|
40
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid5 .
|
41
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid6 .
|
42
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid7 .
|
43
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid8 .
|
44
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:genid9 .
|
45
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#homepage> <http://rubygems.org/gems/rdf> .
|
46
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://sw.deri.org/2008/07/n-quads/> .
|
47
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/2001/sw/RDFCore/ntriples/> .
|
48
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/rdf-concepts/> .
|
49
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
|
50
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://ar.to/#self> .
|
51
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://bhuga.net/#ben> .
|
52
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <http://greggkellogg.net/foaf#me> .
|
53
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
|
54
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
|
55
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
|
56
|
-
<http://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#vendor> <http://datagraph.org/> .
|
57
|
-
<http://rubygems.org/gems/rdf> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#Project> .
|
58
|
-
<http://rubygems.org/gems/rdf> <http://xmlns.com/foaf/0.1/maker> <http://ar.to/#self> .
|
59
|
-
_:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
60
|
-
_:genid1 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "274bd18402fc773ffc0606996aa1fb90b603aa29" .
|
61
|
-
_:genid1 <http://xmlns.com/foaf/0.1/name> "C\u0103lin Ardelean" .
|
62
|
-
_:genid2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
63
|
-
_:genid2 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "6de43e9cf7de53427fea9765706703e4d957c17b" .
|
64
|
-
_:genid2 <http://xmlns.com/foaf/0.1/name> "Danny Gagne" .
|
65
|
-
_:genid3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
66
|
-
_:genid3 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f412d743150d7b27b8468d56e69ca147917ea6fc" .
|
67
|
-
_:genid3 <http://xmlns.com/foaf/0.1/name> "Joey Geiger" .
|
68
|
-
_:genid4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
69
|
-
_:genid4 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d31fdd6af7a279a89bf09fdc9f7c44d9d08bb930" .
|
70
|
-
_:genid4 <http://xmlns.com/foaf/0.1/name> "Fumihiro Kato" .
|
71
|
-
_:genid5 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
72
|
-
_:genid5 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "5bdcd8e2af4f5952aaeeffbdd371c41525ec761d" .
|
73
|
-
_:genid5 <http://xmlns.com/foaf/0.1/name> "Naoki Kawamukai" .
|
74
|
-
_:genid6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
75
|
-
_:genid6 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "c69f3255ff0639543cc5edfd8116eac8df16fab8" .
|
76
|
-
_:genid6 <http://xmlns.com/foaf/0.1/name> "Hellekin O. Wolf" .
|
77
|
-
_:genid7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
78
|
-
_:genid7 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f7653fc1ac0e82ebb32f092389bd5fc728eaae12" .
|
79
|
-
_:genid7 <http://xmlns.com/foaf/0.1/name> "John Fieber" .
|
80
|
-
_:genid8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
81
|
-
_:genid8 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "2b4247b6fd5bb4a1383378f325784318680d5ff9" .
|
82
|
-
_:genid8 <http://xmlns.com/foaf/0.1/name> "Keita Urashima" .
|
83
|
-
_:genid9 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
84
|
-
_:genid9 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "bedbbf2451e5beb38d59687c0460032aff92cd3c" .
|
85
|
-
_:genid9 <http://xmlns.com/foaf/0.1/name> "Pius Uzamere" .
|
84
|
+
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/homepage> <http://greggkellogg.net/> .
|
85
|
+
<http://greggkellogg.net/foaf#me> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://greggkellogg.net/foaf> .
|
data/lib/rdf.rb
CHANGED
@@ -149,10 +149,28 @@ module RDF
|
|
149
149
|
Vocabulary.create(uri)
|
150
150
|
end
|
151
151
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
152
|
+
# RDF Vocabulary terms
|
153
|
+
%w(
|
154
|
+
Alt
|
155
|
+
Bag
|
156
|
+
first
|
157
|
+
HTML
|
158
|
+
langString
|
159
|
+
List
|
160
|
+
nil
|
161
|
+
object
|
162
|
+
predicate
|
163
|
+
Property
|
164
|
+
rest
|
165
|
+
Seq
|
166
|
+
Statement
|
167
|
+
subject
|
168
|
+
type
|
169
|
+
value
|
170
|
+
XMLLiteral
|
171
|
+
).each do |term|
|
172
|
+
define_method(term) {self[term.to_sym]}
|
173
|
+
module_function term.to_sym
|
156
174
|
end
|
157
175
|
|
158
176
|
##
|
data/lib/rdf/format.rb
CHANGED
@@ -405,14 +405,14 @@ module RDF
|
|
405
405
|
@@content_types[type] << self unless @@content_types[type].include?(self)
|
406
406
|
|
407
407
|
if extensions = (options[:extension] || options[:extensions])
|
408
|
-
extensions =
|
408
|
+
extensions = Array(extensions).map(&:to_sym)
|
409
409
|
extensions.each do |ext|
|
410
410
|
@@file_extensions[ext] ||= []
|
411
411
|
@@file_extensions[ext] << self unless @@file_extensions[ext].include?(self)
|
412
412
|
end
|
413
413
|
end
|
414
414
|
if aliases = (options[:alias] || options[:aliases])
|
415
|
-
aliases =
|
415
|
+
aliases = Array(aliases).each do |a|
|
416
416
|
@@content_types[a] ||= []
|
417
417
|
@@content_types[a] << self unless @@content_types[a].include?(self)
|
418
418
|
end
|
data/lib/rdf/mixin/queryable.rb
CHANGED
@@ -19,16 +19,27 @@ module RDF
|
|
19
19
|
#
|
20
20
|
# @example Querying for statements having a given predicate
|
21
21
|
# queryable.query([nil, RDF::DOAP.developer, nil])
|
22
|
-
# queryable.query(:predicate => RDF::DOAP.developer)
|
22
|
+
# queryable.query(:predicate => RDF::DOAP.developer) do |statement|
|
23
|
+
# puts statement.inspect
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# @example Querying for solutions from a BGP
|
27
|
+
# query = RDF::Query.new {pattern [:s, :p, :o]}
|
28
|
+
# queryable.query(query) do |solution|
|
29
|
+
# puts solution.inspect
|
30
|
+
# end
|
23
31
|
#
|
24
32
|
# @param [RDF::Query, RDF::Statement, Array(RDF::Term), Hash] pattern
|
33
|
+
# @param [Hash{Symbol => Object}] options ({})
|
34
|
+
# Any other options passed to {#query_pattern} or {#query_execute}
|
25
35
|
# @yield [statement]
|
26
36
|
# each matching statement
|
27
|
-
# @yieldparam [RDF::Statement] statement
|
37
|
+
# @yieldparam [RDF::Statement, RDF::Query::Solution] statement
|
38
|
+
# Statement or Solution
|
28
39
|
# @yieldreturn [void] ignored
|
29
40
|
# @return [Enumerator]
|
30
41
|
# @see RDF::Queryable#query_pattern
|
31
|
-
def query(pattern, &block)
|
42
|
+
def query(pattern, options = {}, &block)
|
32
43
|
raise TypeError, "#{self} is not readable" if respond_to?(:readable?) && !readable?
|
33
44
|
|
34
45
|
case pattern
|
@@ -36,7 +47,11 @@ module RDF
|
|
36
47
|
when Query
|
37
48
|
if block_given?
|
38
49
|
before_query(pattern) if respond_to?(:before_query)
|
39
|
-
query_execute
|
50
|
+
if method(:query_execute).arity == 1
|
51
|
+
query_execute(pattern, &block)
|
52
|
+
else
|
53
|
+
query_execute(pattern, options, &block)
|
54
|
+
end
|
40
55
|
after_query(pattern) if respond_to?(:after_query)
|
41
56
|
end
|
42
57
|
enum_for(:query_execute, pattern)
|
@@ -63,7 +78,13 @@ module RDF
|
|
63
78
|
|
64
79
|
# Otherwise, we delegate to `#query_pattern`:
|
65
80
|
else # pattern.variable?
|
66
|
-
|
81
|
+
if block_given?
|
82
|
+
if self.method(:query_pattern).arity == 1
|
83
|
+
query_pattern(pattern, &block)
|
84
|
+
else
|
85
|
+
query_pattern(pattern, options, &block)
|
86
|
+
end
|
87
|
+
end
|
67
88
|
enum_for(:query_pattern, pattern)
|
68
89
|
end
|
69
90
|
after_query(pattern) if block_given? && respond_to?(:after_query)
|
@@ -85,6 +106,8 @@ module RDF
|
|
85
106
|
#
|
86
107
|
# @param [RDF::Query] query
|
87
108
|
# the query to execute
|
109
|
+
# @param [Hash{Symbol => Object}] options ({})
|
110
|
+
# Any other options passed to `query.execute`
|
88
111
|
# @yield [solution]
|
89
112
|
# @yieldparam [RDF::Query::Solution] solution
|
90
113
|
# @yieldreturn [void] ignored
|
@@ -92,12 +115,12 @@ module RDF
|
|
92
115
|
# @see RDF::Queryable#query
|
93
116
|
# @see RDF::Query#execute
|
94
117
|
# @since 0.3.0
|
95
|
-
def query_execute(query, &block)
|
118
|
+
def query_execute(query, options = {}, &block)
|
96
119
|
# By default, we let RDF.rb's built-in `RDF::Query#execute` handle BGP
|
97
120
|
# query execution by breaking down the query into its constituent
|
98
121
|
# triple patterns and invoking `RDF::Query::Pattern#execute` on each
|
99
122
|
# pattern.
|
100
|
-
query.execute(self).each(&block)
|
123
|
+
query.execute(self, options).each(&block)
|
101
124
|
end
|
102
125
|
protected :query_execute
|
103
126
|
|
@@ -111,6 +134,8 @@ module RDF
|
|
111
134
|
#
|
112
135
|
# @param [RDF::Query::Pattern] pattern
|
113
136
|
# the query pattern to match
|
137
|
+
# @param [Hash{Symbol => Object}] options ({})
|
138
|
+
# Any other options
|
114
139
|
# @yield [statement]
|
115
140
|
# @yieldparam [RDF::Statement] statement
|
116
141
|
# @yieldreturn [void] ignored
|
@@ -118,7 +143,7 @@ module RDF
|
|
118
143
|
# @see RDF::Queryable#query
|
119
144
|
# @see RDF::Query::Pattern#execute
|
120
145
|
# @since 0.2.0
|
121
|
-
def query_pattern(pattern, &block)
|
146
|
+
def query_pattern(pattern, options = {}, &block)
|
122
147
|
# By default, we let Ruby's built-in `Enumerable#grep` handle the
|
123
148
|
# matching of statements by iterating over all statements and calling
|
124
149
|
# `RDF::Query::Pattern#===` on each statement.
|
data/lib/rdf/model/literal.rb
CHANGED
@@ -366,19 +366,6 @@ module RDF
|
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
369
|
-
##
|
370
|
-
# Returns a copy of this literal converted into its canonical lexical
|
371
|
-
# representation.
|
372
|
-
#
|
373
|
-
# Subclasses should override `#canonicalize!` as needed and appropriate,
|
374
|
-
# not this method.
|
375
|
-
#
|
376
|
-
# @return [RDF::Literal]
|
377
|
-
# @since 0.2.1
|
378
|
-
def canonicalize
|
379
|
-
self.dup.canonicalize!
|
380
|
-
end
|
381
|
-
|
382
369
|
##
|
383
370
|
# Converts this literal into its canonical lexical representation.
|
384
371
|
#
|
@@ -50,7 +50,7 @@ module RDF; class Literal
|
|
50
50
|
i, f, e = ('%.15E' % @object.to_f).split(/[\.E]/)
|
51
51
|
f.sub!(/0*$/, '') # remove any trailing zeroes
|
52
52
|
f = '0' if f.empty? # ...but there must be a digit to the right of the decimal point
|
53
|
-
e.sub!(
|
53
|
+
e.sub!(/^(?:\+|(\-))?0+(\d+)$/, '\1\2') # remove the optional leading '+' sign and any extra leading zeroes
|
54
54
|
"#{i}.#{f}E#{e}"
|
55
55
|
end
|
56
56
|
@object = Float(@string) unless @object.nil?
|
@@ -41,7 +41,7 @@ module RDF; class Literal
|
|
41
41
|
end
|
42
42
|
|
43
43
|
##
|
44
|
-
# Returns the
|
44
|
+
# Returns the predecessor value of `self`.
|
45
45
|
#
|
46
46
|
# @return [RDF::Literal]
|
47
47
|
# @since 0.2.3
|
@@ -50,7 +50,7 @@ module RDF; class Literal
|
|
50
50
|
end
|
51
51
|
|
52
52
|
##
|
53
|
-
# Returns the
|
53
|
+
# Returns the successor value of `self`.
|
54
54
|
#
|
55
55
|
# @return [RDF::Literal]
|
56
56
|
# @since 0.2.3
|
@@ -22,7 +22,7 @@ module RDF; class Literal
|
|
22
22
|
@string ||= value if value.is_a?(String)
|
23
23
|
@object = case
|
24
24
|
when value.is_a?(::Time) then value
|
25
|
-
when value.respond_to?(:to_time) then value.to_time
|
25
|
+
when value.respond_to?(:to_time) then value.to_time rescue ::Time.parse(value.to_s)
|
26
26
|
else ::Time.parse(value.to_s)
|
27
27
|
end rescue nil
|
28
28
|
end
|
data/lib/rdf/model/statement.rb
CHANGED
@@ -127,10 +127,10 @@ module RDF
|
|
127
127
|
##
|
128
128
|
# @return [Boolean]
|
129
129
|
def valid?
|
130
|
-
has_subject? && subject.valid? &&
|
131
|
-
has_predicate? && predicate.valid? &&
|
132
|
-
has_object? && object.valid? &&
|
133
|
-
(has_context?
|
130
|
+
has_subject? && subject.resource? && subject.valid? &&
|
131
|
+
has_predicate? && predicate.uri? && predicate.valid? &&
|
132
|
+
has_object? && object.term? && object.valid? &&
|
133
|
+
(has_context? ? context.resource? && context.valid? : true )
|
134
134
|
end
|
135
135
|
|
136
136
|
##
|
@@ -256,6 +256,32 @@ module RDF
|
|
256
256
|
alias_method :to_a, :to_triple
|
257
257
|
alias_method :to_ary, :to_triple
|
258
258
|
|
259
|
+
##
|
260
|
+
# Canonicalizes each unfrozen term in the statement
|
261
|
+
#
|
262
|
+
# @return [RDF::Statement] `self`
|
263
|
+
# @since 1.0.8
|
264
|
+
# @raise [ArgumentError] if any element cannot be canonicalized.
|
265
|
+
def canonicalize!
|
266
|
+
self.subject.canonicalize! if has_subject? && !self.subject.frozen?
|
267
|
+
self.predicate.canonicalize! if has_predicate? && !self.predicate.frozen?
|
268
|
+
self.object.canonicalize! if has_object? && !self.object.frozen?
|
269
|
+
self.context.canonicalize! if has_context? && !self.context.frozen?
|
270
|
+
self.validate!
|
271
|
+
self
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# Returns a version of the statement with each position in canonical form
|
276
|
+
#
|
277
|
+
# @return [RDF::Statement] `self` or nil if statement cannot be canonicalized
|
278
|
+
# @since 1.0.8
|
279
|
+
def canonicalize
|
280
|
+
self.dup.canonicalize!
|
281
|
+
rescue ArgumentError
|
282
|
+
nil
|
283
|
+
end
|
284
|
+
|
259
285
|
##
|
260
286
|
# Returns the terms of this statement as a `Hash`.
|
261
287
|
#
|
data/lib/rdf/model/uri.rb
CHANGED
@@ -224,16 +224,6 @@ module RDF
|
|
224
224
|
self
|
225
225
|
end
|
226
226
|
|
227
|
-
##
|
228
|
-
# Returns a copy of this URI converted into its canonical lexical
|
229
|
-
# representation.
|
230
|
-
#
|
231
|
-
# @return [RDF::URI]
|
232
|
-
# @since 0.3.0
|
233
|
-
def canonicalize
|
234
|
-
self.dup.canonicalize!
|
235
|
-
end
|
236
|
-
|
237
227
|
##
|
238
228
|
# Converts this URI into its canonical lexical representation.
|
239
229
|
#
|
data/lib/rdf/model/value.rb
CHANGED
@@ -156,6 +156,27 @@ module RDF
|
|
156
156
|
end
|
157
157
|
alias_method :validate, :validate!
|
158
158
|
|
159
|
+
##
|
160
|
+
# Returns a copy of this value converted into its canonical
|
161
|
+
# representation.
|
162
|
+
#
|
163
|
+
# @return [RDF::Value]
|
164
|
+
# @since 1.0.8
|
165
|
+
def canonicalize
|
166
|
+
self.dup.canonicalize!
|
167
|
+
end
|
168
|
+
|
169
|
+
##
|
170
|
+
# Converts this value into its canonical representation.
|
171
|
+
#
|
172
|
+
# Should be overridden by concrete classes.
|
173
|
+
#
|
174
|
+
# @return [RDF::Value] `self`
|
175
|
+
# @since 1.0.8
|
176
|
+
def canonicalize!
|
177
|
+
self
|
178
|
+
end
|
179
|
+
|
159
180
|
##
|
160
181
|
# Returns an `RDF::Value` representation of `self`.
|
161
182
|
#
|
data/lib/rdf/nquads.rb
CHANGED
@@ -17,7 +17,7 @@ module RDF
|
|
17
17
|
# RDF::Format.for(:content_type => "application/n-quads")
|
18
18
|
# RDF::Format.for(:content_type => "text/x-nquads")
|
19
19
|
#
|
20
|
-
# @see http://
|
20
|
+
# @see http://www.w3.org/TR/n-quads/
|
21
21
|
# @since 0.4.0
|
22
22
|
class Format < RDF::Format
|
23
23
|
content_type 'application/n-quads', :extension => :nq, :alias => ['text/x-nquads']
|
@@ -80,7 +80,7 @@ module RDF
|
|
80
80
|
subject = read_uriref || read_node || fail_subject
|
81
81
|
predicate = read_uriref(:intern => true) || fail_predicate
|
82
82
|
object = read_uriref || read_node || read_literal || fail_object
|
83
|
-
context = read_uriref || read_node
|
83
|
+
context = read_uriref || read_node
|
84
84
|
if validate? && !read_eos
|
85
85
|
raise RDF::ReaderError, "expected end of statement in line #{lineno}: #{current_line.inspect}"
|
86
86
|
end
|
data/lib/rdf/ntriples.rb
CHANGED
@@ -32,9 +32,8 @@ module RDF
|
|
32
32
|
# @example Requiring the `RDF::NTriples` module explicitly
|
33
33
|
# require 'rdf/ntriples'
|
34
34
|
#
|
35
|
-
# @see http://www.w3.org/TR/
|
35
|
+
# @see http://www.w3.org/TR/n-triples/
|
36
36
|
# @see http://en.wikipedia.org/wiki/N-Triples
|
37
|
-
# @see http://librdf.org/ntriples/
|
38
37
|
#
|
39
38
|
# @author [Arto Bendiken](http://ar.to/)
|
40
39
|
module NTriples
|
data/lib/rdf/ntriples/writer.rb
CHANGED
@@ -175,6 +175,23 @@ module RDF::NTriples
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
+
##
|
179
|
+
# Initializes the writer.
|
180
|
+
#
|
181
|
+
# @param [IO, File] output
|
182
|
+
# the output stream
|
183
|
+
# @param [Hash{Symbol => Object}] options
|
184
|
+
# any additional options. See {RDF::Writer#initialize}
|
185
|
+
# @option options [Boolean] :validate (true)
|
186
|
+
# whether to validate terms when serializing
|
187
|
+
# @yield [writer] `self`
|
188
|
+
# @yieldparam [RDF::Writer] writer
|
189
|
+
# @yieldreturn [void]
|
190
|
+
def initialize(output = $stdout, options = {}, &block)
|
191
|
+
options = {:validate => true}.merge(options)
|
192
|
+
super
|
193
|
+
end
|
194
|
+
|
178
195
|
##
|
179
196
|
# Outputs an N-Triples comment line.
|
180
197
|
#
|
data/lib/rdf/repository.rb
CHANGED
data/lib/rdf/writer.rb
CHANGED
@@ -198,7 +198,9 @@ module RDF
|
|
198
198
|
# the encoding to use on the output stream (Ruby 1.9+).
|
199
199
|
# Defaults to the format associated with `content_encoding`.
|
200
200
|
# @option options [Boolean] :canonicalize (false)
|
201
|
-
# whether to canonicalize
|
201
|
+
# whether to canonicalize terms when serializing
|
202
|
+
# @option options [Boolean] :validate (false)
|
203
|
+
# whether to validate terms when serializing
|
202
204
|
# @option options [Hash] :prefixes (Hash.new)
|
203
205
|
# the prefix mappings to use (not supported by all writers)
|
204
206
|
# @option options [#to_s] :base_uri (nil)
|
@@ -308,6 +310,24 @@ module RDF
|
|
308
310
|
end
|
309
311
|
end
|
310
312
|
|
313
|
+
##
|
314
|
+
# Returns `true` if statements and terms should be validated.
|
315
|
+
#
|
316
|
+
# @return [Boolean] `true` or `false`
|
317
|
+
# @since 1.0.8
|
318
|
+
def validate?
|
319
|
+
@options[:validate]
|
320
|
+
end
|
321
|
+
|
322
|
+
##
|
323
|
+
# Returns `true` if terms should be canonicalized.
|
324
|
+
#
|
325
|
+
# @return [Boolean] `true` or `false`
|
326
|
+
# @since 1.0.8
|
327
|
+
def canonicalize?
|
328
|
+
@options[:canonicalize]
|
329
|
+
end
|
330
|
+
|
311
331
|
##
|
312
332
|
# Flushes the underlying output buffer.
|
313
333
|
#
|
@@ -361,15 +381,21 @@ module RDF
|
|
361
381
|
##
|
362
382
|
# @param [RDF::Statement] statement
|
363
383
|
# @return [void] `self`
|
384
|
+
# @raise [RDF::WriterError] if validating and attempting to write an invalid {RDF::Statement} or if canonicalizing a statement which cannot be canonicalized.
|
364
385
|
def write_statement(statement)
|
386
|
+
statement = statement.canonicalize! if canonicalize?
|
387
|
+
raise RDF::WriterError, "Statement #{statement.inspect} is invalid" if validate? && statement.invalid?
|
365
388
|
write_triple(*statement.to_triple)
|
366
389
|
self
|
390
|
+
rescue ArgumentError => e
|
391
|
+
raise WriterError, e.message
|
367
392
|
end
|
368
393
|
alias_method :insert_statement, :write_statement # support the RDF::Writable interface
|
369
394
|
|
370
395
|
##
|
371
396
|
# @param [Array<Array(RDF::Resource, RDF::URI, RDF::Term)>] triples
|
372
397
|
# @return [void] `self`
|
398
|
+
# @raise [RDF::WriterError] if validating and attempting to write an invalid {RDF::Term}.
|
373
399
|
def write_triples(*triples)
|
374
400
|
triples.each { |triple| write_triple(*triple) }
|
375
401
|
self
|
@@ -381,6 +407,7 @@ module RDF
|
|
381
407
|
# @param [RDF::Term] object
|
382
408
|
# @return [void] `self`
|
383
409
|
# @raise [NotImplementedError] unless implemented in subclass
|
410
|
+
# @raise [RDF::WriterError] if validating and attempting to write an invalid {RDF::Term}.
|
384
411
|
# @abstract
|
385
412
|
def write_triple(subject, predicate, object)
|
386
413
|
raise NotImplementedError.new("#{self.class}#write_triple") # override in subclasses
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-09-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -60,14 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - ! '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '2.
|
63
|
+
version: '2.14'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '2.
|
70
|
+
version: '2.14'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: yard
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project: rdf
|
195
|
-
rubygems_version: 2.0.
|
195
|
+
rubygems_version: 2.0.5
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: A Ruby library for working with Resource Description Framework (RDF) data.
|