sparql 2.2.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5dacac58b3db16753e3ed0365462b605a4909dd
4
- data.tar.gz: 45acd0a253aeb302237303bc1a6d9c72830ea237
3
+ metadata.gz: 0bff4a7c42287bdfe66a68fe8b9749ba03a28c79
4
+ data.tar.gz: 1922e7c06a6387ec9dd8b4797fb262f8d8b2b70d
5
5
  SHA512:
6
- metadata.gz: 3343521fb78230e10d214f0665d74873494ae9ce5e55ce575034c2f57a4e11e8503fed433cfd32d1b4afdad9907527cac8470b226b070681419f53eb3cb7640b
7
- data.tar.gz: fb3605b0d8c28a9915f9f6d72f70b1e630674c011f4e5a7932e43c37b061aaadd4768081e994c1055af4077aca8ae78c2b250dbf4176d7493da28bd91ae2c061
6
+ metadata.gz: 12f7636ac3e765bebe48ffff2de8255bdc8465279576a4a7ceeea7c196412ee0410b115418646bcc329b9a187e204469438b2d0f01676d0c7e9332bae9797b9c
7
+ data.tar.gz: 0f7cba620c3a2548d1e7645b25713f1071135290f34ba583a2c70054700a9e0c1b5ea7d0176d3fc049f0e7dfc2c0e334108893fd2d491f5354c01a03821408d8
data/README.md CHANGED
@@ -257,19 +257,19 @@ Full documentation available on [Rubydoc.info][SPARQL doc]
257
257
 
258
258
  ## Dependencies
259
259
 
