Expand description
Compact, lossless encoding of an EvidenceRun.
Full evidence is large for three measured reasons, and they dominate on different corpora:
- Repeated terms. The same IRIs recur at every mention. On
brick/models/bldg1.ttl(2,650 triples) 243,249 term occurrences are 548 distinct terms — a 444× redundancy, and the single largest lever. It grows with the corpus:bldg11.ttlreaches 998×. - Repeated subtrees. The same
(constraint, node)conclusion is reached through many parents, and each occurrence is written out in full. On the same model 105,673 evidence-node occurrences are 19,765 distinct nodes — 5.3×, and roughly constant across the Brick corpus. - The constraint catalog. Both arenas are dumped on every run
regardless of how many findings there are. On a small 223P model
(
guideline36-2021-A-1.ttl, 146 triples) that fixed cost is 2.02 MB of a 3.52 MB run — 57%.
Together, on bldg1.ttl, a 33.1 MB run encodes to 9.8 MB with its catalog
and 7.6 MB without. sharing reports the two redundancy factors for a run
directly, measured against the very predicates the encoder interns by, so a
quoted ratio cannot drift from what compaction actually collapses.
This encoding removes both without losing anything: evidence nodes and RDF
terms are hash-consed into tables and referenced by index, and the catalog
is optional for callers that already hold the schema. expand reconstructs
the original run exactly.
The encoding is structural rather than typed: it interns any tagged
{"type", "details"} object and any RDF term, so it follows the evidence
vocabulary automatically instead of mirroring every variant. That keeps one
definition of the evidence types and gives the Python bindings the same
format for free.
Structs§
- Sharing
- How often the interned entries of a run repeat.
Enums§
- Compact
Error - Why a compact encoding could not be read back.
Functions§
- compact
- Encode
runin the compact form. - compact_
value - Encode an already-serialized run.
- expand
- Reconstruct a run from its compact encoding, which must carry its catalog.
- expand_
value - Reconstruct the serialized run without decoding it into the typed form.
- expand_
with_ catalog - Reconstruct a run whose catalog was omitted, using a catalog held elsewhere.
- sharing
- Measure how much a run’s evidence repeats, without keeping the encoding.
- to_
compact_ json - Serialize the compact encoding.