0009 · An undecided type stays empty
- Status: Implemented ·
entities.type_idandentity_retypes.from_type_idare nullable; the nine builtin classes and the seeding function left with the seed relations (#110 / #125 / #128 / 0011) ·owl:disjointWithnow reaches resolution (0016 B3): a declared disjointness, inherited down both hierarchies, keeps same-name entities apart ahead of every heuristic; since #226 same-name entities of kin classes (ancestor, descendant or a shared non-root ancestor) go to Review;CONFUSABLE_TYPE_KEYSstays as the fallback when nothing is declared ·metric/dimensionare created on demand by mapping exploration (#231); a semantic-layer pack is still planned - Written: 2026-08-30 · condensed into English 2026-09-03
- Related: 0008 makes a real vocabulary the optional start; 0001 IRI/key split behind the collision argument; 0010 the twin on the relation side
The problem
A new KB used to seed nine entity classes: person organization project metric dimension product event concept location. None carried a signature (0008), and once schema.org is
installed Person / Organization / Product / Event / Project are claimed by key, so
the builtin set was a placeholder. location was worse: schema.org calls it Place, the
keys differ, so City / AdministrativeArea hung under a separately created place — a
name of our own cut the geographic subtree in two.
concept was different: it was control flow. extraction.rs required it ("Ontology
missing the 'concept' type") as the landing place for entities whose type is not in the
whitelist — a state that exists under any ontology — and as the candidate pool for type
resolution (entities_for_type_resolution(kb, DUMPING_GROUND, …)). A "not decided yet" sat
in the ontology as a class, as if someone had decided it.
Decisions
- Remove all nine classes; a KB without packs is truly empty. Extracted entities get
type_idNULL, facts and evidence land as usual; install a pack later, rerun type resolution, and they are assigned —entities_for_type_resolutionnow takestype_id IS NULL. "Build the KB first, model later" is a supported path; schema.org is pre-checked in the create dialog. Landing addedentities.type_source(extracted / human / inferred) to separate "not decided" from "a human decided there is none". entities.type_idbecomes nullable, no sentinel row. The Rust compiler lists every consumer of the newOption. SQL does not:NULL <> uuidevaluates to NULL, soAND type_id <> $2selects no rows and raises nothing. Hit twice on the main path —adopt_proposed_typesandretype_entities, whose inputs are almost alltype_id IS NULL— running silently empty with green tests. The fix isIS DISTINCT FROM(measured:<>selects 0 rows,IS DISTINCT FROM1). The real cost was rereading every comparison in 26 SQL strings; the change touched 14 files,+316 / -369.- Untyped same-name entities may coexist. The unique index
(kb_id, type_id, lower(canonical_name)) WHERE merged_into IS NULLdoes not stop two untyped "张三", because NULL ≠ NULL. Intended: the index allows same name across types (0001 P0: two 张伟 must be storable apart), and untyped we know even less, so there is even less reason to merge. Recorded so nobody files it as a bug. - Drawing it. The node query switched from
JOIN entity_typestoLEFT JOIN— an inner join makes an untyped entity vanish from the graph while its facts stay, the hardest data loss to notice.keyandlabelstay NULL; color and shape get defaults (gray dot: the canvas must receive something). Review items likewise. - First typing is a completion. Type resolution treats "chosen class outside the
current subtree" as reclassification and sends it to a human; an untyped entity has no
extraction judgment to overturn, and judging it cross-axis would put every entity in
front of a person.
entity_retypes.from_type_idis nullable accordingly — the commonest retype is none → some, and that table is the only basis for undo. CONFUSABLE_TYPE_KEYSstays (["organization","project","product"]): the keys still exist after schema.org, from import rather than seeding; without packs the tier never hits and every cross-type same-name pair isDisjoint— stricter, no wrong merges. The proper fix is to readdisjointWithfrom the ontology.
Dead ends
- Keep the sentinel, rename its key to
_unclassified(first draft). It would have held:key_from_irinever emits a leading underscore (measured:skos:Concept → concept,http://x#_Concept → concept,http://x#__unclass → unclassified), so the namespace is unreachable by import. And a rename was necessary: the sentinel had no IRI, import claims IRI-less placeholders, soskos:Conceptwould take over the sentinel and every undecided entity would silently become a realskos:Concept. But renaming fixes collision, not leakage: the sentinel must be filtered from every consumer — ontology page, prompt, candidate lists, legend, export, statistics — and one forgottenWHERE key NOT LIKE '\_%'fails silently. A naming convention in place of a type guarantee, the defect classontology_index.rswarns about ("self-heal, don't hang hooks"). - "NULL cannot be forgotten — SQL and the type system will tell you." Half right; the SQL half is decision 2.
Revisions
- 2026-09-02:
owl:disjointWithnow has a table (entity_type_disjoint), import and an edit endpoint, but its only consumer is R0's ontology self-check;CONFUSABLE_TYPE_KEYSis still three hard-coded keys (0016 B3). - 2026-09-03: resolution reads the table (0016 B3).
declared_disjoint_fromcollects the classes declared disjoint with the mention's class or any ancestor, expanded to their descendants, in one recursive query; both cross-type paths (type drift and containment) treat a hit asDisjointbefore the kinship check and the hard-coded list. Nothing declared → today's behavior, unchanged. The list is now a fallback, and decision 6 reads accordingly. - 2026-09-02:
metric/dimensionhad a visible cost — mapping exploration looked upentity_types.key IN ('metric','dimension')andcontinued when missing, so a KB without those classes silently produced zero mappings. 2026-09-03: exploration now creates both as builtin types before exploring (#231); a semantic-layer pack with IRIs is still planned (0016 D2).
Open questions
- Resolving untyped entities. The profile has no type dimension, so
classify_type_driftlacks one criterion. Two untyped same-name entities goRecalland rely on profile similarity; whether that is enough is untested. - Where
metric/dimensionbelong. Today they are builtin-on-demand. A "Utopia semantic layer" pack would move the last builtin classes out of code into something optional, with IRIs, replaceable (0016 D2).