Coverage report: /development/source/library/org/datagraph/spocq-shard/src/core/rlmdb/parameters.lisp

KindCoveredAll%
expression01 0.0
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.rdf.lmdb.implementation; -*-
2
 
3
 (in-package :org.datagraph.rdf.lmdb.implementation)
4
 
5
 
6
 (defparameter rlmdb:*maxdbs* (+ 1 2 6 1)
7
   "Allow for the databases:
8
    - metadata
9
    - uuid->ordinal,
10
    - ordinal->record
11
    - 6 x index 
12
    - ordinal->graph")
13
 (defparameter rlmdb:*mapsize* (* 96 1024 1024 1024)) ;; nxp/plm is at 80
14
 (defparameter rlmdb:*max-readers* (* 1024 10)) ;; limit to simultaneous statement patterns
15
 
16
 
17
 
18
 
19
 (defvar +null-uuid-string+ (prin1-to-string (uuid:make-null-uuid)))
20
 
21
 (defparameter *class.rlmdb-repository* 'rlmdb:rdfcache-quad-repository)
22
 (defparameter *meta-database-name* "meta")
23
 (defparameter *revision-ordinal-database-name* "log/uuid:u32")
24
 (defparameter *revision-record-database-name* "log/u32:blob")
25
 (defparameter *temporal-graph-database-name* "log/uuid:graph")
26
 (defparameter *revision-sequence-database-name* "sha1:revision-sequence")
27
 
28
 (defparameter *string-db-mapsize* 1099511627776)
29
 (defparameter *string-db-pathname* #p"/srv/dydra/storage/strings.mdb/")
30
 (defparameter *string-db-environment* nil)
31
 (defvar *string-database* nil)
32
 
33
 (eval-when (:compile-toplevel :load-toplevel :execute)
34
 
35
 (defparameter +quad-database-names+
36
   '("gspo"
37
     "gpos"
38
     "gosp"
39
     "spog"
40
     "posg"
41
     "ospg"))
42
 
43
 (defparameter +quad-key-maps+ #(#(0 1 2 3) ;; gspo
44
                                 #(0 2 3 1) ;; gpos
45
                                 #(0 3 1 2) ;; gosp
46
                                 #(1 2 3 0) ;; spog
47
                                 #(2 3 1 0) ;; posg
48
                                 #(3 1 2 0));; ospg
49
   "Indicates the term order for the respective index.
50
   eg. entry 0 is gspo, which is identical while entry 5 reverses g-o order for ospg.")
51
 
52
 (defparameter +quad-pattern-mask-index+
53
   #(  ;;        {G, S, P, O}
54
     0 ;; /*  0: {0, 0, 0, 0} */ {index_db::gspo}
55
     5 ;; /*  1: {0, 0, 0, 1} */ {index_db::ospg}
56
     4 ;; /*  2: {0, 0, 1, 0} */ {index_db::posg}
57
     4 ;; /*  3: {0, 0, 1, 1} */ {index_db::posg}
58
     3 ;; /*  4: {0, 1, 0, 0} */ {index_db::spog}
59
     5 ;; /*  5: {0, 1, 0, 1} */ {index_db::ospg}
60
     3 ;; /*  6: {0, 1, 1, 0} */ {index_db::spog}
61
     3 ;; /*  7: {0, 1, 1, 1} */ {index_db::spog}
62
     0 ;; /*  8: {1, 0, 0, 0} */ {index_db::gspo}
63
     2 ;; /*  9: {1, 0, 0, 1} */ {index_db::gosp}
64
     1 ;; /* 10: {1, 0, 1, 0} */ {index_db::gpos}
65
     1 ;; /* 11: {1, 0, 1, 1} */ {index_db::gpos}
66
     0 ;; /* 12: {1, 1, 0, 0} */ {index_db::gspo}
67
     2 ;; /* 13: {1, 1, 0, 1} */ {index_db::gosp}
68
     0 ;; /* 14: {1, 1, 1, 0} */ {index_db::gspo}
69
     0 ;; /* 15: {1, 1, 1, 1} */ {index_db::gspo}
70
     ))
71
 
72
 (defparameter +temporal-database-names+
73
   '("tpsg"
74
     "tspg"
75
     "tgps"
76
     "tgsp"))
77
 
78
 (defparameter +temporal-key-maps+ #(#(4 2 1 0)  ;; tpsg
79
                                     #(4 1 2 0)  ;; tspg
80
                                     #(4 0 2 1)  ;; tgps
81
                                     #(4 0 1 2)) ;; tgsp
82
   "Specify the term sort precedence based on a g.s.p.o.t record, in which the
83
   o and t terms are equivalent id and timeline values.
84
   thus, position 3 is never compared.")
85
 
86
 (defparameter +temporal-pattern-mask-index+
87
   #(  ;;        {G, S, P, O, T}
88
     0 ;; /*  1: {0, 0, 0, 1, 1} */ {index_db::tpsg}
89
     0 ;; /*  3: {0, 0, 1, 1, 1} */ {index_db::tpsg}
90
     1 ;; /*  5: {0, 1, 0, 1, 1} */ {index_db::tspg}
91
     1 ;; /*  7: {0, 1, 1, 1, 1} */ {index_db::tspg}
92
     2 ;; /*  9: {1, 0, 0, 1, 1} */ {index_db::tgps}
93
     2 ;; /* 11: {1, 0, 1, 1, 1} */ {index_db::tgps}
94
     3 ;; /* 13: {1, 1, 0, 1, 1} */ {index_db::tgsp}
95
     3 ;; /* 15: {1, 1, 1, 1, 1} */ {index_db::tgsp}
96
     )
97
   "Iff a time value has been specified, construct the temporal index wrt (s x p x g).
98
    The timelime value is always present, while the term position for object is ignored.
99
   This is used alternative to the spog index." )
100
 
101
 
102
 (:documentation "time-series / event indices"
103
                 "
104
 these collate complex events: e is the complex event identifier, g is the simple event identifier
105
 they apply when the the intended sort order and/or aggregation benefits from a scan for events.
106
 for example, a wildcard pattern with sorting
107
 
108
        (0 0 0 0) X (time+uuid+ordinal)
109
 
110
 for other pattern selectivity, consistent with rsp, the graph identifes the 'simple event object', or sample,
111
 while the transaction/event id identifies the complex event
112
  - http://ontologydesignpatterns.org/wiki/Submissions:EventProcessing
113
  - https://www.w3.org/community/rsp/wiki/RDF_Stream_Models
114
 patterns with constant predicates provide variables to which to bind the results as collated solutions.
115
 differnt patterns yield different match processes with variable or constant event and graph.
116
 
117
            alternatives                    positional    quad analogs (o->e)
118
            by                              dominance
119
            selectivity                     prefered
120
 g.s.p.o.e
121
 0.0.0.—.?  egsp gspe                       egsp+gspe     gspe
122
 0.0.1.-.?  pesg pegs                       pegs          pesg
123
 0.1.0.-.?  segp sepg                       segp          speg espg
124
 0.1.1.-.?  speg pseg                       speg          pesg
125
 1.0.0.-.?  gesp geps                       gesp          gspe gesp
126
 1.0.1.-.?  gpes pges                       gpes          gpes
127
 1.1.0.-.?  sgep gsep                       gsep          gspe gesp
128
 1.1.1.-.?  gspe gpse sgpe spge pgse pqge   gspe          gspe
129
 
130
 1 / 0 indicate a constant v/s a wild term in that role
131
 - indicates no effect for object terms
132
 ? indicates sorted event if not constant
133
 
134
 if the pattern has an event term, match with it and everything above and
135
   collate for the remainder below in sort order
136
 if the pattern had no event term, but an event variable is included for sorting,
137
   match just on the terms above in sort order collate by event and those below
138
 the bgp processor accepts a value for each predicate binding which is present.
139
 the scanner constructs a vector with the full o* complement e/g/s/o* respective
140
   the repository with bindings for the successive e/g/s
141
 the bgp processor yields successive solution with e/g/s extended by just those
142
   predicate bindings which are in its pattern.
143
 
144
 if the pattern is g.s.p-wild, with an event sort, then e is the dominant collation dimension.
145
 otherwise, it is the most dependent
146
 
147
 more indices are necessary then with the quad indices, in order to always have
148
 the event order available to compute collated solutions in the intended order
149
 to avoid subsequent join and sort phases
150
 
151
 ")
152
 
153
 (defparameter +time-series-database-names+
154
   '("egsp"
155
     "pegs"
156
     "segp"
157
     "speg"
158
     "gesp"
159
     "gpes"
160
     "gsep"
161
     "gspe"))
162
 
163
 (defparameter +time-series-key-maps+ #(#(4 0 1 2)  ;; egsp
164
                                        #(2 4 0 1)  ;; pegs
165
                                        #(1 4 0 2)  ;; segp
166
                                        #(1 2 4 0)  ;; speg
167
                                        #(0 4 1 2)  ;; gesp
168
                                        #(0 2 4 1)  ;; gpes
169
                                        #(0 1 4 2)  ;; gsep
170
                                        #(0 1 2 4)  ;; gspe
171
                                        )
172
   "Specify the term sort precedence based on a g.s.p.o.e record, in which the
173
   'e' terms designate the event revision and 'o' terms do not sognify.")
174
 
175
 (defparameter +time-series-pattern-mask-index+
176
   #(  ;;        {G, S, P, O, E}
177
       ;; the r.s sort dominance is in order to collate event content
178
       ;;over contiguous (revision/timestamp/uuid) intervals
179
     0 ;; /*  0: {0, 0, 0, *, 0} */ {egsp}       (full scan over events to collate subjects) 
180
     0 ;; /*  1: {0, 0, 0, *, 1} */ {egsp}
181
     1 ;; /*  2: {0, 0, 1, *, 0} */ {pegs}       (collate predicate events : single property all sensors)
182
     1 ;; /*  3: {0, 0, 1, *, 1} */ {pegs}
183
     2 ;; /*  4: {0, 1, 0, *, 0} */ {sepg}       (collate subject events : single sensor all properties)
184
     2 ;; /*  5: {0, 1, 0, *, 1} */ {sepg}
185
     3 ;; /*  6: {0, 1, 1, *, 0} */ {speg}       (collate subject/predicate events: all)                   !psgr, as above
186
     3 ;; /*  7: {0, 1, 1, *, 1} */ {speg}
187
     4 ;; /*  8: {1, 0, 0, *, 0} */ {gesp}
188
     4 ;; /*  9: {1, 0, 0, *, 1} */ {gesp}
189
     5 ;; /* 10: {1, 0, 1, *, 0} */ {gpes}
190
     5 ;; /* 11: {1, 0, 1, *, 1} */ {gpes}
191
     6 ;; /* 12: {1, 1, 0, *, 0} */ {gsep}
192
     6 ;; /* 13: {1, 1, 0, *, 1} */ {gsep}
193
     7 ;; /* 14: {1, 1, 1, *, 0} */ {gspe}
194
     7 ;; /* 15: {1, 1, 1, *, 1} */ {gspe}
195
     )
196
   "When retrieval is ordered by transaction, construct the index wrt (g x s x p).
197
   The transaction identifier is always present and the term position for object is ignored.
198
   This is used alternative to the spog index." )
199
 )
200
 
201
 
202
 (defparameter *string-db-environment* nil
203
   "Holds the single global string database environment.
204
   This is open lazily by string-database-environment.")
205
 (defparameter *string-db-transaction* nil
206
   "Holds the current dynamic transaction over the string database.
207
   This is established by call-with-string-database.")
208
 (defparameter *string-db* nil
209
   "Hold the global dictionary-id-utf8-database from the global string db environment.
210
   This is open lazily by string-database")
211
 ��