rdf 3.1.1 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS +1 -1
- data/README.md +43 -9
- data/VERSION +1 -1
- data/bin/rdf +2 -2
- data/etc/doap.nt +74 -80
- data/lib/rdf.rb +16 -11
- data/lib/rdf/changeset.rb +7 -0
- data/lib/rdf/cli.rb +11 -3
- data/lib/rdf/mixin/enumerable.rb +1 -0
- data/lib/rdf/mixin/queryable.rb +8 -0
- data/lib/rdf/mixin/writable.rb +7 -0
- data/lib/rdf/model/dataset.rb +1 -1
- data/lib/rdf/model/graph.rb +3 -0
- data/lib/rdf/model/list.rb +15 -15
- data/lib/rdf/model/literal.rb +1 -0
- data/lib/rdf/model/literal/decimal.rb +6 -6
- data/lib/rdf/model/literal/double.rb +9 -9
- data/lib/rdf/model/literal/numeric.rb +34 -0
- data/lib/rdf/model/statement.rb +30 -7
- data/lib/rdf/model/uri.rb +10 -10
- data/lib/rdf/nquads.rb +2 -2
- data/lib/rdf/ntriples.rb +6 -4
- data/lib/rdf/ntriples/reader.rb +28 -3
- data/lib/rdf/ntriples/writer.rb +9 -0
- data/lib/rdf/query.rb +12 -2
- data/lib/rdf/query/hash_pattern_normalizer.rb +9 -8
- data/lib/rdf/query/pattern.rb +65 -38
- data/lib/rdf/query/solution.rb +20 -1
- data/lib/rdf/query/solutions.rb +15 -5
- data/lib/rdf/query/variable.rb +29 -6
- data/lib/rdf/reader.rb +65 -20
- data/lib/rdf/repository.rb +19 -12
- data/lib/rdf/util/cache.rb +2 -2
- data/lib/rdf/util/file.rb +3 -3
- data/lib/rdf/util/logger.rb +1 -1
- data/lib/rdf/vocab/owl.rb +401 -86
- data/lib/rdf/vocab/rdfs.rb +81 -18
- data/lib/rdf/vocab/rdfv.rb +122 -1
- data/lib/rdf/vocab/writer.rb +44 -5
- data/lib/rdf/vocab/xsd.rb +202 -1
- data/lib/rdf/vocabulary.rb +105 -11
- data/lib/rdf/writer.rb +21 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a2f065f2ef318b5183512ee7cbe816d3c86cf497a1822d886d1a5cb12ae7c7c
|
4
|
+
data.tar.gz: b51e9e8d120f8441da1cc4478a4a8bf470010cd8009eef992fb91d39fce2aeea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efe71f0a3278321dacffe85afac3b9fad8fd9c0be2736689ced8fcfa27164cf1f9a0221438c851fe8d61f375889ab6ca124f026a6a675b64b38792aa5c9f7e91
|
7
|
+
data.tar.gz: c9228398f6a2e3236bdfc878bbe083713648acee8e26c72a1bed358deea5041420667167976607b2942f24b026ab3d6aae03c046632ca41e6fa9760f997d752e
|
data/AUTHORS
CHANGED
data/README.md
CHANGED
@@ -4,10 +4,6 @@ This is a pure-Ruby library for working with [Resource Description Framework
|
|
4
4
|
(RDF)][RDF] data.
|
5
5
|
|
6
6
|
* <https://ruby-rdf.github.com/rdf>
|
7
|
-
* <https://blog.datagraph.org/2010/12/rdf-for-ruby>
|
8
|
-
* <https://blog.datagraph.org/2010/03/rdf-for-ruby>
|
9
|
-
* <https://blog.datagraph.org/2010/04/parsing-rdf-with-ruby>
|
10
|
-
* <https://blog.datagraph.org/2010/04/rdf-repository-howto>
|
11
7
|
|
12
8
|
[![Gem Version](https://badge.fury.io/rb/rdf.png)](https://badge.fury.io/rb/rdf)
|
13
9
|
[![Build Status](https://travis-ci.org/ruby-rdf/rdf.png?branch=master)](https://travis-ci.org/ruby-rdf/rdf)
|
@@ -33,6 +29,7 @@ This is a pure-Ruby library for working with [Resource Description Framework
|
|
33
29
|
* Note, changes in mapping hashes to keyword arguments for Ruby 2.7+ may require that arguments be passed more explicitly, especially when the first argument is a Hash and there are optional keyword arguments. In this case, Hash argument may need to be explicitly included within `{}` and the optional keyword arguments may need to be specified using `**{}` if there are no keyword arguments.
|
34
30
|
* Performs auto-detection of input to select appropriate Reader class if one
|
35
31
|
cannot be determined from file characteristics.
|
32
|
+
* Provisional support for [RDF*][].
|
36
33
|
|
37
34
|
### HTTP requests
|
38
35
|
|
@@ -223,6 +220,46 @@ A separate [SPARQL][SPARQL doc] gem builds on basic BGP support to provide full
|
|
223
220
|
foaf[:name] #=> RDF::URI("http://xmlns.com/foaf/0.1/name")
|
224
221
|
foaf['mbox'] #=> RDF::URI("http://xmlns.com/foaf/0.1/mbox")
|
225
222
|
|
223
|
+
## RDF* (RDFStar)
|
224
|
+
|
225
|
+
[RDF.rb][] includes provisional support for [RDF*][] with an N-Triples/N-Quads syntax extension that uses inline statements in the _subject_ or _object_ position.
|
226
|
+
|
227
|
+
Internally, an `RDF::Statement` is treated as another resource, along with `RDF::URI` and `RDF::Node`, which allows an `RDF::Statement` to have a `#subject` or `#object` which is also an `RDF::Statement`.
|
228
|
+
|
229
|
+
**Note: This feature is subject to change or elimination as the standards process progresses.**
|
230
|
+
|
231
|
+
### Serializing a Graph containing embedded statements
|
232
|
+
|
233
|
+
require 'rdf/ntriples'
|
234
|
+
statement = RDF::Statement(RDF::URI('bob'), RDF::Vocab::FOAF.age, RDF::Literal(23))
|
235
|
+
graph = RDF::Graph.new << [statement, RDF::URI("ex:certainty"), RDF::Literal(0.9)]
|
236
|
+
graph.dump(:ntriples, validate: false)
|
237
|
+
# => '<<<bob> <http://xmlns.com/foaf/0.1/age> "23"^^<http://www.w3.org/2001/XMLSchema#integer>>> <ex:certainty> "0.9"^^<http://www.w3.org/2001/XMLSchema#double> .'
|
238
|
+
|
239
|
+
### Reading a Graph containing embedded statements
|
240
|
+
|
241
|
+
By default, the N-Triples reader will reject a document containing a subject resource.
|
242
|
+
|
243
|
+
nt = '<<<bob> <http://xmlns.com/foaf/0.1/age> "23"^^<http://www.w3.org/2001/XMLSchema#integer>>> <ex:certainty> "0.9"^^<http://www.w3.org/2001/XMLSchema#double> .'
|
244
|
+
graph = RDF::Graph.new do |graph|
|
245
|
+
RDF::NTriples::Reader.new(nt) {|reader| graph << reader}
|
246
|
+
end
|
247
|
+
# => RDF::ReaderError
|
248
|
+
|
249
|
+
Readers support a `rdfstar` option with either `:PG` (Property Graph) or `:SA` (Separate Assertions) modes. In `:PG` mode, statements that are used in the subject or object positions are also implicitly added to the graph:
|
250
|
+
|
251
|
+
graph = RDF::Graph.new do |graph|
|
252
|
+
RDF::NTriples::Reader.new(nt, rdfstar: :PG) {|reader| graph << reader}
|
253
|
+
end
|
254
|
+
graph.count #=> 2
|
255
|
+
|
256
|
+
When using the `:SA` mode, only one statement is asserted, although the reified statement is contained within the graph.
|
257
|
+
|
258
|
+
graph = RDF::Graph.new do |graph|
|
259
|
+
RDF::NTriples::Reader.new(nt, rdfstar: :SA) {|reader| graph << reader}
|
260
|
+
end
|
261
|
+
graph.count #=> 1
|
262
|
+
|
226
263
|
## Documentation
|
227
264
|
|
228
265
|
<https://rubydoc.info/github/ruby-rdf/rdf>
|
@@ -249,8 +286,6 @@ A separate [SPARQL][SPARQL doc] gem builds on basic BGP support to provide full
|
|
249
286
|
|
250
287
|
### RDF Serialization
|
251
288
|
|
252
|
-
<https://blog.datagraph.org/2010/04/parsing-rdf-with-ruby>
|
253
|
-
|
254
289
|
* {RDF::Format}
|
255
290
|
* {RDF::Reader}
|
256
291
|
* {RDF::Writer}
|
@@ -295,8 +330,6 @@ from BNode identity (i.e., they each entail the other)
|
|
295
330
|
|
296
331
|
### RDF Storage
|
297
332
|
|
298
|
-
<https://blog.datagraph.org/2010/04/rdf-repository-howto>
|
299
|
-
|
300
333
|
* {RDF::Repository}
|
301
334
|
* {RDF::Countable}
|
302
335
|
* {RDF::Enumerable}
|
@@ -419,7 +452,7 @@ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
|
419
452
|
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
420
453
|
[PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
|
421
454
|
[JSONLD doc]: https://rubydoc.info/github/ruby-rdf/json-ld
|
422
|
-
[LinkedData doc]: https://rubydoc.info/github/
|
455
|
+
[LinkedData doc]: https://rubydoc.info/github/ruby-rdf/linkeddata
|
423
456
|
[Microdata doc]: https://rubydoc.info/github/ruby-rdf/rdf-microdata
|
424
457
|
[N3 doc]: https://rubydoc.info/github/ruby-rdf/rdf-n3
|
425
458
|
[RDFa doc]: https://rubydoc.info/github/ruby-rdf/rdf-rdfa
|
@@ -442,6 +475,7 @@ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
|
442
475
|
[RDF::TriX]: https://ruby-rdf.github.com/rdf-trix
|
443
476
|
[RDF::Turtle]: https://ruby-rdf.github.com/rdf-turtle
|
444
477
|
[RDF::Raptor]: https://ruby-rdf.github.com/rdf-raptor
|
478
|
+
[RDF*]: https://lists.w3.org/Archives/Public/public-rdf-star/
|
445
479
|
[LinkedData]: https://ruby-rdf.github.com/linkeddata
|
446
480
|
[JSON::LD]: https://ruby-rdf.github.com/json-ld
|
447
481
|
[RestClient]: https://rubygems.org/gems/rest-client
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.6
|
data/bin/rdf
CHANGED
data/etc/doap.nt
CHANGED
@@ -1,85 +1,79 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
_:g6720 <http://xmlns.com/foaf/0.1/name> "Hellekin O. Wolf" .
|
2
|
+
_:g6720 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "c69f3255ff0639543cc5edfd8116eac8df16fab8" .
|
3
|
+
_:g6720 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
4
|
+
_:g6680 <http://xmlns.com/foaf/0.1/name> "Fumihiro Kato" .
|
5
|
+
_:g6680 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d31fdd6af7a279a89bf09fdc9f7c44d9d08bb930" .
|
6
|
+
_:g6680 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
7
|
+
<https://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/homepage> <https://bhuga.net/> .
|
8
|
+
<https://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" .
|
9
|
+
<https://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> .
|
10
|
+
<https://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" .
|
11
|
+
<https://bhuga.net/#ben> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
12
|
+
_:g6660 <http://xmlns.com/foaf/0.1/name> "Joey Geiger" .
|
13
|
+
_:g6660 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f412d743150d7b27b8468d56e69ca147917ea6fc" .
|
14
|
+
_:g6660 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
15
|
+
_:g6740 <http://xmlns.com/foaf/0.1/name> "John Fieber" .
|
16
|
+
_:g6740 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "f7653fc1ac0e82ebb32f092389bd5fc728eaae12" .
|
17
|
+
_:g6740 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
18
|
+
_:g6640 <http://xmlns.com/foaf/0.1/name> "Danny Gagne" .
|
19
|
+
_:g6640 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "6de43e9cf7de53427fea9765706703e4d957c17b" .
|
20
|
+
_:g6640 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
21
|
+
_:g6780 <http://xmlns.com/foaf/0.1/name> "Pius Uzamere" .
|
22
|
+
_:g6780 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "bedbbf2451e5beb38d59687c0460032aff92cd3c" .
|
23
|
+
_:g6780 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
24
|
+
_:g6700 <http://xmlns.com/foaf/0.1/name> "Naoki Kawamukai" .
|
25
|
+
_:g6700 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "5bdcd8e2af4f5952aaeeffbdd371c41525ec761d" .
|
26
|
+
_:g6700 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
3
27
|
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#homepage> <https://rubygems.org/gems/rdf> .
|
4
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <http://creativecommons.org/licenses/publicdomain/> .
|
5
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
|
6
28
|
<https://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
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#created> "2007-10-23" .
|
8
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#platform> "Ruby" .
|
9
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Resource_Description_Framework> .
|
10
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Ruby_(programming_language)> .
|
11
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/rdf11-concepts/> .
|
12
29
|
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/n-quads/> .
|
30
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/rdf11-concepts/> .
|
13
31
|
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#implements> <http://www.w3.org/TR/n-triples/> .
|
32
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <https://bhuga.net/#ben> .
|
33
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <https://greggkellogg.net/foaf#me> .
|
34
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#documenter> <https://ar.to/#self> .
|
14
35
|
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#download-page> <https://rubygems.org/gems/rdf/> .
|
15
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
16
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
17
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
18
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
19
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
20
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
21
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
22
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
23
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
24
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
25
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
26
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
27
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
<https://
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<https://
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
<https://
|
52
|
-
|
53
|
-
_:
|
54
|
-
_:
|
55
|
-
<
|
56
|
-
_:
|
57
|
-
_:
|
58
|
-
_:
|
59
|
-
<https://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
|
-
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g70186321063140 .
|
64
|
-
<https://rubygems.org/gems/rdf> <http://xmlns.com/foaf/0.1/maker> <http://ar.to/#self> .
|
65
|
-
<https://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <http://ar.to/#self> .
|
66
|
-
<http://ar.to/#self> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
67
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" .
|
68
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto@bendiken.net> .
|
69
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "a033f652c84a4d73b8c26d318c2395699dd2bdfb" .
|
70
|
-
<http://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "d0737cceb55eb7d740578d2db1bc0727e3ed49ce" .
|
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> <https://rubygems.org/gems/rdf> .
|
73
|
-
<http://ar.to/#self> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://datagraph.org/bendiken/foaf> .
|
74
|
-
<http://bhuga.net/#ben> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
75
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/name> "Ben Lavender" .
|
76
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox> <mailto:blavender@gmail.com> .
|
77
|
-
<http://bhuga.net/#ben> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "dbf45f4ffbd27b67aa84f02a6a31c144727d10af" .
|
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> .
|
80
|
-
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
81
|
-
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
|
82
|
-
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@greggkellogg.net> .
|
83
|
-
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "35bc44e6d0070e5ad50ccbe0d24403c96af2b9bd" .
|
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> .
|
36
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <https://bhuga.net/#ben> .
|
37
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <https://greggkellogg.net/foaf#me> .
|
38
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#developer> <https://ar.to/#self> .
|
39
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#created> "2007-10-23" .
|
40
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#shortdesc> "A Ruby library for working with Resource Description Framework (RDF) data."@en .
|
41
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <https://ar.to/> .
|
42
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#blog> <https://greggkellogg.net/> .
|
43
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#license> <https://unlicense.org/1.0/> .
|
44
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Ruby_(programming_language)> .
|
45
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#category> <http://dbpedia.org/resource/Resource_Description_Framework> .
|
46
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#name> "RDF.rb" .
|
47
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#programming-language> "Ruby" .
|
48
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6720 .
|
49
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6680 .
|
50
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6660 .
|
51
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6740 .
|
52
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6640 .
|
53
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6780 .
|
54
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6700 .
|
55
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6560 .
|
56
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#helper> _:g6760 .
|
57
|
+
<https://rubygems.org/gems/rdf> <http://xmlns.com/foaf/0.1/maker> <https://ar.to/#self> .
|
58
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#maintainer> <https://greggkellogg.net/foaf#me> .
|
59
|
+
<https://rubygems.org/gems/rdf> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://usefulinc.com/ns/doap#Project> .
|
60
|
+
<https://rubygems.org/gems/rdf> <http://usefulinc.com/ns/doap#bug-database> <https://github.com/ruby-rdf/rdf/issues> .
|
61
|
+
<https://rubygems.org/gems/rdf> <http://purl.org/dc/terms/creator> <https://ar.to/#self> .
|
62
|
+
<https://greggkellogg.net/foaf#me> <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <https://greggkellogg.net/foaf> .
|
63
|
+
<https://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/homepage> <https://greggkellogg.net/> .
|
64
|
+
<https://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" .
|
65
|
+
<https://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox> <mailto:gregg@greggkellogg.net> .
|
66
|
+
<https://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "35bc44e6d0070e5ad50ccbe0d24403c96af2b9bd" .
|
67
|
+
<https://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
68
|
+
<https://ar.to/#self> <http://xmlns.com/foaf/0.1/homepage> <https://ar.to/> .
|
69
|
+
<https://ar.to/#self> <http://xmlns.com/foaf/0.1/name> "Arto Bendiken" .
|
70
|
+
<https://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox> <mailto:arto@bendiken.net> .
|
71
|
+
<https://ar.to/#self> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "a033f652c84a4d73b8c26d318c2395699dd2bdfb" .
|
72
|
+
<https://ar.to/#self> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
73
|
+
<https://ar.to/#self> <http://xmlns.com/foaf/0.1/made> <https://rubygems.org/gems/rdf> .
|
74
|
+
_:g6760 <http://xmlns.com/foaf/0.1/name> "Keita Urashima" .
|
75
|
+
_:g6760 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "2b4247b6fd5bb4a1383378f325784318680d5ff9" .
|
76
|
+
_:g6760 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
77
|
+
_:g6560 <http://xmlns.com/foaf/0.1/name> "Călin Ardelean" .
|
78
|
+
_:g6560 <http://xmlns.com/foaf/0.1/mbox_sha1sum> "274bd18402fc773ffc0606996aa1fb90b603aa29" .
|
79
|
+
_:g6560 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
|
data/lib/rdf.rb
CHANGED
@@ -59,21 +59,26 @@ module RDF
|
|
59
59
|
# RDF vocabularies
|
60
60
|
autoload :Vocabulary, 'rdf/vocabulary'
|
61
61
|
autoload :StrictVocabulary, 'rdf/vocabulary'
|
62
|
-
VOCABS = Dir.glob(File.expand_path("../rdf/vocab/*.rb", __FILE__)).map { |f| File.basename(f)[0...-(File.extname(f).size)].to_sym } rescue []
|
63
62
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
63
|
+
VOCABS = {
|
64
|
+
owl: {uri: "http://www.w3.org/2002/07/owl#", class_name: "OWL"},
|
65
|
+
rdfs: {uri: "http://www.w3.org/2000/01/rdf-schema#", class_name: "RDFS"},
|
66
|
+
rdfv: {uri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", class_name: "RDFV"},
|
67
|
+
xsd: {uri: "http://www.w3.org/2001/XMLSchema#", class_name: "XSD"},
|
68
|
+
}
|
69
|
+
|
70
|
+
# Autoload vocabularies
|
71
|
+
VOCABS.each do |id, params|
|
72
|
+
v = (params[:class_name] ||= id.to_s.upcase).to_sym
|
73
|
+
autoload v, File.expand_path("../rdf/vocab/#{id}", __FILE__)
|
72
74
|
end
|
73
75
|
|
74
76
|
# Utilities
|
75
77
|
autoload :Util, 'rdf/util'
|
76
78
|
|
79
|
+
# CLI
|
80
|
+
autoload :CLI, 'rdf/cli'
|
81
|
+
|
77
82
|
##
|
78
83
|
# Alias for `RDF::Resource.new`.
|
79
84
|
#
|
@@ -200,8 +205,8 @@ module RDF
|
|
200
205
|
#
|
201
206
|
# @param (see RDF::Vocabulary#initialize)
|
202
207
|
# @return [Class]
|
203
|
-
def self.StrictVocabulary(
|
204
|
-
StrictVocabulary.create(
|
208
|
+
def self.StrictVocabulary(uri)
|
209
|
+
StrictVocabulary.create(uri)
|
205
210
|
end
|
206
211
|
|
207
212
|
##
|
data/lib/rdf/changeset.rb
CHANGED
@@ -218,5 +218,12 @@ module RDF
|
|
218
218
|
stmts.each { |s| send(target) << s }
|
219
219
|
end
|
220
220
|
|
221
|
+
# This simply returns its argument as a query in order to trick
|
222
|
+
# {RDF::Mutable#delete} into working.
|
223
|
+
def query(stmt)
|
224
|
+
RDF::Query.new RDF::Query::Pattern.from(stmt)
|
225
|
+
end
|
226
|
+
|
227
|
+
undef_method :load
|
221
228
|
end # Changeset
|
222
229
|
end # RDF
|
data/lib/rdf/cli.rb
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
require 'linkeddata'
|
9
9
|
rescue LoadError
|
10
10
|
# Silently load without linkeddata, but try some others
|
11
|
-
%w(
|
11
|
+
%w(microdata n3 rdfa rdfxml reasoner tabular trig trix turtle vocab xsd json/ld ld/patch).each do |ser|
|
12
12
|
begin
|
13
13
|
require ser.include?('/') ? ser : "rdf/#{ser}"
|
14
14
|
rescue LoadError
|
@@ -296,6 +296,12 @@ module RDF
|
|
296
296
|
control: :none,
|
297
297
|
on: ["-o", "--output FILE"],
|
298
298
|
description: "File to write output, defaults to STDOUT") {|arg| File.open(arg, "w")},
|
299
|
+
RDF::CLI::Option.new(
|
300
|
+
symbol: :ordered,
|
301
|
+
control: :checkbox,
|
302
|
+
datatype: TrueClass,
|
303
|
+
on: ["--ordered"],
|
304
|
+
description: "Use order preserving repository"),
|
299
305
|
RDF::CLI::Option.new(
|
300
306
|
symbol: :format,
|
301
307
|
control: :select,
|
@@ -495,14 +501,16 @@ module RDF
|
|
495
501
|
options[:format] = options[:format].to_sym if options[:format]
|
496
502
|
options[:output_format] = options[:output_format].to_sym if options[:output_format]
|
497
503
|
|
498
|
-
@repository =
|
504
|
+
@repository = options[:ordered] ?
|
505
|
+
[].extend(RDF::Enumerable, RDF::Queryable) :
|
506
|
+
RDF::Repository.new
|
499
507
|
|
500
508
|
# Parse input files if any command requires it
|
501
509
|
if cmds.any? {|c| COMMANDS[c.to_sym][:parse]}
|
502
510
|
start = Time.new
|
503
511
|
count = 0
|
504
512
|
self.parse(args, **options) do |reader|
|
505
|
-
@repository <<
|
513
|
+
reader.each_statement {|st| @repository << st}
|
506
514
|
end
|
507
515
|
secs = Time.new - start
|
508
516
|
options[:logger].info "Parsed #{repository.count} statements with #{@readers.join(', ')} in #{secs} seconds @ #{count/secs} statements/second."
|
data/lib/rdf/mixin/enumerable.rb
CHANGED
@@ -71,6 +71,7 @@ module RDF
|
|
71
71
|
# * `:literal_equality' preserves [term-equality](https://www.w3.org/TR/rdf11-concepts/#dfn-literal-term-equality) for literals. Literals are equal only if their lexical values and datatypes are equal, character by character. Literals may be "inlined" to value-space for efficiency only if `:literal_equality` is `false`.
|
72
72
|
# * `:validity` allows a concrete Enumerable implementation to indicate that it does or does not support valididty checking. By default implementations are assumed to support validity checking.
|
73
73
|
# * `:skolemize` supports [Skolemization](https://www.w3.org/wiki/BnodeSkolemization) of an `Enumerable`. Implementations supporting this feature must implement a `#skolemize` method, taking a base URI used for minting URIs for BNodes as stable identifiers and a `#deskolemize` method, also taking a base URI used for turning URIs having that prefix back into the same BNodes which were originally skolemized.
|
74
|
+
# * `:rdfstar` supports RDF* where statements may be subjects or objects of other statements.
|
74
75
|
#
|
75
76
|
# @param [Symbol, #to_sym] feature
|
76
77
|
# @return [Boolean]
|
data/lib/rdf/mixin/queryable.rb
CHANGED
@@ -128,6 +128,14 @@ module RDF
|
|
128
128
|
# method in order to provide for storage-specific optimized triple
|
129
129
|
# pattern matching.
|
130
130
|
#
|
131
|
+
# ## RDFStar (RDF*)
|
132
|
+
#
|
133
|
+
# Statements may have embedded statements as either a subject or object, recursively.
|
134
|
+
#
|
135
|
+
# Patterns may also have embedded patterns as either a subject or object, recursively.
|
136
|
+
#
|
137
|
+
# When matching, match an embedded pattern against embedded statements, recursively. (see {RDF::Query::Pattern#eql?})
|
138
|
+
#
|
131
139
|
# @param [RDF::Query::Pattern] pattern
|
132
140
|
# the query pattern to match
|
133
141
|
# @param [Hash{Symbol => Object}] options ({})
|
data/lib/rdf/mixin/writable.rb
CHANGED
@@ -54,10 +54,12 @@ module RDF
|
|
54
54
|
# @overload insert(*statements)
|
55
55
|
# @param [Array<RDF::Statement>] statements
|
56
56
|
# @return [self]
|
57
|
+
# @raise [ArgumentError] on an attempt to insert an embedded statement when it is not supported
|
57
58
|
#
|
58
59
|
# @overload insert(statements)
|
59
60
|
# @param [Enumerable<RDF::Statement>] statements
|
60
61
|
# @return [self]
|
62
|
+
# @raise [ArgumentError] on an attempt to insert an embedded statement when it is not supported
|
61
63
|
def insert(*statements)
|
62
64
|
coerce_statements(statements) { |value| insert_statements value }
|
63
65
|
|
@@ -120,10 +122,14 @@ module RDF
|
|
120
122
|
#
|
121
123
|
# @param [RDF::Enumerable] statements
|
122
124
|
# @return [void]
|
125
|
+
# @raise [ArgumentError] on an attempt to insert an embedded statement when it is not supported
|
123
126
|
# @since 0.1.6
|
124
127
|
def insert_statements(statements)
|
125
128
|
each = statements.respond_to?(:each_statement) ? :each_statement : :each
|
126
129
|
statements.__send__(each) do |statement|
|
130
|
+
if statement.embedded? && respond_to?(:supports?) && !supports?(:rdfstar)
|
131
|
+
raise ArgumentError, "Wriable does not support embedded statements"
|
132
|
+
end
|
127
133
|
insert_statement(statement)
|
128
134
|
end
|
129
135
|
end
|
@@ -138,6 +144,7 @@ module RDF
|
|
138
144
|
#
|
139
145
|
# @param [RDF::Statement] statement
|
140
146
|
# @return [void]
|
147
|
+
# @raise [ArgumentError] on an attempt to insert an embedded statement when it is not supported
|
141
148
|
# @abstract
|
142
149
|
def insert_statement(statement)
|
143
150
|
raise NotImplementedError.new("#{self.class}#insert_statement")
|