Expand description
Q42LEX lexicon format. The byte-view reader (q42_lex::Q42LexMmap) and
serializers are transport-neutral and compile on wasm32; only the
filesystem/mmap handles (q42_lex::Q42LexFile, q42_lex::Q42Lexicon
path loaders) stay native.
Read .q42.lex reverse-lexicon sidecars (Q42LEX format from qualia-cli ingest).
Structs§
- Q42Lex
File - Memory-mapped
.q42.lexfile handle (native targets). - Q42Lex
Mmap - Zero-allocation view over a memory-mapped
.q42.lexslice (sorted hash index). - Q42Lexicon
- In-memory hash → UTF-8 string map from a
.q42.lexfile (cold-path loader).
Enums§
- LexError
- Lexicon
Entry - Lexicon entry payload for serialization
- Lexicon
Key - Largest UTF-8 prefix of
sthat fits inmax_bytes, never splitting a codepoint. Zero-allocation lexicon key for in-memory lookups
Constants§
- DEFAULT_
LEX_ PAGE_ ENTRIES - Fixed upper bound used by the canonical writer. Pages are independently addressable, so an HTTP/IPFS reader only needs this many dictionary records (plus their strings) for one hash lookup.
- INDEX_
ENTRY_ SIZE - LEX_
HEADER_ SIZE - LEX_
MAGIC - LEX_
TAG_ NAMESPACED - v4 namespaced entry: [u16 ns_id][u16 local_len][utf-8 local]. Only legal inside a LEX_VERSION_V4 page with a namespace table.
- LEX_
TAG_ STRING - Type tags for lexicon entries (1-byte prefix in payload)
- LEX_
VERSION_ PAGED - LEX_
VERSION_ V4 - Namespaced paged format: per-page namespace dictionaries plus
0x04(ns_id, local)entries. The version word aligns with the Q42 volume generation that first ships it; there is no LEX v3 (ADR 0015). - PAGED_
DIRECTORY_ ENTRY_ SIZE - PAGED_
DIRECTORY_ HEADER_ SIZE - PAGED_
PAGE_ HEADER_ SIZE
Functions§
- serialize_
paged_ string_ lexicon - Serialize the v2 paged Q42LEX representation.
- serialize_
string_ lexicon - Serialize a hash → string map into the canonical
Q42LEXbyte layout thatQ42LexMmapreads back (magic, sorted 16-byte index, tagged string blob). This is the write side of the lexicon: the RDF ingest calls it in lossless (“Complete”) mode so every subject/predicate URI and every literal is recoverable viaQ42LexMmap::lookup_hash, instead of being hashed away.