Expand description
Stable file-format, reader, and in-memory build API.
Structs§
- Build
Info Plan - Everything needed to splice a build-info section into a finished file without holding the file in memory: the rewritten header, where the section goes, and where the bytes that do not move resume.
- Build
Stats - Counts describing an assembled file, for status lines and UIs.
- Byte
Range - A byte range in the
.retefile image. - Deferred
Metadata - A metadata payload whose final form needs the written (deduplicated) counts.
See
IntoMetadata. - Dump
Plan - What a filtered dump will cost, before it runs — see
Rete::dump_plan. - Final
Counts - The deduplicated counts of the file being written — what the header records, and therefore what any embedded metadata has to report.
- 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. - Scan
Plan - What a routed scan of one pattern will touch, from the tile directories
alone — see
GraphIndex::scan_plan. - 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. - Quoted
Triple Surface - Which surface a
<< … >>in Turtle/TriG input is read as — the input half ofrete export --quoted-triple-syntax, same vocabulary, same two values. - 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.
Traits§
- Into
Metadata - What a build’s metadata callback may return.
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 theBuildStatsand the source quads while they are still resident — for metadata that describes the graph (the Dataset Card). Returning an emptyVecis byte-identical to a metadata-free build; return aDeferredMetadatafor a payload that must also carry the file’s deduplicated counts, which exist only once the indexes are built. - 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 …). - assemble_
dataset_ with_ perms - Like
assemble_dataset_with_opts_algo, but writes only the permutations inperms(rete build --permutations 3). Every other byte of the file is unchanged;crate::index::PermSet::ALLreproduces the default build exactly, down to the header byte. - attach_
build_ info - Attach (or replace) a build-info section in a finished file image,
returning the new image. Layout and hash semantics:
plan_build_info. - 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","trig", or"rdfxml") into quads (triples land in the default graph). - parse_
statements_ audited_ surface parse_statements_auditedreading<< … >>in the givenQuotedTripleSurface. This is the entry pointrete buildandrete validateuse for everything but a streamed line-based input, and the one that turns “RDF 1.2 file, RDF-star reader” into an error that names the flag instead of a bare syntax complaint.- parse_
turtle - Parse Turtle into canonical N-Triples-token triples via oxttl, reading
<< s p o >>as an RDF-star quoted triple.parse_turtle_surfacechooses. - parse_
turtle_ surface parse_turtlein the givenQuotedTripleSurface.- plan_
build_ info - Plan the splice of a build-info section of
info_lenbytes into a file whose firstHEADER_LENbytes areheadand whose total length isfile_len. - read_
build_ info - The build-info section of a whole file image, or
Noneif absent. The payload is an opaque application-layer blob (the CLI stores build-conditions JSON there); it is not covered by the content hash — seeattach_build_info. - replace_
metadata - Replace the metadata section (the Dataset Card blob) of a finished file image, returning the new image. The section is the first one after the header, so every later section’s offset shifts by the length delta.
- 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.