Coverage report: /development/source/library/org/datagraph/spocq-shard/src/algebra/matrix-operators/table.lisp
| Kind | Covered | All | % |
| expression | 0 | 75 | 0.0 |
| branch | 0 | 12 | 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 "This file defines the matrix unit TABLE operator for the 'org.datagraph.spocq' RDF SPARQL engine."
8
"Copyright 2013 [james anderson](mailto:james.anderson@setf.de) All Rights Reserved."))
12
(defun matrix-table (result-field dimensions &key (graph nil))
13
"Generate a table for the possible situations:
15
- a table iff a constant graph is present
16
- a uni-dimension stream for all graphs"
18
(trace-algebra process-table :result-field result-field :dimensions dimensions :graph graph)
19
(incf-stat *algebra-operations*)
21
(cond ((and (null graph) (member dimensions '(nil spocq.a:|unit|)))
23
(make-table-matrix-field :dimensions ())))
26
(if (plusp (repository-pattern-count *repository* nil nil nil graph))
27
(make-table-matrix-field :dimensions ())
28
(make-null-matrix-field :dimensions dimensions))))
29
((and (variable-p graph) (equal dimensions (list graph)))
31
(initialize-result-field result-field :dimensions dimensions))
32
(let ((%result-data (cffi:null-pointer))
34
(declare (foreign-type (foreign-array #.+matrix-element-type+ (* 1)) %result-data)
35
(type fixnum result-row))
36
(flet ((collect (term-number)
37
(setf (values %result-data result-row) (new-field-row result-field))
38
(setf (foreign-array-ref %result-data result-row) term-number)))
39
(map-repository-contexts #'collect *transaction* :default nil)))
40
(complete-field-data result-field))
42
"Invalid table form : ~s~@[ ~s~]." dimensions graph))
43
(let ((processed (solution-field-length result-field))
44
(constructed (solution-field-length result-field)))
45
(incf-stat *solutions-processed* processed)
46
(incf-stat *solutions-constructed* constructed)
47
(values result-field processed constructed)))