Skip to main content

Module format

Module format 

Source
Expand description

Stable file-format, reader, and in-memory build API.

Structs§

BuildStats
Counts describing an assembled file, for status lines and UIs.
ByteRange
A byte range in the .rete file image.
Header
Decoded file header. All multi-byte fields are little-endian on disk. The *_offset / *_len fields are a convenience view over the section directory (populated from it on parse, emitted back to it on serialize).
LayoutSegment
One labelled byte region of a .rete file image (see Rete::file_layout). kind is a stable machine tag: header, metadata, dictionary, directory, tile, pyramid, named-graphs.
Rete
A read-only, in-memory view over a .rete file image.
Section
One parsed/encoded section-directory entry: a typed (offset, length) into the file, plus 16 bits of per-section flags (reserved).
TripleProvenance
Why a triple-pattern result is present in the file.

Enums§

FileError
HeaderError
IngestError
Why an ingest failed. Parser errors from oxttl/oxrdfxml and I/O errors are flattened to their Display string 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.
SectionKind
A top-level file section, addressed by SectionKind in 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 .rete file image from parsed quads: one shared dictionary, the default-graph index, one index per named graph, and the community pyramid. metadata is 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 the BuildStats right before serialization — for metadata that embeds counts only known after the dictionary and indexes are built (the Dataset Card). Returning an empty Vec is byte-identical to a metadata-free build.
assemble_dataset_with_opts
Like assemble_dataset_with, but with_pyramid = false skips 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 community PyramidAlgo (the in-memory build path for rete 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/.xml with an rdf:RDF root) — 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.
TermTriple
A resolved triple as terms.