Expand description
Stable file-format, reader, and in-memory build API.
Structs§
- Build
Stats - Counts describing an assembled file, for status lines and UIs.
- Byte
Range - A byte range in the
.retefile image. - Header
- Decoded file header. All multi-byte fields are little-endian on disk. The
*_offset/*_lenfields are a convenience view over the section directory (populated from it on parse, emitted back to it on serialize). - Layout
Segment - One labelled byte region of a
.retefile image (seeRete::file_layout).kindis a stable machine tag:header,metadata,dictionary,directory,tile,pyramid,named-graphs. - Rete
- A read-only, in-memory view over a
.retefile image. - Section
- One parsed/encoded section-directory entry: a typed
(offset, length)into the file, plus 16 bits of per-section flags (reserved). - Triple
Provenance - Why a triple-pattern result is present in the file.
Enums§
- File
Error - Header
Error - Ingest
Error - Why an ingest failed. Parser errors from
oxttl/oxrdfxmland I/O errors are flattened to theirDisplaystring rather than wrapped: the variants then carry no foreign types, which keeps the error usable from the wasm bindings and stable across upstream parser upgrades. - Section
Kind - A top-level file section, addressed by
SectionKindin the header directory.
Constants§
- CODEC_
NONE - No compression.
- CODEC_
ZSTD - zstd compression (per section).
- CURRENT_
FORMAT_ VERSION - Current format generation written by this crate.
- HEADER_
LEN - Fixed header size in bytes.
- MAGIC
- Magic bytes at offset 0: ASCII
RETE. - MIN_
STABLE_ READ_ VERSION - Oldest stable format generation accepted by this reader.
- RDF_
TYPE rdf:type— the predicate that assigns a class to a resource.
Functions§
- assemble_
dataset - Assemble a complete
.retefile image from parsed quads: one shared dictionary, the default-graph index, one index per named graph, and the community pyramid.metadatais the opaque metadata-section payload (the CLI puts a JSON Dataset Card there); pass&[]for none — that is byte-identical to a metadata-free build. - assemble_
dataset_ with - Like
assemble_dataset, but the metadata payload is derived from theBuildStatsright before serialization — for metadata that embeds counts only known after the dictionary and indexes are built (the Dataset Card). Returning an emptyVecis byte-identical to a metadata-free build. - assemble_
dataset_ with_ opts - Like
assemble_dataset_with, butwith_pyramid = falseskips the Louvain community pyramid entirely — no pyramid section is written (header length 0). SPARQL / SHACL / triple / reachability queries don’t use the pyramid, so a pyramid-less file is fully queryable and markedly smaller (the pyramid is the largest section on highly-connected graphs). Only the community / summary / progressive paths need it. - assemble_
dataset_ with_ opts_ algo - Like
assemble_dataset_with_opts, but selects the communityPyramidAlgo(the in-memory build path forrete build --pyramid-algo …). - parse
- Parse N-Triples text into raw term-token triples, skipping blank/comment lines.
- parse_
quads - Parse N-Quads text:
subject predicate object [graph] .per line. - parse_
rdfxml - Parse RDF/XML into canonical N-Triples-token triples via oxrdfxml. This is how
most OWL ontologies ship (
.rdf/.owl/.xmlwith anrdf:RDFroot) — so rete ingests them directly, no external conversion. (OWL/XML — the non-RDF functional XML serialization — is a different language; convert it with owlready2 first.) - parse_
statements - Parse one text input by format name (
"nt","nq","ttl", or"rdfxml") into quads (triples land in the default graph). - parse_
turtle - Parse Turtle into canonical N-Triples-token triples via oxttl.
- verify
- Recompute the content hash from a file image and check it against the header — detects corruption or truncation of the payload sections.
Type Aliases§
- RawQuad
- A parsed quad: the triple plus an optional graph term (
None= default graph). - RawTriple
- A parsed triple as three canonical term tokens.
- Term
Triple - A resolved triple as terms.