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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4482866c0eb2c223af0f3a88f1eba8e1e2126c238c1136ff992a795de5047699
4
- data.tar.gz: 38e58d5e2bab26f76b55affe2cb362aff85afb49c7692056837b69d34cad6081
3
+ metadata.gz: fac2b932398cb302e6b2ecf300e6508879ed43314c52822d7a7ae9482127ea05
4
+ data.tar.gz: 6f78f54676b45f1bfd4767b30b545ec3016de440fcb8d5803ead213eed0e799d
5
5
  SHA512:
6
- metadata.gz: 464c0043d3238fc3c4b077dfe6144a145b2c636b0e7de53ea6e8ce7ea96d2fd196b88053b1974d939650295416a2e4f07d298009d06d3a0320c297caf7883309
7
- data.tar.gz: 0b27d632fe51c621bd50c27c2b7ecf5da91cd615e4e39ddf82e9f65517bddadcba4adb387a33807f8f2f0851b3a1d3c0429ccf41f4ec1610371c57fe28bd0709
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.com/rdf>
6
+ * <https://ruby-rdf.github.io/rdf>
7
7
 
8
8
  [![Gem Version](https://badge.fury.io/rb/rdf.png)](https://badge.fury.io/rb/rdf)
9
9
  [![Build Status](https://github.com/ruby-rdf/rdf/workflows/CI/badge.svg?branch=develop)](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.com/rdf/etc/doap.nt")
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.com/rdf/etc/doap.nt") do |reader|
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.com/rdf/etc/doap.nq", format: :nquads)
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.com/rdf/etc/doap.nq") do |reader|
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.com/rdf/etc/doap.nt")
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://rubydoc.info/github/ruby-rdf/rdf>
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://rubydoc.info/github/gkellogg/rdf-xsd) (extension)
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://rubydoc.info/github/ruby-rdf/rdf-agraph) (extension)
375
- * [RDF::Mongo](https://rubydoc.info/github/ruby-rdf/rdf-mongo) (extension)
376
- * [RDF::DataObjects](https://rubydoc.info/github/ruby-rdf/rdf-do) (extension)
377
- * [RDF::Sesame](https://rubydoc.info/github/ruby-rdf/rdf-sesame) (extension)
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://rubydoc.info/github/ruby-rdf/sparql) (extension)
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://rubydoc.info/github/ruby-rdf/rdf>
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://rubydoc.info/github/ruby-rdf/json-ld
490
- [LinkedData doc]: https://rubydoc.info/github/ruby-rdf/linkeddata
491
- [Microdata doc]: https://rubydoc.info/github/ruby-rdf/rdf-microdata
492
- [N3 doc]: https://rubydoc.info/github/ruby-rdf/rdf-n3
493
- [RDFa doc]: https://rubydoc.info/github/ruby-rdf/rdf-rdfa
494
- [RDFXML doc]: https://rubydoc.info/github/ruby-rdf/rdf-rdfxml
495
- [Turtle doc]: https://rubydoc.info/github/ruby-rdf/rdf-turtle
496
- [SPARQL doc]: https://rubydoc.info/github/ruby-rdf/sparql
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.com/
501
- [RDF::DO]: https://ruby-rdf.github.com/rdf-do
502
- [RDF::Mongo]: https://ruby-rdf.github.com/rdf-mongo
503
- [RDF::Sesame]: https://ruby-rdf.github.com/rdf-sesame
504
- [RDF::JSON]: https://ruby-rdf.github.com/rdf-json
505
- [RDF::Microdata]: https://ruby-rdf.github.com/rdf-microdata
506
- [RDF::N3]: https://ruby-rdf.github.com/rdf-n3
507
- [RDF::RDFa]: https://ruby-rdf.github.com/rdf-rdfa
508
- [RDF::RDFXML]: https://ruby-rdf.github.com/rdf-rdfxml
509
- [RDF::TriG]: https://ruby-rdf.github.com/rdf-trig
510
- [RDF::TriX]: https://ruby-rdf.github.com/rdf-trix
511
- [RDF::Turtle]: https://ruby-rdf.github.com/rdf-turtle
512
- [RDF::Raptor]: https://ruby-rdf.github.com/rdf-raptor
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.com/linkeddata
515
- [JSON::LD]: https://ruby-rdf.github.com/json-ld
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.3
1
+ 3.2.4
@@ -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
  #
@@ -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
  #
@@ -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
  #
@@ -476,7 +476,7 @@ module RDF
476
476
  # @return [Integer]
477
477
  # @see http://ruby-doc.org/core-2.2.2/Array.html#method-i-3C-3D-3E
478
478
  def eql?(other)
479
- to_a.eql? other.to_a # TODO: optimize this
479
+ to_a.eql? Array(other)
480
480
  end
481
481
 
482
482
  ##
@@ -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
- false
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
- PN_ESCAPE_CHARS = /[~\.\-!\$&'\(\)\*\+,;=\/\?\#@%_]/.freeze
116
- PN_ESCAPES = /\\#{PN_ESCAPE_CHARS}/.freeze
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`.
@@ -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
 
OSZAR »