A running example

We’ll explain Datalog evaluation using this small program over a set of numbers:

With input num = { 1, 2, 3, 4, 5, 6 } the query returns the primes { 2, 3, 5 }.

It uses extensional data, single- and multi-rule predicates, arithmetic, comparisons, equality, negation, the don’t-care _, and a conjunctive query.