Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ontology & Type Mesh

The ontology layer describes relationships between documents, accounts, transactions, tax categories, evidence references, workflow tags, and Xero entities. The type mesh describes how Rust values move through pipeline stages without losing identity or auditability.

Ontology Role

Ontology operations are exposed through ledgerr_ontology:

  • query_path: follow relationships between entities
  • export_snapshot: produce a serializable graph snapshot
  • upsert_entities: add or update typed entities
  • upsert_edges: add or update relationships
fn document_record() -> ontology_entity
fn account_record() -> ontology_entity
fn transaction() -> ontology_entity
fn xero_contact() -> ontology_entity
fn ontology_entity() -> evidence_path
fn evidence_path() -> tax_assist
flowchart TD
    document_record["document_record"]
    ontology_entity["ontology_entity"]
    account_record["account_record"]
    transaction["transaction"]
    xero_contact["xero_contact"]
    evidence_path["evidence_path"]
    tax_assist["tax_assist"]
    document_record --> ontology_entity
    account_record --> ontology_entity
    transaction --> ontology_entity
    xero_contact --> ontology_entity
    ontology_entity --> evidence_path
    evidence_path --> tax_assist

Type Mesh Role

The type mesh answers a different question: which Rust values are compatible between stages, and what bridge is responsible for transforming them?

Examples:

  • TransactionInput becomes IngestedTransaction, JournalTransaction, and SampleTransaction.
  • ClassificationOutcome becomes ClassifiedTransaction and review flags.
  • LegalRule + TransactionFacts becomes Z3Result.
  • VendorConstraintSet becomes ConstraintEvaluation.

The detailed tables are generated:

Update generated tables through the repo tooling rather than hand-editing those chapters.