Expand description
Term encoding: every RDF term maps to a tagged 64-bit integer id.
Layout (the sign bit is always 0, so ids are positive SQLite INTEGERs):
63 | 62..59 | 58..0
0 | tag | payload (hash, or inline value)Hashed kinds store a 59-bit xxh3 hash of a canonical key and need a row in terms.
Inline kinds (canonical xsd:integer in ±2^58 and canonical xsd:boolean) carry their
value in the payload, need no terms row, and — because the integer payload is offset —
sort by value, so range filters on inline integers are id range scans.
Modules§
- numeric_
type - Numeric type ranks used for SPARQL type promotion.
Structs§
- Encoded
Rows - Everything that must be written so that an encoded term can be decoded later.
- TermRow
- The row stored in
termsfor a hashed term. - Triple
Row - The row stored in
triple_termsfor an RDF 1.2 triple term.
Enums§
- Tag
- Term kinds, stored in the 4 tag bits.
Constants§
- DEFAULT_
GRAPH_ ID - The id of the default graph.
- INT_MAX
- Largest inline integer.
- INT_MIN
- Smallest inline integer.
- INT_
OFFSET - Offset applied to inline integers so that ids sort by value.
- PAYLOAD_
BITS - Number of bits used by the payload.
- PAYLOAD_
MASK - Mask selecting the payload.
Functions§
- blank_
node_ id - Encodes a blank node.
- boolean_
id - Builds the id of a boolean.
- decode_
inline - Decodes an inline id (integer, boolean) without any lookup.
- decode_
row - Decodes a hashed id from its
termsrow. - encode_
literal - Encodes a literal, returning its id and (for hashed literals) the row to store.
- graph_
id - integer_
id - Builds the id of an inline integer, if it fits.
- make_
quad - Builds a quad from decoded parts.
- make_
triple - Rebuilds a triple from its decoded components.
- named_
node_ id - Encodes a named node.
- numeric_
rank - Returns the numeric type rank of a datatype, if numeric.
- rdf_
type_ id - Well-known ids used by the planner and reasoner.
- sort_
key - A string whose byte order is the ORDER BY order of terms (blank nodes, IRIs, numbers by value, other literals by lexical form, triple terms by components).
- subject_
id - tag_of
- Extracts the tag of an id.
- term_id
- Encodes a term without collecting rows (only the id).
- timestamp
- Seconds since the epoch of an
xsd:dateTimeorxsd:datelexical form (no timezone = UTC). - timezone_
flag - For
xsd:dateTime/xsd:datevalues: 1 if the lexical form has a timezone, else 0. - to_
graph_ name - Converts a decoded term into a graph name.
- to_
subject - Converts a decoded term into a subject.
- triple_
id - Id of a triple term (hash of its component ids).
- value_
key - A string that is equal for value-equal terms (numbers by value, dates by instant): used to
compare triple terms with SPARQL
=in one SQL comparison.