rdf 2.0.1 → 2.0.2
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/VERSION +1 -1
- data/lib/rdf/model/list.rb +9 -2
- data/lib/rdf/model/statement.rb +42 -3
- data/lib/rdf/model/uri.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9264fbe27f459f9604dbcb9c4c51cb337699186f
|
4
|
+
data.tar.gz: 0dd6fc0bc4406fe10b947cd2b784ca00d24a01f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bcb3e1123ee603fd659cbaccf429ccceded50e109eed283e56b6bab09b3b776b3727cf5c354df0ce9bf0df3e54e2f8ad2c304399eacc9236f763d08b097c38c
|
7
|
+
data.tar.gz: 468bdca03374b09c08a20de648955c2eb3fa6309c7a98e5aaf698230902b58b6989b5813afdb8152f975f4a42cce329b0ef1fddaa5b0d553810aea69682006c3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.2
|
data/lib/rdf/model/list.rb
CHANGED
@@ -139,6 +139,13 @@ module RDF
|
|
139
139
|
# @return [RDF::Graph] the underlying graph storing the statements that constitute this list
|
140
140
|
attr_reader :graph
|
141
141
|
|
142
|
+
##
|
143
|
+
# @see RDF::Value#==
|
144
|
+
def ==(other)
|
145
|
+
return false if other.is_a?(RDF::Value) && !other.list?
|
146
|
+
super
|
147
|
+
end
|
148
|
+
|
142
149
|
##
|
143
150
|
# Returns the set intersection of this list and `other`.
|
144
151
|
#
|
@@ -272,7 +279,7 @@ module RDF
|
|
272
279
|
# a[3, 0] = "B" #=> [1, 2, "A", "B"]
|
273
280
|
#
|
274
281
|
# @overload []=(index, term)
|
275
|
-
# Replaces the element at `index` with `term`.
|
282
|
+
# Replaces the element at `index` with `term`.
|
276
283
|
# @param [Integer] index
|
277
284
|
# @param [RDF::Term] term
|
278
285
|
# A non-RDF::Term is coerced to a Literal.
|
@@ -445,7 +452,7 @@ module RDF
|
|
445
452
|
# @return [Integer]
|
446
453
|
# @see http://ruby-doc.org/core-2.2.2/Array.html#method-i-3C-3D-3E
|
447
454
|
def <=>(other)
|
448
|
-
to_a <=> other
|
455
|
+
to_a <=> Array(other)
|
449
456
|
end
|
450
457
|
|
451
458
|
##
|
data/lib/rdf/model/statement.rb
CHANGED
@@ -135,7 +135,7 @@ module RDF
|
|
135
135
|
#
|
136
136
|
# @return [Boolean]
|
137
137
|
def variable?
|
138
|
-
!(has_subject? && subject.resource? &&
|
138
|
+
!(has_subject? && subject.resource? &&
|
139
139
|
has_predicate? && predicate.resource? &&
|
140
140
|
has_object? && (object.resource? || object.literal?) &&
|
141
141
|
(has_graph? ? graph_name.resource? : true ))
|
@@ -150,7 +150,7 @@ module RDF
|
|
150
150
|
##
|
151
151
|
# @return [Boolean]
|
152
152
|
def valid?
|
153
|
-
has_subject? && subject.resource? && subject.valid? &&
|
153
|
+
has_subject? && subject.resource? && subject.valid? &&
|
154
154
|
has_predicate? && predicate.uri? && predicate.valid? &&
|
155
155
|
has_object? && object.term? && object.valid? &&
|
156
156
|
(has_graph? ? graph_name.resource? && graph_name.valid? : true )
|
@@ -228,22 +228,61 @@ module RDF
|
|
228
228
|
alias_method :has_blank_nodes?, :node?
|
229
229
|
|
230
230
|
##
|
231
|
+
# Checks statement equality as a quad.
|
232
|
+
#
|
231
233
|
# @param [Statement] other
|
232
234
|
# @return [Boolean]
|
235
|
+
#
|
236
|
+
# @see RDF::URI#==
|
237
|
+
# @see RDF::Node#==
|
238
|
+
# @see RDF::Literal#==
|
239
|
+
# @see RDF::Query::Variable#==
|
233
240
|
def eql?(other)
|
234
241
|
other.is_a?(Statement) && self == other && (self.graph_name || false) == (other.graph_name || false)
|
235
242
|
end
|
236
243
|
|
237
244
|
##
|
245
|
+
# Checks statement equality as a triple.
|
246
|
+
#
|
238
247
|
# @param [Object] other
|
239
248
|
# @return [Boolean]
|
249
|
+
#
|
250
|
+
# @see RDF::URI#==
|
251
|
+
# @see RDF::Node#==
|
252
|
+
# @see RDF::Literal#==
|
253
|
+
# @see RDF::Query::Variable#==
|
240
254
|
def ==(other)
|
241
|
-
to_a == Array(other)
|
255
|
+
to_a == Array(other) &&
|
256
|
+
!(other.is_a?(RDF::Value) && other.list?)
|
242
257
|
end
|
243
258
|
|
244
259
|
##
|
260
|
+
# Checks statement equality with patterns.
|
261
|
+
#
|
262
|
+
# Uses `#eql?` to compare each of `#subject`, `#predicate`, `#object`, and
|
263
|
+
# `#graph_name` to those of `other`. Any statement part which is not
|
264
|
+
# present in `self` is ignored.
|
265
|
+
#
|
266
|
+
# @example
|
267
|
+
# statement = RDF::Statement.new(RDF::URI('s'), RDF::URI('p'), RDF::URI('o'))
|
268
|
+
# pattern = RDF::Statement.new(RDF::URI('s'), RDF::URI('p'), RDF::Query::Variable.new)
|
269
|
+
#
|
270
|
+
# # true
|
271
|
+
# statement === statement
|
272
|
+
# pattern === statement
|
273
|
+
# RDF::Statement.new(nil, nil, nil) === statement
|
274
|
+
#
|
275
|
+
# # false
|
276
|
+
# statement === pattern
|
277
|
+
# statement === RDF::Statement.new(nil, nil, nil)
|
278
|
+
#
|
245
279
|
# @param [Statement] other
|
246
280
|
# @return [Boolean]
|
281
|
+
#
|
282
|
+
# @see RDF::URI#eql?
|
283
|
+
# @see RDF::Node#eql?
|
284
|
+
# @see RDF::Literal#eql?
|
285
|
+
# @see RDF::Query::Variable#eql?
|
247
286
|
def ===(other)
|
248
287
|
return false if has_object? && !object.eql?(other.object)
|
249
288
|
return false if has_predicate? && !predicate.eql?(other.predicate)
|
data/lib/rdf/model/uri.rb
CHANGED
@@ -377,7 +377,7 @@ module RDF
|
|
377
377
|
@object = {
|
378
378
|
scheme: normalized_scheme,
|
379
379
|
authority: normalized_authority,
|
380
|
-
path: normalized_path.
|
380
|
+
path: normalized_path.squeeze('/'),
|
381
381
|
query: normalized_query,
|
382
382
|
fragment: normalized_fragment
|
383
383
|
}
|
@@ -887,7 +887,7 @@ module RDF
|
|
887
887
|
# Return normalized version of scheme, if any
|
888
888
|
# @return [String]
|
889
889
|
def normalized_scheme
|
890
|
-
scheme.strip
|
890
|
+
normalize_segment(scheme.strip, SCHEME, true) if scheme
|
891
891
|
end
|
892
892
|
|
893
893
|
##
|
@@ -965,7 +965,7 @@ module RDF
|
|
965
965
|
# @return [String]
|
966
966
|
def normalized_host
|
967
967
|
# Remove trailing '.' characters
|
968
|
-
normalize_segment(host, IHOST, true).
|
968
|
+
normalize_segment(host, IHOST, true).chomp('.') if host
|
969
969
|
end
|
970
970
|
|
971
971
|
##
|
@@ -1059,7 +1059,7 @@ module RDF
|
|
1059
1059
|
|
1060
1060
|
res = self.class.normalize_path(norm_segs.join("/"))
|
1061
1061
|
# Special rules for specific protocols having empty paths
|
1062
|
-
res.empty? ? (%w(http https ftp tftp).include?(normalized_scheme) ? '/' : "") : res
|
1062
|
+
normalize_segment(res.empty? ? (%w(http https ftp tftp).include?(normalized_scheme) ? '/' : "") : res, IHIER_PART)
|
1063
1063
|
end
|
1064
1064
|
|
1065
1065
|
##
|
@@ -1134,9 +1134,9 @@ module RDF
|
|
1134
1134
|
# @return [String]
|
1135
1135
|
def normalized_authority
|
1136
1136
|
if authority
|
1137
|
-
(userinfo ? "
|
1137
|
+
(userinfo ? normalized_userinfo.to_s + "@" : "") +
|
1138
1138
|
normalized_host.to_s +
|
1139
|
-
(normalized_port ? "
|
1139
|
+
(normalized_port ? ":" + normalized_port.to_s : "")
|
1140
1140
|
end
|
1141
1141
|
end
|
1142
1142
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: link_header
|