sparql 2.0.0.beta1 → 2.0.0.beta2

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: e0f0674def56366f986d2d91cf7777c16552d64b
4
- data.tar.gz: 2ccb0b9d631516cc71c0482d074bb65945af1ad6
3
+ metadata.gz: 82e194c49c69133eb481e0402d00491cc069f9a7
4
+ data.tar.gz: 97d91d9ec9a9c239af05db0d3703c848e876fcac
5
5
  SHA512:
6
- metadata.gz: 4be041a007b6fd78818f5c9188744f081f3d1c321aed9e49629e48760d6b9531c01918fa690f3580fd7fac0c8d32f82e9dd870f8e45f3a0e775273fe971a49fe
7
- data.tar.gz: e1dba08317fec9abe5051428628613c6a8761e7f4f6c6889b17eeab821c2a9b868d3567914a1a598517a443eddfbb118552c8a72e84d8bf8a1f7d9bd2986ef70
6
+ metadata.gz: 22821faf2d2545126f0c29f23b0a0395ddc1d183eefaf5adb5ef630357ed2e861097b0e643335254673989955352abe526bc87580ecc66cefc94ad8d9cb1485b
7
+ data.tar.gz: 44ac7ac772aa4b90047275079d85f93520d14b6216471cf8f358f7b9759cd9ad6163cc8eea747fba56365abfceae723a35319015129e727301f299fddd638a48
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta1
1
+ 2.0.0.beta2
@@ -15,6 +15,8 @@ module SPARQL; module Algebra
15
15
  # Aggregates this operator accross its operands using
16
16
  # a solutions enumerable.
17
17
  #
18
+ # The first operand may be :distinct, in which case the result of applying the rest of the operands is uniqued before applying the expression.
19
+ #
18
20
  # @param [Enumerable<RDF::Query::Solution>] solutions ([])
19
21
  # an enumerable set of query solutions
20
22
  # @param [Hash{Symbol => Object}] options ({})
@@ -23,6 +25,7 @@ module SPARQL; module Algebra
23
25
  # @raise [TypeError]
24
26
  # @abstract
25
27
  def aggregate(solutions = [], options = {})
28
+ operands.shift if distinct = (operands.first == :distinct)
26
29
  args_enum = solutions.map do |solution|
27
30
  operands.map do |operand|
28
31
  begin
@@ -33,7 +36,7 @@ module SPARQL; module Algebra
33
36
  end
34
37
  end.compact
35
38
  end
36
- apply(args_enum)
39
+ apply(distinct ? args_enum.uniq : args_enum)
37
40
  end
38
41
 
39
42
  ##
@@ -18,8 +18,9 @@ module SPARQL; module Algebra
18
18
  include Aggregate
19
19
 
20
20
  NAME = :group_concat
21
+
21
22
  ##
22
- # One or two operands, the second operand, if it exists, is a separator, defaulting to ' '.
23
+ # One, two or three operands, the first may be `distinct`, the last operand, if it exists, is a separator, defaulting to ' '.
23
24
  #
24
25
  # @param [Enumerable<RDF::Query::Solution>] solutions ([])
25
26
  # an enumerable set of query solutions
@@ -29,6 +30,7 @@ module SPARQL; module Algebra
29
30
  # @raise [TypeError]
30
31
  # @abstract
31
32
  def aggregate(solutions = [], options = {})
33
+ operands.shift if distinct = (operands.first == :distinct)
32
34
  sep = operands.length == 2 ? operand(0).last : RDF::Literal(' ')
33
35
  args_enum = solutions.map do |solution|
34
36
  begin
@@ -38,10 +40,9 @@ module SPARQL; module Algebra
38
40
  nil
39
41
  end
40
42
  end
41
- apply(args_enum, sep)
43
+ apply(distinct ? args_enum.uniq : args_enum, sep)
42
44
  end
43
45
 
44
-
45
46
  ##
46
47
  # GroupConcat is a set function which performs a string concatenation across the values of an expression with a group. The order of the strings is not specified. The separator character used in the concatenation may be given with the scalar argument SEPARATOR.
47
48
  #
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.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-22 00:00:00.000000000 Z
12
+ date: 2016-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf