rdf 3.2.4 → 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,6 +77,7 @@ module RDF
77
77
  require 'rdf/model/literal/decimal'
78
78
  require 'rdf/model/literal/integer'
79
79
  require 'rdf/model/literal/double'
80
+ require 'rdf/model/literal/temporal'
80
81
  require 'rdf/model/literal/date'
81
82
  require 'rdf/model/literal/datetime'
82
83
  require 'rdf/model/literal/time'
@@ -295,7 +296,7 @@ module RDF
295
296
  when self.simple? && other.simple?
296
297
  self.value_hash == other.value_hash && self.value == other.value
297
298
  when other.comperable_datatype?(self) || self.comperable_datatype?(other)
298
- # Comoparing plain with undefined datatypes does not generate an error, but returns false
299
+ # Comparing plain with undefined datatypes does not generate an error, but returns false
299
300
  # From data-r2/expr-equal/eq-2-2.
300
301
  false
301
302
  else
data/lib/rdf/model/uri.rb CHANGED
@@ -76,6 +76,7 @@ module RDF
76
76
  IRI = Regexp.compile("^#{SCHEME}:(?:#{IHIER_PART})(?:\\?#{IQUERY})?(?:\\##{IFRAGMENT})?$").freeze
77
77
 
78
78
  # Split an IRI into it's component parts
79
+ # scheme, authority, path, query, fragment
79
80
  IRI_PARTS = /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(\?[^#]*)?(#.*)?$/.freeze
80
81
 
81
82
  # Remove dot expressions regular expressions
@@ -872,6 +873,12 @@ module RDF
872
873
  parts = {}
873
874
  if matchdata = IRI_PARTS.match(value)
874
875
  scheme, authority, path, query, fragment = matchdata[1..-1]
876
+
877
+ if Gem.win_platform? && scheme && !authority && scheme.match?(/^[a-zA-Z]$/)
878
+ # A drive letter, not a scheme
879
+ scheme, path = nil, "#{scheme}:#{path}"
880
+ end
881
+
875
882
  userinfo, hostport = authority.to_s.split('@', 2)
876
883
  hostport, userinfo = userinfo, nil unless hostport
877
884
  user, password = userinfo.to_s.split(':', 2)
data/lib/rdf/nquads.rb CHANGED
@@ -20,7 +20,10 @@ module RDF
20
20
  # @see http://www.w3.org/TR/n-quads/
21
21
  # @since 0.4.0
22
22
  class Format < RDF::Format
23
- content_type 'application/n-quads', extension: :nq, alias: 'text/x-nquads;q=0.2'
23
+ content_type 'application/n-quads',
24
+ extension: :nq,
25
+ alias: 'text/x-nquads;q=0.2',
26
+ uri: RDF::URI("http://www.w3.org/ns/formats/N-Quads")
24
27
  content_encoding 'utf-8'
25
28
 
26
29
  reader { RDF::NQuads::Reader }
@@ -16,7 +16,10 @@ module RDF::NTriples
16
16
  # @see http://www.w3.org/TR/rdf-testcases/#ntriples
17
17
  # @see http://www.w3.org/TR/n-triples/
18
18
  class Format < RDF::Format
19
- content_type 'application/n-triples', extension: :nt, alias: 'text/plain;q=0.2'
19
+ content_type 'application/n-triples',
20
+ extension: :nt,
21
+ alias: 'text/plain;q=0.2',
22
+ uri: RDF::URI("http://www.w3.org/ns/formats/N-Triples")
20
23
  content_encoding 'utf-8'
21
24
 
22
25
  reader { RDF::NTriples::Reader }
@@ -317,13 +317,12 @@ class RDF::Query
317
317
  def hash
318
318
  @bindings.hash
319
319
  end
320
-
320
+
321
321
  ##
322
322
  # Equivalence of solution
323
323
  def eql?(other)
324
324
  other.is_a?(Solution) && @bindings.eql?(other.bindings)
325
325
  end
326
- alias_method :==, :eql?
327
326
 
328
327
  ##
329
328
  # Equals of solution
@@ -77,6 +77,15 @@ module RDF; class Query
77
77
  end
78
78
  end
79
79
 
80
+ ##
81
+ # Sets variable names used in these solutions. If not set, the default is determined by the variables used in each solution.
82
+ #
83
+ # @param [Array<Symbol, RDF::Query::Variable>] vars
84
+ # @return [Array<Symbol>]
85
+ def variable_names=(vars)
86
+ @variable_names = vars.map(&:to_sym)
87
+ end
88
+
80
89
  ##
81
90
  # @overload variable?
82
91
  # Returns `false`.
@@ -294,5 +303,17 @@ module RDF; class Query
294
303
  self
295
304
  end
296
305
  alias_method :limit!, :limit
306
+
307
+ ##
308
+ # Equivalence of solution
309
+ def eql?(other)
310
+ super && (!other.respond_to?(:variable_names) || variable_names.eql?(other.variable_names))
311
+ end
312
+
313
+ ##
314
+ # Equals of solution
315
+ def ==(other)
316
+ super && (!other.respond_to?(:variable_names) || variable_names.eql?(other.variable_names))
317
+ end
297
318
  end # Solutions
298
319
  end; end # RDF::Query