Hopper Wiki
Time view Latest revision

Event dates describe the subject. The knowledge cutoff controls which editorial revisions you can see.

Knowledge graphs

Datalog

Datalog is a declarative language for deriving facts from relations and rules. Recursive rules make it useful for questions such as which topics or dependencies can be reached through a series of links. [1]

Article revision recorded

Facts and rules

A fact supplies a known tuple, such as a direct link from one topic to another. A rule supplies a conclusion whenever all conditions in its body hold. A query asks which tuples follow. A typical implementation of positive Datalog repeatedly applies rules until they produce no new tuples. [1] [2]

Why recursion terminates in the basic language

In function-free, range-restricted positive Datalog over a finite set of constants, every variable in a rule’s conclusion is bound by a positive body relation. Only finitely many distinct tuples can be derived. Implementations can add arithmetic or operations that generate new values, so check the dialect before relying on this termination guarantee. [1] [2]

Use it in a wiki

Store directly asserted links and their sources. Derive ancestor links in a separate relation so that a page can distinguish a direct citation from the result of a rule. If editors remove a link, recompute the affected conclusions or use an engine that maintains them. A second derivation might still support the same conclusion. [1] [3] [2]

Examples

Beginner

Record that Retrieval is broader than Hybrid search and that AI methods is broader than Retrieval. Asking for all ancestors of Hybrid search should return both topics. [1] [2]

Intermediate

With broader(child,parent), use ancestor(X,Y) :- broader(X,Y). Then add ancestor(X,Z) :- broader(X,Y), ancestor(Y,Z). The second rule extends a known path by one edge. [1] [2]

Advanced

Feed the rules a diamond-shaped hierarchy with two paths to the same ancestor. Expect one ancestor tuple under set semantics. Remove one path and confirm the ancestor is still reachable through the other. [1] [3] [2]

Timeline

Documented milestones by year
19891
20131
20161
  1. Ceri, Gottlob and Tanca describe Datalog’s syntax, semantics and query evaluation [1]
  2. W3C publishes a second edition of the Datalog-related RIF Core dialect [4]
  3. The Soufflé team describes compiling Datalog rules into program analyzers [3]

Related articles

Linked from

References

  1. Ceri, Gottlob and Tanca · What You Always Wanted to Know About Datalog www.dcc.fc.up.pt
  2. Soufflé project · Datalog tutorial souffle-lang.github.io
  3. Soufflé project · On Synthesis of Program Analyzers souffle-lang.github.io
  4. W3C · RIF Core Dialect, second edition www.w3.org
Revision history