rdf 3.2.3 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +37 -37
- data/VERSION +1 -1
- data/lib/rdf/mixin/countable.rb +5 -1
- data/lib/rdf/mixin/enumerable.rb +13 -1
- data/lib/rdf/mixin/queryable.rb +13 -1
- data/lib/rdf/model/list.rb +1 -1
- data/lib/rdf/model/statement.rb +3 -1
- data/lib/rdf/model/uri.rb +3 -2
- data/lib/rdf/ntriples/reader.rb +1 -1
- data/lib/rdf/vocab/owl.rb +450 -445
- data/lib/rdf/vocab/rdfs.rb +89 -88
- data/lib/rdf/vocab/writer.rb +84 -51
- data/lib/rdf/vocab/xsd.rb +249 -249
- data/lib/rdf/vocabulary.rb +109 -124
- data/lib/rdf.rb +0 -3
- metadata +5 -6
- data/lib/rdf/mixin/enumerator.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fac2b932398cb302e6b2ecf300e6508879ed43314c52822d7a7ae9482127ea05
|
4
|
+
data.tar.gz: 6f78f54676b45f1bfd4767b30b545ec3016de440fcb8d5803ead213eed0e799d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa02358aa8f3362695cd433767c966a5c47fc3ba4c4bc8b95952e207dbf1e693a3468ea75735c34461d012b9efcd8f72e842d007e4dd1239b26d480d9e4f3f4c
|
7
|
+
data.tar.gz: e524ebef2e88903b3c8b0a48aa7b15b843924a8f6bc97fe06f524378d101409b1d88c07756b6a1be8002a38648b03d4ab362b6033f53bd810d05cc6dee141194
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
This is a pure-Ruby library for working with [Resource Description Framework
|
4
4
|
(RDF)][RDF] data.
|
5
5
|
|
6
|
-
* <https://ruby-rdf.github.
|
6
|
+
* <https://ruby-rdf.github.io/rdf>
|
7
7
|
|
8
8
|
[](https://badge.fury.io/rb/rdf)
|
9
9
|
[](https://github.com/ruby-rdf/rdf/actions?query=workflow%3ACI)
|
@@ -141,11 +141,11 @@ or
|
|
141
141
|
### Reading RDF data in the [N-Triples][] format
|
142
142
|
|
143
143
|
require 'rdf/ntriples'
|
144
|
-
graph = RDF::Graph.load("https://ruby-rdf.github.
|
144
|
+
graph = RDF::Graph.load("https://ruby-rdf.github.io/rdf/etc/doap.nt")
|
145
145
|
|
146
146
|
or
|
147
147
|
|
148
|
-
RDF::Reader.open("https://ruby-rdf.github.
|
148
|
+
RDF::Reader.open("https://ruby-rdf.github.io/rdf/etc/doap.nt") do |reader|
|
149
149
|
reader.each_statement do |statement|
|
150
150
|
puts statement.inspect
|
151
151
|
end
|
@@ -160,13 +160,13 @@ MimeType or file extension, where available.
|
|
160
160
|
|
161
161
|
require 'rdf/nquads'
|
162
162
|
|
163
|
-
graph = RDF::Graph.load("https://ruby-rdf.github.
|
163
|
+
graph = RDF::Graph.load("https://ruby-rdf.github.io/rdf/etc/doap.nq", format: :nquads)
|
164
164
|
|
165
165
|
A specific sub-type of Reader can also be invoked directly:
|
166
166
|
|
167
167
|
require 'rdf/nquads'
|
168
168
|
|
169
|
-
RDF::NQuads::Reader.open("https://ruby-rdf.github.
|
169
|
+
RDF::NQuads::Reader.open("https://ruby-rdf.github.io/rdf/etc/doap.nq") do |reader|
|
170
170
|
reader.each_statement do |statement|
|
171
171
|
puts statement.inspect
|
172
172
|
end
|
@@ -220,7 +220,7 @@ Note that no prefixes are loaded automatically, however they can be provided as
|
|
220
220
|
|
221
221
|
require 'rdf/ntriples'
|
222
222
|
|
223
|
-
graph = RDF::Graph.load("https://ruby-rdf.github.
|
223
|
+
graph = RDF::Graph.load("https://ruby-rdf.github.io/rdf/etc/doap.nt")
|
224
224
|
query = RDF::Query.new({
|
225
225
|
person: {
|
226
226
|
RDF.type => FOAF.Person,
|
@@ -295,7 +295,7 @@ Readers support a boolean valued `rdfstar` option.
|
|
295
295
|
|
296
296
|
## Documentation
|
297
297
|
|
298
|
-
<https://
|
298
|
+
<https://ruby-rdf.github.io/rdf>
|
299
299
|
|
300
300
|
### RDF Object Model
|
301
301
|
|
@@ -309,7 +309,7 @@ Readers support a boolean valued `rdfstar` option.
|
|
309
309
|
* {RDF::Literal::Double}
|
310
310
|
* {RDF::Literal::Integer}
|
311
311
|
* {RDF::Literal::Time}
|
312
|
-
* [RDF::XSD](https://
|
312
|
+
* [RDF::XSD](https://ruby-rdf.github.io/rdf-xsd) (extension)
|
313
313
|
* {RDF::Resource}
|
314
314
|
* {RDF::Node}
|
315
315
|
* {RDF::URI}
|
@@ -371,10 +371,10 @@ from BNode identity (i.e., they each entail the other)
|
|
371
371
|
* {RDF::Mutable}
|
372
372
|
* {RDF::Durable}
|
373
373
|
* {RDF::Transaction}
|
374
|
-
* [RDF::AllegroGraph](https://
|
375
|
-
* [RDF::Mongo](https://
|
376
|
-
* [RDF::DataObjects](https://
|
377
|
-
* [RDF::Sesame](https://
|
374
|
+
* [RDF::AllegroGraph](https://ruby-rdf.github.io/rdf-agraph) (extension)
|
375
|
+
* [RDF::Mongo](https://ruby-rdf.github.io/rdf-mongo) (extension)
|
376
|
+
* [RDF::DataObjects](https://ruby-rdf.github.io/rdf-do) (extension)
|
377
|
+
* [RDF::Sesame](https://ruby-rdf.github.io/rdf-sesame) (extension)
|
378
378
|
|
379
379
|
### RDF Querying
|
380
380
|
|
@@ -384,7 +384,7 @@ from BNode identity (i.e., they each entail the other)
|
|
384
384
|
* {RDF::Query::Solution}
|
385
385
|
* {RDF::Query::Solutions}
|
386
386
|
* {RDF::Query::Variable}
|
387
|
-
* [SPARQL](https://
|
387
|
+
* [SPARQL](https://ruby-rdf.github.io/sparql) (extension)
|
388
388
|
|
389
389
|
|
390
390
|
### RDF Vocabularies
|
@@ -422,7 +422,7 @@ follows:
|
|
422
422
|
|
423
423
|
## Resources
|
424
424
|
|
425
|
-
* <https://
|
425
|
+
* <https://ruby-rdf.github.io/rdf>
|
426
426
|
* <https://github.com/ruby-rdf/rdf>
|
427
427
|
* <https://rubygems.org/gems/rdf>
|
428
428
|
* <https://www.ohloh.net/p/rdf>
|
@@ -486,33 +486,33 @@ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
|
486
486
|
[YARD]: https://yardoc.org/
|
487
487
|
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
|
488
488
|
[PDD]: https://unlicense.org/#unlicensing-contributions
|
489
|
-
[JSONLD doc]: https://
|
490
|
-
[LinkedData doc]: https://
|
491
|
-
[Microdata doc]: https://
|
492
|
-
[N3 doc]: https://
|
493
|
-
[RDFa doc]: https://
|
494
|
-
[RDFXML doc]: https://
|
495
|
-
[Turtle doc]: https://
|
496
|
-
[SPARQL doc]: https://
|
489
|
+
[JSONLD doc]: https://ruby-rdf.github.io/json-ld
|
490
|
+
[LinkedData doc]: https://ruby-rdf.github.io/linkeddata
|
491
|
+
[Microdata doc]: https://ruby-rdf.github.io/rdf-microdata
|
492
|
+
[N3 doc]: https://ruby-rdf.github.io/rdf-n3
|
493
|
+
[RDFa doc]: https://ruby-rdf.github.io/rdf-rdfa
|
494
|
+
[RDFXML doc]: https://ruby-rdf.github.io/rdf-rdfxml
|
495
|
+
[Turtle doc]: https://ruby-rdf.github.io/rdf-turtle
|
496
|
+
[SPARQL doc]: https://ruby-rdf.github.io/sparql
|
497
497
|
[RDF 1.0]: https://www.w3.org/TR/2004/REC-rdf-concepts-20040210/
|
498
498
|
[RDF 1.1]: https://www.w3.org/TR/rdf11-concepts/
|
499
499
|
[SPARQL 1.1]: https://www.w3.org/TR/sparql11-query/
|
500
|
-
[RDF.rb]: https://ruby-rdf.github.
|
501
|
-
[RDF::DO]: https://ruby-rdf.github.
|
502
|
-
[RDF::Mongo]: https://ruby-rdf.github.
|
503
|
-
[RDF::Sesame]: https://ruby-rdf.github.
|
504
|
-
[RDF::JSON]: https://ruby-rdf.github.
|
505
|
-
[RDF::Microdata]: https://ruby-rdf.github.
|
506
|
-
[RDF::N3]: https://ruby-rdf.github.
|
507
|
-
[RDF::RDFa]: https://ruby-rdf.github.
|
508
|
-
[RDF::RDFXML]: https://ruby-rdf.github.
|
509
|
-
[RDF::TriG]: https://ruby-rdf.github.
|
510
|
-
[RDF::TriX]: https://ruby-rdf.github.
|
511
|
-
[RDF::Turtle]: https://ruby-rdf.github.
|
512
|
-
[RDF::Raptor]: https://ruby-rdf.github.
|
500
|
+
[RDF.rb]: https://ruby-rdf.github.io/
|
501
|
+
[RDF::DO]: https://ruby-rdf.github.io/rdf-do
|
502
|
+
[RDF::Mongo]: https://ruby-rdf.github.io/rdf-mongo
|
503
|
+
[RDF::Sesame]: https://ruby-rdf.github.io/rdf-sesame
|
504
|
+
[RDF::JSON]: https://ruby-rdf.github.io/rdf-json
|
505
|
+
[RDF::Microdata]: https://ruby-rdf.github.io/rdf-microdata
|
506
|
+
[RDF::N3]: https://ruby-rdf.github.io/rdf-n3
|
507
|
+
[RDF::RDFa]: https://ruby-rdf.github.io/rdf-rdfa
|
508
|
+
[RDF::RDFXML]: https://ruby-rdf.github.io/rdf-rdfxml
|
509
|
+
[RDF::TriG]: https://ruby-rdf.github.io/rdf-trig
|
510
|
+
[RDF::TriX]: https://ruby-rdf.github.io/rdf-trix
|
511
|
+
[RDF::Turtle]: https://ruby-rdf.github.io/rdf-turtle
|
512
|
+
[RDF::Raptor]: https://ruby-rdf.github.io/rdf-raptor
|
513
513
|
[RDF*]: https://w3c.github.io/rdf-star/rdf-star-cg-spec.html
|
514
|
-
[LinkedData]: https://ruby-rdf.github.
|
515
|
-
[JSON::LD]: https://ruby-rdf.github.
|
514
|
+
[LinkedData]: https://ruby-rdf.github.io/linkeddata
|
515
|
+
[JSON::LD]: https://ruby-rdf.github.io/json-ld
|
516
516
|
[RestClient]: https://rubygems.org/gems/rest-client
|
517
517
|
[RestClient Components]: https://rubygems.org/gems/rest-client-components
|
518
518
|
[Rack::Cache]: https://rtomayko.github.io/rack-cache/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.4
|
data/lib/rdf/mixin/countable.rb
CHANGED
@@ -2,9 +2,13 @@ module RDF
|
|
2
2
|
##
|
3
3
|
# @since 0.2.0
|
4
4
|
module Countable
|
5
|
-
autoload :Enumerator, 'rdf/mixin/enumerator'
|
6
5
|
extend RDF::Util::Aliasing::LateBound
|
7
6
|
|
7
|
+
# Extends Enumerator with {Countable}, which is used by {Countable#enum_for}
|
8
|
+
class Enumerator < ::Enumerator
|
9
|
+
include RDF::Countable
|
10
|
+
end
|
11
|
+
|
8
12
|
##
|
9
13
|
# Returns `true` if `self` contains no RDF statements.
|
10
14
|
#
|
data/lib/rdf/mixin/enumerable.rb
CHANGED
@@ -57,11 +57,23 @@ module RDF
|
|
57
57
|
# @see RDF::Graph
|
58
58
|
# @see RDF::Repository
|
59
59
|
module Enumerable
|
60
|
-
autoload :Enumerator, 'rdf/mixin/enumerator'
|
61
60
|
extend RDF::Util::Aliasing::LateBound
|
62
61
|
include ::Enumerable
|
63
62
|
include RDF::Countable # NOTE: must come after ::Enumerable
|
64
63
|
|
64
|
+
# Extends Enumerator with {Queryable} and {Enumerable}, which is used by {Enumerable#each_statement} and {Queryable#enum_for}
|
65
|
+
class Enumerator < ::Enumerator
|
66
|
+
include RDF::Queryable
|
67
|
+
include RDF::Enumerable
|
68
|
+
|
69
|
+
##
|
70
|
+
# @return [Array]
|
71
|
+
# @note Make sure returned arrays are also queryable
|
72
|
+
def to_a
|
73
|
+
return super.to_a.extend(RDF::Queryable, RDF::Enumerable)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
65
77
|
##
|
66
78
|
# Returns `true` if this enumerable supports the given `feature`.
|
67
79
|
#
|
data/lib/rdf/mixin/queryable.rb
CHANGED
@@ -9,9 +9,21 @@ module RDF
|
|
9
9
|
# @see RDF::Graph
|
10
10
|
# @see RDF::Repository
|
11
11
|
module Queryable
|
12
|
-
autoload :Enumerator, 'rdf/mixin/enumerator'
|
13
12
|
include ::Enumerable
|
14
13
|
|
14
|
+
# Extends Enumerator with {Queryable} and {Enumerable}, which is used by {Enumerable#each_statement} and {Queryable#enum_for}
|
15
|
+
class Enumerator < ::Enumerator
|
16
|
+
include RDF::Queryable
|
17
|
+
include RDF::Enumerable
|
18
|
+
|
19
|
+
##
|
20
|
+
# @return [Array]
|
21
|
+
# @note Make sure returned arrays are also queryable
|
22
|
+
def to_a
|
23
|
+
return super.to_a.extend(RDF::Queryable, RDF::Enumerable)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
15
27
|
##
|
16
28
|
# Queries `self` for RDF statements matching the given `pattern`.
|
17
29
|
#
|
data/lib/rdf/model/list.rb
CHANGED
data/lib/rdf/model/statement.rb
CHANGED
@@ -71,6 +71,7 @@ module RDF
|
|
71
71
|
# @option options [RDF::Term] :graph_name (nil)
|
72
72
|
# Note, in RDF 1.1, a graph name MUST be an {Resource}.
|
73
73
|
# @option options [Boolean] :inferred used as a marker to record that this statement was inferred based on semantic relationships (T-Box).
|
74
|
+
# @option options [Boolean] :quoted used as a marker to record that this statement quoted and appears as the subject or object of another RDF::Statement.
|
74
75
|
# @return [RDF::Statement]
|
75
76
|
#
|
76
77
|
# @overload initialize(subject, predicate, object, **options)
|
@@ -83,6 +84,7 @@ module RDF
|
|
83
84
|
# @option options [RDF::Term] :graph_name (nil)
|
84
85
|
# Note, in RDF 1.1, a graph name MUST be an {Resource}.
|
85
86
|
# @option options [Boolean] :inferred used as a marker to record that this statement was inferred based on semantic relationships (T-Box).
|
87
|
+
# @option options [Boolean] :quoted used as a marker to record that this statement quoted and appears as the subject or object of another RDF::Statement.
|
86
88
|
# @return [RDF::Statement]
|
87
89
|
def initialize(subject = nil, predicate = nil, object = nil, options = {})
|
88
90
|
if subject.is_a?(Hash)
|
@@ -209,7 +211,7 @@ module RDF
|
|
209
211
|
##
|
210
212
|
# @return [Boolean]
|
211
213
|
def quoted?
|
212
|
-
|
214
|
+
!!@options[:quoted]
|
213
215
|
end
|
214
216
|
|
215
217
|
##
|
data/lib/rdf/model/uri.rb
CHANGED
@@ -112,8 +112,9 @@ module RDF
|
|
112
112
|
).freeze
|
113
113
|
|
114
114
|
# Characters in a PName which must be escaped
|
115
|
-
|
116
|
-
|
115
|
+
# Note: not all reserved characters need to be escaped in SPARQL/Turtle, but they must be unescaped when encountered
|
116
|
+
PN_ESCAPE_CHARS = /[~\.!\$&'\(\)\*\+,;=\/\?\#@%]/.freeze
|
117
|
+
PN_ESCAPES = /\\#{Regexp.union(PN_ESCAPE_CHARS, /[\-_]/)}/.freeze
|
117
118
|
|
118
119
|
##
|
119
120
|
# Cache size may be set through {RDF.config} using `uri_cache_size`.
|
data/lib/rdf/ntriples/reader.rb
CHANGED
@@ -255,7 +255,7 @@ module RDF::NTriples
|
|
255
255
|
if !match(ST_END)
|
256
256
|
log_error("Expected end of statement (found: #{current_line.inspect})", lineno: lineno, exception: RDF::ReaderError)
|
257
257
|
end
|
258
|
-
RDF::Statement.new(subject, predicate, object)
|
258
|
+
RDF::Statement.new(subject, predicate, object, quoted: true)
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|