rdf 1.1.0.p3 → 1.1.0p4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CREDITS +1 -0
- data/README +7 -4
- data/VERSION +1 -1
- data/etc/doap.nt +75 -75
- data/lib/rdf/format.rb +5 -3
- data/lib/rdf/mixin/countable.rb +9 -1
- data/lib/rdf/mixin/enumerable.rb +5 -1
- data/lib/rdf/mixin/queryable.rb +59 -12
- 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 -2
- data/lib/rdf/model/literal.rb +17 -15
- data/lib/rdf/model/statement.rb +30 -4
- data/lib/rdf/model/uri.rb +30 -3
- data/lib/rdf/model/value.rb +21 -0
- data/lib/rdf/nquads.rb +3 -2
- data/lib/rdf/ntriples/reader.rb +1 -0
- data/lib/rdf/ntriples/writer.rb +23 -2
- data/lib/rdf/ntriples.rb +1 -2
- data/lib/rdf/query/solutions.rb +1 -1
- data/lib/rdf/reader.rb +1 -1
- data/lib/rdf/repository.rb +1 -1
- data/lib/rdf/util/file.rb +11 -4
- data/lib/rdf/vocab/schema.rb +652 -0
- data/lib/rdf/vocab.rb +20 -19
- data/lib/rdf/writer.rb +30 -2
- data/lib/rdf.rb +27 -3
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzQwOTc4Mjk1Y2NmOWMzODIzZjFiNTdhNzYyZWUxOTYwOGFjNTdiMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2NiZTBiYzljOTBiNDkzMmMzODI5NWJjZGFiNmViYzkxNzNhNjZjNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmU4YjMwMzUxMmNjZTViYWNjZTQ2ZjU1MzdjZWRmYzY1ZmQ2OTUyYzU0N2Zm
|
10
|
+
YzYzYmY5Y2FkMmY3MjVjNzUyZjZhOTc2MWUyOWI4NTgwN2Q3MzA4ZjJjNTk0
|
11
|
+
MmUzOTNhNGU3ZTY3NjI4NzQ2NTllMzk1YjliZjljNzA4ZDQzM2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGY0NzJjZTJmM2M0YjQ1ZTRmM2UyYTBiM2RmYjBlZWNmMzZiZjE5ZDkxYWVm
|
14
|
+
NzMxZTE4MDUxYWZhYTc3MDhkODQ3NTY3YzNiNTZkNzQ3ZWVjODFkYzVkMDAz
|
15
|
+
YjA2ZjkyOTU5YjI1NzlhY2U3OGYzZTU2YmUzMDhiM2ExZmVmMjI=
|
data/CREDITS
CHANGED
data/README
CHANGED
@@ -18,7 +18,7 @@ This is a pure-Ruby library for working with [Resource Description Framework
|
|
18
18
|
* Fully compatible with [RDF 1.1][] specifications.
|
19
19
|
* 100% free and unencumbered [public domain](http://unlicense.org/) software.
|
20
20
|
* Provides a clean, well-designed RDF object model and related APIs.
|
21
|
-
* Supports parsing and serializing N-Triples out of the box, with more
|
21
|
+
* Supports parsing and serializing [N-Triples][] and [N-Quads][] out of the box, with more
|
22
22
|
serialization format support available through add-on plugins.
|
23
23
|
* Includes in-memory graph and repository implementations, with more storage
|
24
24
|
adapter support available through add-on plugins.
|
@@ -79,7 +79,7 @@ the 1.1 release of RDF.rb:
|
|
79
79
|
When installed, RDF.rb includes a `rdf` shell script which acts as a wrapper to perform a number of different
|
80
80
|
operations on RDF files using available readers and writers.
|
81
81
|
|
82
|
-
* `serialize`: Parse an RDF input and re-serializing to N-Triples or another available format using `--output-format` option.
|
82
|
+
* `serialize`: Parse an RDF input and re-serializing to [N-Triples][] or another available format using `--output-format` option.
|
83
83
|
* `count`: Parse and RDF input and count the number of statements.
|
84
84
|
* `subjects`: Returns unique subjects from parsed input.
|
85
85
|
* `objects`: Returns unique objects from parsed input.
|
@@ -90,7 +90,7 @@ operations on RDF files using available readers and writers.
|
|
90
90
|
require 'rdf'
|
91
91
|
include RDF
|
92
92
|
|
93
|
-
### Writing RDF data using the N-Triples format
|
93
|
+
### Writing RDF data using the [N-Triples][] format
|
94
94
|
|
95
95
|
require 'rdf/ntriples'
|
96
96
|
graph = RDF::Graph.new << [:hello, RDF::DC.title, "Hello, world!"]
|
@@ -100,7 +100,7 @@ or
|
|
100
100
|
|
101
101
|
RDF::Writer.open("hello.nt") { |writer| writer << graph }
|
102
102
|
|
103
|
-
### Reading RDF data in the N-Triples format
|
103
|
+
### Reading RDF data in the [N-Triples][] format
|
104
104
|
|
105
105
|
require 'rdf/ntriples'
|
106
106
|
graph = RDF::Graph.load("http://ruby-rdf.github.com/rdf/etc/doap.nt")
|
@@ -383,6 +383,7 @@ follows:
|
|
383
383
|
* [Joey Geiger](http://github.com/jgeiger) - <http://github.com/jgeiger>
|
384
384
|
* [Fumihiro Kato](http://github.com/fumi) - <http://fumi.me/>
|
385
385
|
* [Naoki Kawamukai](http://github.com/kna) - <http://github.com/kna>
|
386
|
+
* [Tom Nixon](https://github.com/tomjnixon) - <https://github.com/tomjnixon>
|
386
387
|
* [Hellekin O. Wolf](http://github.com/hellekin) - <http://hellekin.cepheide.org/>
|
387
388
|
* [John Fieber](http://github.com/jfieber) - <http://github.com/jfieber>
|
388
389
|
* [Keita Urashima](http://github.com/ursm) - <http://ursm.jp/>
|
@@ -412,6 +413,8 @@ This is free and unencumbered public domain software. For more information,
|
|
412
413
|
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
413
414
|
|
414
415
|
[RDF]: http://www.w3.org/RDF/
|
416
|
+
[N-Triples]: http://www.w3.org/TR/n-triples/
|
417
|
+
[N-Quads]: http://www.w3.org/TR/n-quads/
|
415
418
|
[YARD]: http://yardoc.org/
|
416
419
|
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
417
420
|
[PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.0p4
|
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/rdf11-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/format.rb
CHANGED
@@ -142,12 +142,14 @@ module RDF
|
|
142
142
|
|
143
143
|
# If we have a sample, use that for format detection
|
144
144
|
if sample = (options[:sample] if options.is_a?(Hash)) || (yield if block_given?)
|
145
|
+
sample = sample.to_s
|
146
|
+
sample.force_encoding(Encoding::UTF_8) if sample.respond_to?(:force_encoding)
|
145
147
|
# Given a sample, perform format detection across the appropriate formats, choosing
|
146
148
|
# the first that matches
|
147
149
|
format ||= @@subclasses
|
148
150
|
|
149
151
|
# Return first format that has a positive detection
|
150
|
-
format.detect {|f| f.detect(sample
|
152
|
+
format.detect {|f| f.detect(sample)} || format.first
|
151
153
|
elsif format.is_a?(Array)
|
152
154
|
# Otherwise, just return the first matching format
|
153
155
|
format.first
|
@@ -405,14 +407,14 @@ module RDF
|
|
405
407
|
@@content_types[type] << self unless @@content_types[type].include?(self)
|
406
408
|
|
407
409
|
if extensions = (options[:extension] || options[:extensions])
|
408
|
-
extensions =
|
410
|
+
extensions = Array(extensions).map(&:to_sym)
|
409
411
|
extensions.each do |ext|
|
410
412
|
@@file_extensions[ext] ||= []
|
411
413
|
@@file_extensions[ext] << self unless @@file_extensions[ext].include?(self)
|
412
414
|
end
|
413
415
|
end
|
414
416
|
if aliases = (options[:alias] || options[:aliases])
|
415
|
-
aliases =
|
417
|
+
aliases = Array(aliases).each do |a|
|
416
418
|
@@content_types[a] ||= []
|
417
419
|
@@content_types[a] << self unless @@content_types[a].include?(self)
|
418
420
|
end
|
data/lib/rdf/mixin/countable.rb
CHANGED
@@ -31,8 +31,16 @@ module RDF
|
|
31
31
|
# @see Object#enum_for
|
32
32
|
def enum_for(method = :each, *args)
|
33
33
|
# Ensure that enumerators support the `#empty?` and `#count` methods:
|
34
|
-
|
34
|
+
this = self
|
35
|
+
Countable::Enumerator.new do |yielder|
|
36
|
+
this.send(method, *args) {|y| yielder << y}
|
37
|
+
end
|
35
38
|
end
|
36
39
|
alias_method :to_enum, :enum_for
|
40
|
+
|
41
|
+
# Extends Enumerator with {Countable}, which is used by {Countable#enum_for}
|
42
|
+
class Enumerator < ::Enumerator
|
43
|
+
include Countable
|
44
|
+
end
|
37
45
|
end # Countable
|
38
46
|
end # RDF
|
data/lib/rdf/mixin/enumerable.rb
CHANGED
@@ -162,7 +162,11 @@ module RDF
|
|
162
162
|
# @return [Enumerator]
|
163
163
|
# @see #each_statement
|
164
164
|
def enum_statement
|
165
|
-
|
165
|
+
# Ensure that statements are queryable, countable and enumerable
|
166
|
+
this = self
|
167
|
+
Queryable::Enumerator.new do |yielder|
|
168
|
+
this.send(:each_statement) {|y| yielder << y}
|
169
|
+
end
|
166
170
|
end
|
167
171
|
alias_method :enum_statements, :enum_statement
|
168
172
|
|
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,14 +78,16 @@ 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)
|
70
|
-
enum.extend(RDF::Queryable, RDF::Enumerable, RDF::Countable)
|
71
|
-
def enum.to_a
|
72
|
-
super.extend(RDF::Queryable, RDF::Enumerable, RDF::Countable)
|
73
|
-
end
|
74
91
|
enum
|
75
92
|
end
|
76
93
|
end
|
@@ -85,6 +102,8 @@ module RDF
|
|
85
102
|
#
|
86
103
|
# @param [RDF::Query] query
|
87
104
|
# the query to execute
|
105
|
+
# @param [Hash{Symbol => Object}] options ({})
|
106
|
+
# Any other options passed to `query.execute`
|
88
107
|
# @yield [solution]
|
89
108
|
# @yieldparam [RDF::Query::Solution] solution
|
90
109
|
# @yieldreturn [void] ignored
|
@@ -92,12 +111,12 @@ module RDF
|
|
92
111
|
# @see RDF::Queryable#query
|
93
112
|
# @see RDF::Query#execute
|
94
113
|
# @since 0.3.0
|
95
|
-
def query_execute(query, &block)
|
114
|
+
def query_execute(query, options = {}, &block)
|
96
115
|
# By default, we let RDF.rb's built-in `RDF::Query#execute` handle BGP
|
97
116
|
# query execution by breaking down the query into its constituent
|
98
117
|
# triple patterns and invoking `RDF::Query::Pattern#execute` on each
|
99
118
|
# pattern.
|
100
|
-
query.execute(self).each(&block)
|
119
|
+
query.execute(self, options).each(&block)
|
101
120
|
end
|
102
121
|
protected :query_execute
|
103
122
|
|
@@ -111,6 +130,8 @@ module RDF
|
|
111
130
|
#
|
112
131
|
# @param [RDF::Query::Pattern] pattern
|
113
132
|
# the query pattern to match
|
133
|
+
# @param [Hash{Symbol => Object}] options ({})
|
134
|
+
# Any other options
|
114
135
|
# @yield [statement]
|
115
136
|
# @yieldparam [RDF::Statement] statement
|
116
137
|
# @yieldreturn [void] ignored
|
@@ -118,7 +139,7 @@ module RDF
|
|
118
139
|
# @see RDF::Queryable#query
|
119
140
|
# @see RDF::Query::Pattern#execute
|
120
141
|
# @since 0.2.0
|
121
|
-
def query_pattern(pattern, &block)
|
142
|
+
def query_pattern(pattern, options = {}, &block)
|
122
143
|
# By default, we let Ruby's built-in `Enumerable#grep` handle the
|
123
144
|
# matching of statements by iterating over all statements and calling
|
124
145
|
# `RDF::Query::Pattern#===` on each statement.
|
@@ -265,5 +286,31 @@ module RDF
|
|
265
286
|
def first_value(pattern = nil)
|
266
287
|
(literal = first_literal(pattern)) ? literal.value : nil
|
267
288
|
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# @private
|
292
|
+
# @param [Symbol, #to_sym] method
|
293
|
+
# @return [Enumerator]
|
294
|
+
# @see Object#enum_for
|
295
|
+
def enum_for(method = :each, *args)
|
296
|
+
# Ensure that enumerators are, themselves, queryable
|
297
|
+
this = self
|
298
|
+
Queryable::Enumerator.new do |yielder|
|
299
|
+
this.send(method, *args) {|y| yielder << y}
|
300
|
+
end
|
301
|
+
end
|
302
|
+
alias_method :to_enum, :enum_for
|
303
|
+
|
304
|
+
|
305
|
+
# Extends Enumerator with {Queryable} and {Enumerable}, which is used by {Enumerable#each_statement} and {Queryable#enum_for}
|
306
|
+
class Enumerator < ::Enumerator
|
307
|
+
include Queryable
|
308
|
+
include Enumerable
|
309
|
+
|
310
|
+
# Make sure returned arrays are also queryable
|
311
|
+
def to_a
|
312
|
+
return super.to_a.extend(RDF::Queryable, RDF::Enumerable)
|
313
|
+
end
|
314
|
+
end
|
268
315
|
end # Queryable
|
269
316
|
end # RDF
|
@@ -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
|
@@ -67,7 +67,6 @@ module RDF; class Literal
|
|
67
67
|
@object.strftime('%H:%M:%S%:z').
|
68
68
|
sub(/\+00:00|UTC|GMT/, 'Z')
|
69
69
|
else
|
70
|
-
# FIXME: verify
|
71
70
|
# JRuby doesn't do timezone's properly, use utc_offset
|
72
71
|
off = @object.utc_offset == 0 ? "Z" : ("%0.2d:00" % (@object.utc_offset/3600))
|
73
72
|
@object.strftime("%H:%M:%S#{off}")
|
data/lib/rdf/model/literal.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
module RDF
|
2
3
|
##
|
3
4
|
# An RDF literal.
|
@@ -58,12 +59,14 @@ module RDF
|
|
58
59
|
|
59
60
|
private
|
60
61
|
@@subclasses = [] # @private
|
62
|
+
@@datatype_map = nil # @private
|
61
63
|
|
62
64
|
##
|
63
65
|
# @private
|
64
66
|
# @return [void]
|
65
67
|
def self.inherited(child)
|
66
68
|
@@subclasses << child
|
69
|
+
@@datatype_map = nil
|
67
70
|
super
|
68
71
|
end
|
69
72
|
|
@@ -81,11 +84,22 @@ module RDF
|
|
81
84
|
|
82
85
|
include RDF::Term
|
83
86
|
|
87
|
+
##
|
88
|
+
# @private
|
89
|
+
# Return Hash mapping from datatype URI to class
|
90
|
+
def self.datatype_map
|
91
|
+
@@datatype_map ||= Hash[
|
92
|
+
@@subclasses
|
93
|
+
.select {|klass| klass.const_defined?(:DATATYPE)}
|
94
|
+
.map {|klass| [klass.const_get(:DATATYPE).to_s, klass]}
|
95
|
+
]
|
96
|
+
end
|
97
|
+
|
84
98
|
##
|
85
99
|
# @private
|
86
100
|
# Return datatype class for uri, or nil if none is found
|
87
101
|
def self.datatyped_class(uri)
|
88
|
-
|
102
|
+
datatype_map[uri]
|
89
103
|
end
|
90
104
|
|
91
105
|
##
|
@@ -96,7 +110,7 @@ module RDF
|
|
96
110
|
klass = case
|
97
111
|
when !self.equal?(RDF::Literal)
|
98
112
|
self # subclasses can be directly constructed without type dispatch
|
99
|
-
when typed_literal = datatyped_class(
|
113
|
+
when typed_literal = datatyped_class(options[:datatype].to_s)
|
100
114
|
typed_literal
|
101
115
|
else case value
|
102
116
|
when ::TrueClass then RDF::Literal::Boolean
|
@@ -150,6 +164,7 @@ module RDF
|
|
150
164
|
@object = value
|
151
165
|
@string = options[:lexical] if options[:lexical]
|
152
166
|
@string = value if !defined?(@string) && value.is_a?(String)
|
167
|
+
@string.encode!(Encoding::UTF_8) if @string && @string.respond_to?(:encode!)
|
153
168
|
@language = options[:language].to_s.to_sym if options[:language]
|
154
169
|
@datatype = RDF::URI(options[:datatype]) if options[:datatype]
|
155
170
|
@datatype ||= self.class.const_get(:DATATYPE) if self.class.const_defined?(:DATATYPE)
|
@@ -354,19 +369,6 @@ module RDF
|
|
354
369
|
end
|
355
370
|
end
|
356
371
|
|
357
|
-
##
|
358
|
-
# Returns a copy of this literal converted into its canonical lexical
|
359
|
-
# representation.
|
360
|
-
#
|
361
|
-
# Subclasses should override `#canonicalize!` as needed and appropriate,
|
362
|
-
# not this method.
|
363
|
-
#
|
364
|
-
# @return [RDF::Literal]
|
365
|
-
# @since 0.2.1
|
366
|
-
def canonicalize
|
367
|
-
self.dup.canonicalize!
|
368
|
-
end
|
369
|
-
|
370
372
|
##
|
371
373
|
# Converts this literal into its canonical lexical representation.
|
372
374
|
#
|
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
|
#
|