Coverage report: /development/source/library/org/datagraph/spocq-shard/src/algebra/matrix-operators/project.lisp
| Kind | Covered | All | % |
| expression | 0 | 49 | 0.0 |
| branch | 0 | 10 | 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; -*-
3
(in-package :org.datagraph.spocq.implementation)
5
(:documentation "sparql project operation for matrix fields")
7
;;; (load (compile-file "/development/source/library/org/datagraph/spocq/src/algebra/matrix-operators/project.lisp"))
10
(defmethod spocq.e:project ((source-field matrix-field) bindings &rest arguments &key start end)
11
"Generate a projected field to a result given a source, bindings and slice (start, end) specifications.
12
This serves not only an explict projection for a select form, but also the projection
13
from an explicit extend for aggregation and sorting.
14
The sort order is reduced to reflect the projected dimensions."
15
(declare (dynamic-extent arguments))
16
(let* ((base-dimensions (matrix-field-dimensions source-field))
17
(length (- (or end (field-length source-field)) (or start 0)))
18
(result-dimensions (loop for binding in bindings
19
collect (if (consp binding) (first binding) binding)))
20
(width (length result-dimensions))
21
(%data (rdfcache:make-matrix length width))
22
(result-field (clone-matrix-field source-field :data %data
23
:dimensions result-dimensions
24
:sort-dimensions (loop for dimension in (matrix-field-sort-dimensions source-field)
25
when (find dimension result-dimensions)
27
(operator (apply #'matrix-extend-operator result-dimensions base-dimensions
28
(loop for binding in bindings
32
(apply operator result-field source-field
37
(defmethod process-project ((result-field matrix-page-channel)
38
(source-field matrix-page-channel)
39
result-bindings base-dimensions
42
"Process a projection by converting it to an extension, possibly to fewer
43
dimesions, but with the computed values"
44
(declare (list base-dimensions result-bindings)
46
(assert-argument-types process-slice
47
(base-dimensions list)
48
(result-bindings list))
50
(apply #'process-extend result-field source-field
51
(loop for binding in result-bindings
52
collect (if (consp binding) (first binding) binding))
54
(loop for binding in result-bindings