Zenith Logic Foundry

Prolog Storage: Graph Forms, Shortcuts, and the FactStore

Facts route to storage purely by syntax — never by current database content or write order.

Canonical graph predicates

node(Id).
node(Id, [Labels], { props... }).
label(Id, Label).
property(Id, Key, Value).
edge(Source, Type, Target).
edge(Source, Type, Target, { props... }).

edge/4 is the only way to write a property-bearing edge.

Shortcuts

person(alice).             % label shortcut  -> label(alice, person)
knows(alice, bob).         % edge-type shortcut -> edge(alice, knows, bob)
prop_name(alice, Name).    % property shortcut -> property(alice, name, Name)

Writing Label(Id) to an existing node merges the label and preserves existing properties.

Mutation and retraction

? retract(person(alice)).
? retract(edge(alice, knows, bob)).
? retract(prop_title(alice, _)).
? retract(impart(zlf, _, _)).

retract/1 removes the first match; retractall/1 removes every match. Wildcards (_) and consistent named variables are supported.

General logical facts (FactStore)

Unreserved ground facts of arity three or greater are durable logical facts in the general FactStore:

Form Owner Meaning
node(...), label(...), property(...), edge(...) graph storage canonical contracts
unreserved P/1 graph storage label shortcut
unreserved P/2 graph storage edge-type shortcut
unreserved ground P/3+ FactStore first-class logical fact
impart(zlf, katurupi, tongtong).
? impart(zlf, From, To).
? retract(impart(zlf, katurupi, tongtong)).
? retractall(impart(zlf, _, _)).

Semantics: