Coverage report: /development/source/library/org/datagraph/spocq-shard/src/core/libraries/dydra-ndk.lisp

KindCoveredAll%
expression1837 48.6
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: cl-user; -*-
2
 
3
 (in-package :org.datagraph.spocq.implementation)
4
 
5
 ;; based on
6
 ;;  lgrep dydra-ndk: | sed -e 's/.*\(dydra-ndk:*\)\([a-zA-Z0-9-]\+\).*/:\2/I' | sort | uniq
7
 (modpackage :dydra-ndk
8
   (:use :cffi
9
         ;; in case this is the only definition
10
         :common-lisp)
11
   (:export :count-matched-quads
12
            :decode-time
13
            :encode-time
14
            :foreign-function-error
15
            :free-quad-cursor
16
            :input-output-error
17
            :load-library
18
            :make-quad-cursor
19
            :make-term-matrix
20
            :message
21
            :parse-decimal
22
            :quad
23
            :quad-cursor
24
            :quad-cursor-graph-id
25
            :quad-cursor-next
26
            :quad-cursor-object-id
27
            :quad-cursor-predicate-id
28
            :quad-cursor-skip
29
            :quad-cursor-subject-id
30
            :record-query-accounting
31
            :report-query-error
32
            :statement-object-id
33
            :statement-predicate-id
34
            :statement-subject-id
35
            :statement-urn-string
36
            :string-collate
37
            :term-compare
38
            :term-datatype-id
39
            :term-language-tag
40
            :term-matrix-column-count
41
            :term-matrix-get
42
            :term-matrix-row-count
43
            :term-value-as-boolean
44
            :term-value-as-double
45
            :term-value-as-float
46
            :term-value-as-int16
47
            :term-value-as-int32
48
            :term-value-as-int64
49
            :term-value-as-int8
50
            :term-value-as-uint16
51
            :term-value-as-uint32
52
            :term-value-as-uint64
53
            :term-value-as-uint8
54
            :term-value-as-unix-time
55
            ))
56
 
57
 (in-package :dydra-ndk)
58
 
59
 (defcfun ("dydra_term_compare" %%term-compare) :int (term1-id :int64) (term2-id :int64))
60
 
61
 (defun term-compare (term1-id term2-id)
62
   "Compares the two RDF terms denoted by TERM1-ID and TERM2-ID.
63
    Returns -1, 0, 1, or NIL (if the terms are incommensurable).
64
    Signals an error if either of the term identifiers is invalid."
65
   (declare (type fixnum term1-id term2-id))
66
   (let ((result (%%term-compare term1-id term2-id)))
67
     (case result
68
       ((-1 0 1) result)
69
       (t nil))))
70
 
71
 (defun term-lessp (term1-id term2-id)
72
   (let ((order (term-compare term1-id term2-id)))
73
     (when order (= (the fixnum order) -1))))
74
 
75
 (defcfun ("dydra_string_collate" %%string-collate) :int (string1 :string) (string2 :string) (language :string))
76
 (defcfun ("dydra_string_compare" %%string-compare) :int (string1 :string) (string2 :string))
77
 
78
 (defun string-collate (string1 string2 language)
79
   (declare (type string string1 string2 language))
80
   (let ((result (%%string-collate string1 string2 language)))
81
     (case result ((-1 0 1) result) (t nil))))
82
 
83
 (defun string-compare (string1 string2)
84
   (declare (type string string1 string2))
85
   (let ((result (%%string-compare string1 string2)))
86
     (case result ((-1 0 1) result) (t nil))))
87
 
88
 #-store-is-rdfcache
89
 (macrolet ((defstub (name args) `(defun ,name ,args (declare (ignore ,@args)))))
90
   (defstub DYDRA-NDK:DECODE-TIME (time &optional zone))
91
   (defstub DYDRA-NDK:encode-TIME (second minute hour day month year &optional zone))
92
   (defstub DYDRA-NDK:RECORD-QUERY-ACCOUNTING (id url start-time notes))
93
   (defstub DYDRA-NDK:REPORT-QUERY-ERROR (task-id condition-type &key string))
94
   (defstub DYDRA-NDK:STATEMENT-OBJECT-ID (s))
95
   (defstub DYDRA-NDK:STATEMENT-PREDICATE-ID (s))
96
   (defstub DYDRA-NDK:STATEMENT-SUBJECT-ID (s))
97
   (defstub DYDRA-NDK:STATEMENT-URN-STRING (s p o))
98
   (defstub DYDRA-NDK:TERM-DATATYPE-ID (%term))
99
   (defstub DYDRA-NDK:TERM-value-as-unix-time (number))
100
   (defparameter DYDRA-NDK::*BUILD-REVISION* "")
101
 )