Coverage report: /development/source/library/org/datagraph/spocq-shard/src/algebra/matrix-operators/group.lisp

KindCoveredAll%
expression020 0.0
branch04 0.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: org.datagraph.spocq.implementation; -*-
2
 
3
 (in-package :org.datagraph.spocq.implementation)
4
 
5
 (:documentation "This file defines the matrix GROUP operator for the 'org.datagraph.spocq' RDF engine."
6
 
7
  (copyright
8
   "Copyright 2013 [james anderson](mailto:james.anderson@setf.de) All Rights Reserved.")
9
 
10
  (:long-description
11
   "The group operator is implemented in as the first phase to an aggregation:
12
  the field is extended with the values upon which the groups are to be recognized in the aggregation phase,
13
  the extended field is left unsorted, but the result field is provided the key dimensions to construct
14
  the groups on-the-fky.
15
 
16
  the result field serves the source to a subsequent aggregation operation.
17
  that is something like
18
 
19
     select ?s where {?s ?p ?o} group by ?s
20
 
21
  does not become a group as the project operator create a simple sort for that"))
22
 
23
 (defmethod spocq.e:group ((source-field matrix-field) bindings &rest arguments &key start end)
24
   "Given SOURCE-FIELD, a matrix-field, KEY-BINDINGS, an a-list of variable names and value expressions
25
    which serve as the group criteria, and START,END
26
    slice constraints, generate a result field which is extended for any computed keys,to be used to aggregate.
27
    no order is done, as the aggregation happend on the fly.
28
    VALUES : matrix-field : the extended solution field"
29
 
30
   (if (remove-if #'symbolp bindings)
31
     (let ((extend-bindings (remove-if #'variable-p bindings)))
32
       (apply #'spocq.e:extend source-field extend-bindings arguments))
33
     (if (remove-if-not #'symbolp bindings)
34
       (apply #'spocq.e:order source-field arguments)
35
       (if arguments
36
         (apply #'spocq.e:slice source-field arguments)
37
         source-field))))
38