06 — Semantic Infrastructure¶
Where the mapped world lives: the per-tenant graph store, the shape of what's inside it, the vector index that gives hybrid retrieval its recall, and the Postgres control store that keeps the platform honest. Everything the system claims — provenance, permission parity, citations, explainable connections — has to physically exist in this layer, so this document is unusually precise about data shapes.
Stores at a glance¶
| Store | Technology | Holds | Tenancy shape |
|---|---|---|---|
| Graph store | GraphDB / Virtuoso (candidate; decision gate in 03) | TBox (ontology versions), ABox (instance data), provenance + ACL metadata | named graphs per tenant → separable to dedicated instance |
| Vector index | pgvector (upgrade path: dedicated engine) | embeddings keyed by grounding | per-tenant indexes/collections |
| Control store | PostgreSQL | tenants, sources, sync state, review queues, audit, budgets, registry | row-isolated by tenant_id, no cross-tenant query paths in code |
| Object/landing store | S3-compatible | raw captures, doc renditions, review artifacts | per-tenant prefixes + lifecycle policies |
Graph store layout (per tenant)¶
<tenant>/tbox/core-v{n} core ontology, product-versioned, read-only for tenant
<tenant>/tbox/domain-v{n} client domain ontology, review-gated commits
<tenant>/abox/{source}/{partition} instance data, partitioned by source + month/snapshot
<tenant>/prov/{run} ingestion-run provenance graphs
<tenant>/acl/{source} ACL state mirrored from source systems (07)
<tenant>/queue/drafts review-pending supersedes/edges (visible to reviewers only)
Named = the isolation unit. Same boundary enforced at gateway routing. In
dedicated-instance deployment tiers, these graphs become separate databases — the
code never knows or cares, it always addresses by <tenant>/... IRI.
The active ontology pointer. <tenant>/tbox/active is a pointer graph binding
the resolution to core-v(n) + domain-v(m). A rollback is a pointer flip. Re-mapping
after an ontology change is a derived ABox job ("re-map partition X against v(n+1)"),
never a live migration.
What every published triple carries¶
The invariant that most differentiates this layer: no bare facts. Every published statement is anchored to how it was extracted. The canonical shape:
ex:acme-org a freightco:Customer ;
kmap:legalName "Acme Corporation" ;
prov:wasDerivedFrom
[ a prov:Entity, kmap:Extraction ;
prov:wasGeneratedBy ex:run/2026-09-28T14:02/ade-7f3 ; # ingestion run (durable, replayable)
kmap:sourceAt ex:ground/contract.pdf/p7/x120-318_y340-410 ;
kmap:extractionConfidence 0.94 ;
dcterms:isPartOf <tenant>/abox/drive/202609 >] .
In practice this serializes as reified statement resources (RDF-star flavored): provenance + ACL attach to the statement, not just the entity, because the same fact can be extracted with different grounding and rights from different sources — and "who told us this, where exactly, how confidently" must never collapse.
Mandatory statement metadata:
1. prov:wasGeneratedBy → ingestion run (source connector, extraction run, model snapshot).
2. kmap:sourceAt → grounding. For documents: document node + page + bbox (+ text
range). For database rows: source/table/primary key. For APIs: endpoint + object id.
If a fact cannot be grounded, it doesn't get published.
3. kmap:extractionConfidence → where the extractor reported one (document word/
field level); review-approved facts learn kmap:humanConfirmed.
4. ACL visibility → resolved to principals/policies per (07)
at write time as kmap:readableBy / kmap:visibilityPolicy, plus kept raw for
re-resolution when source ACLs change.
5. Ontology version tag → stating which TBox version legitimized the triple.
Core query surfaces¶
Consistent with the isolation principle, all served through the gateway + tenant routing, never direct DB exposure:
- SPARQL (per-tenant endpoint; SELECT/CONSTRUCT; UPDATE denied — publication is ingestion-plane only) — power users and analytics; also the substrate of several platform features (connection discovery, diffing).
- GraphQL — autogenerated off the active ontology, for client integrations; the API plane exposes a conservative subset (09).
- Vector + BM25 search — see below; agents and humans both start here.
The pipeline translates any GraphQL/REST read into SPARQL with the user's permission filter injected — read cache never contains unfiltered results: the ACL join is part of the query plan, not an output filter.
Vector index¶
- Embeddings exist for: document blocks/pages/sections (grounding carried as payload), entity nodes (label + type + summary), and ontology terms (so natural language can find schema — "which class means 'shipment'").
- Index rows carry
{tenant, iri, kind, text_hash, grounding (doc/page/bbox or row), acl_version, ontology_version}. - Permission filtering happens at query time over the ACL-joined candidate set — never by trusting pre-filtered clusters.
- Served through the retrieval layer only (08); it is one engine of hybrid search, not a search product.
Control store (Postgres)¶
The boring database that keeps the platform operational and auditable:
tenants, isolation_tier, residency, key_material_refs (vault pointers, never keys)
sources (per tenant): type, config fingerprint, sync mode, state, freshness SLO
sync_runs, drift_events, dead_letters
review_queues: ontology proposals, merges, conflicts, low-confidence extractions
ontology_registry: versions, changelogs, approvers, promotion state
audit (append-only): every retrieval, agent action, admin action, webhook emit
budgets: token/credit per tenant, persona, api key; soft/hard caps
All access is code-scoped by tenant_id; the schema refuses cross-tenant queries by
construction (no query builder ever receives a tenant-less filter).
Operational guarantees & values¶
- Recoverability: ABox partitions regenerate from the landing store. Nothing ingested is ever actually lost from a partial outage — replay closes gaps. Provenance graphs are correlated with landing checksums every run.
- Consistency: publication is graph-write + vector-update + registry-commit in one workflow boundary; a half-published state self-heals on the next scheduled run or rolls back cleanly.
- Right-to-erasure (GDPR): per-tenant deletion jobs walk the graph by person anchors (person node + all statements where the person is the subject or value, plus ACL references) and tombstone them, generating a deletion receipt for the audit log. Verified quarterly against a synthetic-person probe inserted into a staging tenant — if the probe leaves a residue, the release blocks.
- Export: one-command tenant export (Turtle + documents manifest + vector metadata) — guaranteed in the contract, designed in the store, tested in CI.
- Versioning: every published artifact (ontology version, ABox partition, index shard) is immutable and addressable; active-set is a pointer. Retention windows and size budgets per partition family keep older generations chilled but restorable.
What this layer refuses to be¶
- Not a system of record. Client systems stay source of truth; the graph is a permission-aware, provenance-rich, derived view.
- Not writable by agents. Agents (including ours, including admin tools) have no graph-write primitive; corrections fork to ingestion or a governed review path.
- Not a lake. No gratuitous hoarding: if a source isn't mapped to an ingestion profile, the map doesn't need its raw bulk long-term.
References to adjacent docs¶
- How ontology versions are governed → 04-ontology-strategy.md
- How data gets in, stage by stage → 05-ingestion-plane.md
- How reads travel through all this safely → 08-retrieval-and-agents.md
- Isolation, keys, audit specifics → 07-security-tenancy-privacy.md