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

KindCoveredAll%
expression2879 35.4
branch00nil
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 NULL operator for the 'org.datagraph.spocq' RDF SPARQL engine."
6
 
7
  (copyright
8
   "Copyright 2012 [james anderson](mailto:james.anderson@setf.de) All Rights Reserved."))
9
 
10
 
11
 (defmacro spocq.a:|null| (&optional dimensions)
12
   "( ( variable*? ) solutionField )
13
 A NULL form produces an empty solution field of the given dimensionality"
14
 
15
   `(null-generator ',dimensions))
16
 
17
 
18
 
19
 (defun null-generator (&optional dimensions)
20
   "Construct a solution source and terminate it immediately, in-line return it
21
  in a generator wrapper."
22
   
23
   (typecase *transaction*
24
     (matrix-transaction
25
      (matrix-null nil dimensions))
26
     (t
27
      (let ((result-channel (make-null-channel :dimensions dimensions)))
28
        (process-null result-channel dimensions)
29
        (make-null-generator :operator 'spocq.a:|null|
30
                             :dimensions dimensions
31
                             :expression nil
32
                             :channel result-channel
33
                             :constituents ())))))
34
 
35
 
36
 (defun process-null (destination dimensions)
37
   (assert-argument-types process-null
38
     (destination (or channel function)))
39
   (incf-stat *algebra-operations*)
40
   (trace-algebra process-null dimensions)
41
 
42
   (complete-field destination))
43
 
44
 
45
 (defun singleton-generator (dimensions)
46
   "Construct a solution source, emit one solution with no values and terminate it immediately,
47
  in-line return it in a generator wrapper."
48
   
49
   (typecase *transaction*
50
     (matrix-transaction
51
      (matrix-singleton nil dimensions))
52
     (t
53
      (let ((result-channel (make-channel :dimensions dimensions)))
54
        (process-singleton result-channel dimensions)
55
        (make-solution-generator :operator 'spocq.a:|unbound|
56
                                 :dimensions dimensions
57
                                 :expression nil
58
                                 :channel result-channel
59
                                 :constituents ())))))
60
 
61
 
62
 (defun process-singleton (destination dimensions)
63
   (assert-argument-types process-singleton
64
     (destination (or channel function)))
65
   (incf-stat *algebra-operations*)
66
   (trace-algebra process-singleton dimensions)
67
   (let ((page (new-field-page destination 1 (length dimensions))))
68
     (incf-stat *solutions-constructed* 1)
69
     (setf page (adjust-page page (list 1 (length dimensions))))
70
     (put-field-page destination page)
71
     ;;(print page)
72
     (complete-field destination)))
73