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]
Timeline
Related articles
Linked from
References
- Ceri, Gottlob and Tanca · What You Always Wanted to Know About Datalog www.dcc.fc.up.pt
- Soufflé project · Datalog tutorial souffle-lang.github.io
- Soufflé project · On Synthesis of Program Analyzers souffle-lang.github.io
- W3C · RIF Core Dialect, second edition www.w3.org
Revision history
- 2026-11-25 Publish current guides, examples and practice links
039b44cb5· View changes - 2026-11-25 Index the sourced subject histories
0d3976156· View changes