Everything is a GUID in one of three tables. The table an id lives in says what it
is: a word is its text; an entity is just an id,
described by the doublets that point at it; a doublet is a pair.
A fact is two doublets.
schema
columns
words.id
GUID, primary key.
words.value
the text; UNIQUE, never empty. Case-sensitive, found or created.
entities.id
GUID, primary key — the whole row. Meaning comes from its doublets.
doublets.id
GUID, primary key.
doublets.left
a GUID referencing any row in words, entities or doublets.
doublets.right
likewise. UNIQUE(left, right) so a pair exists once; indexed on right.
built on top
A fact is two doublets:((subject, predicate), object). The inner
(subject, predicate) is shared by every object. Text is a chain of positions: each position an entity, with
(pos, of) → word and (pos, next) → pos. Built-in entities (fixed GUIDs, named like anything else):
a · name · of · next · word separator.