260
- * [Ruby](http://ruby-lang.org/) (>= 1.9.3)
261
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 1.1.12)
262
- * [SPARQL::Client](https://rubygems.org/gems/sparql-client) (>= 1.1.3)
263
- * [SXP](https://rubygems.org/gems/sxp) (>= 0.1.3)
260
+ * [Ruby](http://ruby-lang.org/) (>= 2.2.2)
261
+ * [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.0)
262
+ * [SPARQL::Client](https://rubygems.org/gems/sparql-client) (~> 3.0)
263
+ * [SXP](https://rubygems.org/gems/sxp) (~> 1.0)
264
264
  * [Builder](https://rubygems.org/gems/builder) (>= 3.0.0)
265
265
  * [JSON](https://rubygems.org/gems/json) (>= 1.8.2)
266
- * Soft dependency on [Linked Data][] (>= 1.1)
267
- * Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.6.6)
266
+ * Soft dependency on [Linked Data][] (>= 3.0)
267
+ * Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.7)
268
268
  Falls back to REXML for XML parsing Builder for XML serializing. Nokogiri is much more efficient
269
269
  * Soft dependency on [Equivalent XML](https://rubygems.org/gems/equivalent-xml) (>= 0.3.0)
270
270
  Equivalent XML performs more efficient comparisons of XML Literals when Nokogiri is included
271
- * Soft dependency on [Rack][] (>= 1.6.0)
272
- * Soft dependency on [Sinatra][] (>= 1.4.6)
271
+ * Soft dependency on [Rack][] (>= 2.0)
272
+ * Soft dependency on [Sinatra][] (>= 2.0)
273
273
 
274
274
  ## Installation
275
275
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.2
1
+ 3.0.0
@@ -325,18 +325,25 @@ class RDF::Query
325
325
  end
326
326
 
327
327
  ##
328
- # Return the non-destinguished variables contained within patterns
328
+ # Return the non-destinguished variables contained within patterns and graph name
329
329
  # @return [Array<RDF::Query::Variable>]
330
330
  def ndvars
331
- patterns.map(&:ndvars).flatten
331
+ vars.reject(&:distinguished?)
332
332
  end
333
333
 
334
334
  ##
335
- # Return the variables contained within patterns
335
+ # Return the variables contained within patterns and graph name
336
336
  # @return [Array<RDF::Query::Variable>]
337
337
  def vars
338
- patterns.map(&:vars).flatten
338
+ variables.values
339
339
  end
340
+
341
+ ##
342
+ # Returns `true` if this is executable (i.e., contains a graph patterns), `false`
343
+ # otherwise.
344
+ #
345
+ # @return [Boolean] `true` or `false`
346
+ def executable?; true; end
340
347
  end
341
348
 
342
349
  class RDF::Query::Pattern
@@ -22,7 +22,7 @@ module SPARQL; module Algebra
22
22
  #
23
23
  # @return [Hash{Symbol => RDF::Query::Variable}]
24
24
  def variables
25
- operands.inject({}) {|hash, o| o.executable? ? hash.merge!(o.variables) : hash}
25
+ operands.inject({}) {|hash, o| o.executable? ? hash.merge(o.variables) : hash}
26
26
  end
27
27
 
28
28
  ##
@@ -22,7 +22,7 @@ module SPARQL; module Algebra
22
22
  #
23
23
  # @return [Hash{Symbol => RDF::Query::Variable}]
24
24
  def variables
25
- operands.inject({}) {|hash, o| o.executable? ? hash.merge!(o.variables) : hash}
25
+ operands.inject({}) {|hash, o| o.executable? ? hash.merge(o.variables) : hash}
26
26
  end
27
27
 
28
28
  ##
@@ -586,12 +586,20 @@ module SPARQL::Grammar
586
586
  production(:GroupGraphPatternSub) do |input, data, callback|
587
587
  debug("GroupGraphPatternSub") {"q #{data[:query].inspect}"}
588
588
 
589
- res = data[:query].first
589
+ res = case data[:query].length
590
+ when 0 then SPARQL::Algebra::Operator::BGP.new
591
+ when 1 then data[:query].first
592
+ when 2
593
+ SPARQL::Algebra::Operator::Join.new(*data[:query])
594
+ else
595
+ error(nil, "Expected 0-2 queryies, got #{data[:query].length}", production: :GroupGraphPatternSub)
596
+ SPARQL::Algebra::Operator::BGP.new
597
+ end
590
598
  debug("GroupGraphPatternSub(pre-filter)") {"res: #{res.inspect}"}
591
599
 
592
600
  if data[:filter]
593
601
  expr, query = flatten_filter(data[:filter])
594
- query = res || SPARQL::Algebra::Operator::BGP.new
602
+ query = res
595
603
  # query should be nil
596
604
  res = SPARQL::Algebra::Operator::Filter.new(expr, query)
597
605
  end
@@ -647,6 +655,11 @@ module SPARQL::Grammar
647
655
  lhs.operands.first.concat(data[:extend])
648
656
  add_prod_datum(:query, lhs)
649
657
  elsif data[:extend]
658
+ # The variable assigned in a BIND clause must not be already in-use within the immediately preceding TriplesBlock within a GroupGraphPattern.
659
+ # None of the variables on the lhs of data[:extend] may be used in lhs
660
+ data[:extend].each do |(v, _)|
661
+ error(nil, "BIND Variable #{v} used in pattern", production: :GraphPatternNotTriples) if lhs.vars.map(&:to_sym).include?(v.to_sym)
662
+ end
650
663
  add_prod_datum(:query, SPARQL::Algebra::Expression.for(:extend, data[:extend], lhs))
651
664
  elsif data[:leftjoin]
652
665
  add_prod_datum(:query, SPARQL::Algebra::Expression.for(:leftjoin, lhs, *data[:leftjoin]))
@@ -1831,14 +1844,14 @@ module SPARQL::Grammar
1831
1844
 
1832
1845
  # extension variables must not appear in projected variables.
1833
1846
  # Add them to the projection otherwise
1834
- extensions.each do |(var, expr)|
1847
+ extensions.each do |(var, _)|
1835
1848
  raise Error, "Extension variable #{var} also in SELECT" if vars.map(&:to_s).include?(var.to_s)
1836
1849
  vars << var
1837
1850
  end
1838
1851
 
1839
1852
  # If any extension contains an aggregate, and there is now group, implicitly group by 1
1840
1853
  if !data[:group] &&
1841
- extensions.any? {|(var, function)| function.aggregate?} ||
1854
+ extensions.any? {|(_, function)| function.aggregate?} ||
1842
1855
  having.any? {|c| c.aggregate? }
1843
1856
  debug {"Implicit group"}
1844
1857
  data[:group] = [[]]
@@ -1868,7 +1881,7 @@ module SPARQL::Grammar
1868
1881
 
1869
1882
  # Replace aggregates in expr as above
1870
1883
  expr.replace_aggregate! do |function|
1871
- if avf = aggregates.detect {|(v, f)| f == function}
1884
+ if avf = aggregates.detect {|(_, f)| f == function}
1872
1885
  avf.first
1873
1886
  else
1874
1887
  # Allocate a temporary variable for this function, and retain the mapping for outside the group
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
@@ -9,28 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-13 00:00:00.000000000 Z
12
+ date: 2017-12-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '2.2'
21
- - - "<"
18
+ - - "~>"
22
19
  - !ruby/object:Gem::Version
23
- version: '4.0'
20
+ version: '3.0'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: '2.2'
31
- - - "<"
25
+ - - "~>"
32
26
  - !ruby/object:Gem::Version
33
- version: '4.0'
27
+ version: '3.0'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: rdf-aggregate-repo
36
30
  requirement: !ruby/object:Gem::Requirement
@@ -97,42 +91,30 @@ dependencies:
97
91
  name: sparql-client
98
92
  requirement: !ruby/object:Gem::Requirement
99
93
  requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '2.1'
103
- - - "<"
94
+ - - "~>"
104
95
  - !ruby/object:Gem::Version
105
- version: '4.0'
96
+ version: '3.0'
106
97
  type: :runtime
107
98
  prerelease: false
108
99
  version_requirements: !ruby/object:Gem::Requirement
109
100
  requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: '2.1'
113
- - - "<"
101
+ - - "~>"
114
102
  - !ruby/object:Gem::Version
115
- version: '4.0'
103
+ version: '3.0'
116
104
  - !ruby/object:Gem::Dependency
117
105
  name: rdf-xsd
118
106
  requirement: !ruby/object:Gem::Requirement
119
107
  requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: '2.2'
123
- - - "<"
108
+ - - "~>"
124
109
  - !ruby/object:Gem::Version
125
- version: '4.0'
110
+ version: '3.0'
126
111
  type: :runtime
127
112
  prerelease: false
128
113
  version_requirements: !ruby/object:Gem::Requirement
129
114
  requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '2.2'
133
- - - "<"
115
+ - - "~>"
134
116
  - !ruby/object:Gem::Version
135
- version: '4.0'
117
+ version: '3.0'
136
118
  - !ruby/object:Gem::Dependency
137
119
  name: sinatra
138
120
  requirement: !ruby/object:Gem::Requirement
@@ -167,36 +149,30 @@ dependencies:
167
149
  requirements:
168
150
  - - "~>"
169
151
  - !ruby/object:Gem::Version
170
- version: '0.7'
152
+ version: '0.8'
171
153
  type: :development
172
154
  prerelease: false
173
155
  version_requirements: !ruby/object:Gem::Requirement
174
156
  requirements:
175
157
  - - "~>"
176
158
  - !ruby/object:Gem::Version
177
- version: '0.7'
159
+ version: '0.8'
178
160
  - !ruby/object:Gem::Dependency
179
- name: linkeddata
161
+ name: rdf-spec
180
162
  requirement: !ruby/object:Gem::Requirement
181
163
  requirements:
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- version: '2.2'
185
- - - "<"
164
+ - - "~>"
186
165
  - !ruby/object:Gem::Version
187
- version: '4.0'
166
+ version: '3.0'
188
167
  type: :development
189
168
  prerelease: false
190
169
  version_requirements: !ruby/object:Gem::Requirement
191
170
  requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '2.2'
195
- - - "<"
171
+ - - "~>"
196
172
  - !ruby/object:Gem::Version
197
- version: '4.0'
173
+ version: '3.0'
198
174
  - !ruby/object:Gem::Dependency
199
- name: rdf-spec
175
+ name: linkeddata
200
176
  requirement: !ruby/object:Gem::Requirement
201
177
  requirements:
202
178
  - - ">="
@@ -269,14 +245,14 @@ dependencies:
269
245
  requirements:
270
246
  - - "~>"
271
247
  - !ruby/object:Gem::Version
272
- version: '0.9'
248
+ version: 0.9.12
273
249
  type: :development
274
250
  prerelease: false
275
251
  version_requirements: !ruby/object:Gem::Requirement
276
252
  requirements:
277
253
  - - "~>"
278
254
  - !ruby/object:Gem::Version
279
- version: '0.9'
255
+ version: 0.9.12
280
256
  description: |2-
281
257
 
282
258
  Implements SPARQL grammar parsing to SPARQL Algebra, SPARQL Algebra processing