Datalog

Summary: A foundational, rule-based query language for graphs that dates back to the 1980s.

Sources: raw/chapter2

Last updated: 2026-04-15


Datalog is a subset of Prolog and provides the foundation that later query languages like Cypher and SPARQL build upon (source: chapter2, p. 60).

How it Works

  • Predicates: Data is written in the form predicate(subject, object) (source: chapter2, p. 61).
  • Rules: Complex queries are built by defining rules that derive new predicates from existing data or other rules (source: chapter2, p. 61).
  • Recursive Rules: Rules can refer to themselves, making it powerful for traversing complex graph structures (source: chapter2, p. 61).