Expand description
SPARQL AST - Index-Based Zero-Allocation Query Representation
Uses u16 indices into flat arrays to avoid Box allocation and recursive type errors. Fully compliant with AGENTS.md zero-allocation constraints.
Structs§
- AskQuery
- ASK query
- Binding
Row - Binding row - stack-allocated row for variable bindings
- Construct
Query - CONSTRUCT query
- Describe
Query - DESCRIBE query
- Literal
Table - Query-scoped table of literal text + optional language tag / datatype IRI,
hash -> (text, lang?, datatype?), built by the parser for string/geometry/typed constants. Lives outside the zero-heapSparqlQueryContext— a cold parse/eval-time structure — so builtins (STR/LANG/DATATYPE/geof:*/…) recover what they need without heap on the §6 hot path. - Order
Condition - ORDER BY condition
- Select
Query - SELECT query
- Sparql
Query Context - Flat query context arena - pre-allocated, no heap allocation
- String
Sink - Query-scoped sink for strings produced by expression evaluation — the result
of
CONCAT/SUBSTR/UCASE/…, anxsd:dateTimelexical fromNOW, aUUIDstring, or a value-producingBIND.EvalResultonly carries au64hash, so a produced string must be interned somewhere its hash can be resolved again; this is that table. - Text
Resolver - Borrowed text resolver threaded into expression evaluation. Resolves a term
hash to its literal text via, in order: the query-scoped
LiteralTable(query constants), aStringSinkof values produced during this query, an optional ingested-data lexicon closure (e.g. wrapping aQ42LexMmap::lookup_hash), and finally the global demo lexicon. Also carries the query-stablenow_msclock andseedused by the temporal /UUID/RANDbuiltins so their results are referentially transparent within one query snapshot (plan §4.4). All borrowed — no per-query heap in the evaluator, so the §6 hot-path invariant holds.
Enums§
- Binary
Op - Binary operators
- Expression
- Expression - uses ExpressionId for nested expressions
- Function
- Built-in SPARQL functions
- Path
- Property path (SPARQL 1.1)
- Pattern
- Graph pattern - now uses PatternId indices instead of Box
- Sparql
Query - SPARQL query forms
- Temporal
Mode - Temporal snapshot mode for
AS OF/AT TIMEqueries. - UnaryOp
- Unary operators
Constants§
- MAX_
BINDINGS - Maximum number of bindings per row
- MAX_
EXPRESSIONS - Maximum number of expressions in a query context
- MAX_
ORDER_ CONDITIONS - Maximum number of order conditions
- MAX_
PATTERNS - Maximum number of patterns in a query context
- MAX_
VARIABLES - Maximum number of variables per query
Traits§
- Physical
Operator - Physical operator trait for query execution
Functions§
- literal_
term_ hash - Query-scoped table of literal text (
hash -> string) built by the parser for string/geometry constants. It lives outside the zero-heapSparqlQueryContext— it is a cold parse/eval-time structure — so functions that need literal text (geof:*,STR,REGEX, …) can recover it without puttingString/Vecon the zero-heap execution hot path (CLAUDE.md §6). Canonical hash for a literal term, distinguishing a plain literal from a language-tagged or datatype-tagged one ("x","x"@en, and"x"^^:tare three distinct RDF terms). The parser and theStringSinkboth use this so a producedSTRLANG/STRDTterm round-trips its tag.