World's first open-source enterprise world model.
0011 · A mapping is configuration
- Status: Implemented (#126, #140, #148) · open: the evidence chain
- Written: 2026-08-31 · condensed into English 2026-09-03
- Related: 0009 removes the builtin entity classes, 0010 the fallback relation, #125 the other eight seed relations — this record is the last step on that line: only vocabulary remains in the ontology
The problem
The semantic layer stored "business concept → data asset definition" as a fact: subject a
concept entity (Metric / Dimension), predicate mapped_to — a row in relation_types
beside works_at — object an object_value JSON { source, table?, expr?, sql?, unit?, summary? }, confidence 0.6 proposed / 1.0 confirmed. review_routes picked it up as a
low-confidence fact (< 0.75), Confirm set 1.0, and chat.rs read confirmed_mappings (≥
0.75) into the query prompt.
The reuse was deliberate and bought three real things: a Review flow with zero new UI, bitemporal history for free, and an evidence chain like any other fact's. Splitting means rebuilding all three.
Dead ends
- Keep the mapping as a fact. Rejected on four grounds:
- It is not an assertion about the world. The ontology answers "what exists and how
things relate";
mapped_toanswers "how this number is computed in our database". The third application of one sentence: 0009 (conceptis control flow), 0010 (related_tois control flow), heremapped_tois configuration. - It appeared where it should not: the ontology page listed it, the extraction prompt offered it, ontology size counted it, and after #125 it was the only seed relation — a new KB's ontology held exactly one thing, unrelated to the graph the user wants.
- "Confirm" already broke the ledger's foundation:
UPDATE facts SET confidence = 1.0in an append-only table where a correction inserts a new row withsupersedes, because the change of belief is itself information (0001 P0). Confirming changes not our belief but whether a configuration is in effect; it only worked because that state happened to fit in one float. - The shape was wrong. The real fields
source / table / expr / sql / unit / summarysat inside JSONB: unqueryable ("which concepts map toorders"), unconstrainable (uniqueness per (concept, source) hidden in JSON, closed by process rather than by the database), unexplainable (mapped_tohas no range — the object is neither an entity nor a datatype).
- It is not an assertion about the world. The ontology answers "what exists and how
things relate";
- Bitemporal history for the new table. A definition has one axis, "when it took effect"; forcing the ledger's two axes would move complexity rather than solve it.
Decisions
- Its own table,
concept_mappings: concept entity id → definition, fields as columns,UNIQUE (kb_id, concept_id, source)(a constraint;idis the primary key), plus aderivedcolumn for derived metrics.mapped_toleavesrelation_types,DEFAULT_RELATION_TYPESempties, and a new KB seeds no relations at all. - Review without borrowing the low-confidence tier. A proposal is configuration, not a
knowledge assertion. Built first as its own Review group, then (#140) as a standalone
Data Mappings page, with Review keeping only a count and a link (#148: a mapping is
neither a queue nor a history). The approval endpoints stay in
review_routes, where themapping.decidedaudit stream lives. - History as revisions.
created_at / confirmed_at / confirmed_byon the row, full snapshots inconcept_mapping_revisionswritten byrevise(), and a History drawer on the page. - Evidence recorded separately — a mapping's evidence is "which table's schema the LLM
read", not "which sentence". Not built:
concept_mappingshas no such column, and exploration proposals leave no evidence. - No data migration. Mock data only; the old
mapped_tofacts stay in the ledger unread (as with #125). After release this convenience is gone. - Two things that landed unplanned.
propose()usesON CONFLICT … DO UPDATE … WHERE status = 'proposed', so rerunning exploration does not erase a human rejection (when theWHEREfails,RETURNINGyields zero rows). Visibility is tiered: a Viewer can read the list,reviseneeds Editor — seeing the answer without the definition means trusting an algorithm you are not shown.
Revisions
- 2026-09-02: the status line said "planned" while the record arrived in the same commit as its implementation. The status line is the implementing PR's responsibility; now a README rule.
- 2026-09-02: we assumed a Review group would be the mapping's home; in use it became its own page (#140, #148).
- 2026-09-09: the concept a mapping hangs from is the wrong kind of thing. This record
decided what a mapping is (configuration, its own table, revisions) and did not decide what
a concept is; the implementation made it an entity of a builtin class
MetricorDimension, with the definition in the side table and nothing on the graph. Two benches measured the cost: on a flattened order table exploration proposed 0 of 18 usable definitions and the extractor filed 28 column names as concept entities (#501); a convention such as "test orders do not count" had nowhere to live, and its absence moved chat from 17 of 18 right answers to 1 of 18 (#520). 0036 keeps every decision above and changes the concept: an attribute of a real class, or a rule over such attributes; the mapping is how a column becomes that attribute's value;concept_mappingsbecomes a rendered table. Decision 4 (evidence recorded separately) and the second open question (one concept, several sources) are answered by the alignment itself — the evidence is the alignment, and a concept with two sources is an attribute two columns feed.
Open questions
- A confirmed definition changes. Answered by
revise+concept_mapping_revisions+ the History drawer: "last quarter's definition" can be read back. Whether querying uses it to replay historical reports is not built. - One concept, several sources.
(kb_id, concept_id, source)allows a different definition per source, on purpose. Which one does querying use? Today all go into the prompt (cap 30) and the model picks; rules are easier to add now that it is a table.
Status history
The status line as it stood on 2026-09-27, before status lines were cut to one line:
Implemented ·
concept_mappingstable and wiring (#126, the same commit as this record), a standalone Data Mappings page (#140), moved out of the Review queue (#148) · of the three things to rebuild, the Review flow and history are done, the evidence chain is not · one of two open questions answered (2026-09-02 check) · revised in part by 0036 (2026-09-09): what a mapping is stands; what a concept is changes, and the table becomes a rendered one