Provenance tracking records, for each derived fact, which ground rule instance (a fully substituted clause with no variables) was the last step used to derive it. By recursively callingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HarvardPL/AbcDatalog/llms.txt
Use this file to discover all available pages before exploring further.
getJustification() on the body atoms of that rule instance, you can reconstruct a complete derivation tree explaining why a fact holds in the program.
The DatalogEngineWithProvenance interface
DatalogEngineWithProvenance extends DatalogEngine with one additional method:
fact— a ground atom to look up.- Returns the ground
Clause(rule instance) whose head isfact, ornullif the atom is not a derived fact (i.e., it is an EDB base fact or was never derived).
DatalogEngineWithProvenance extends DatalogEngine, it supports the same init() and query() lifecycle.
Creating an engine with provenance
SemiNaiveEngine is currently the only engine that supports provenance collection. Use its static factory method:
true to the underlying constructor enables provenance bookkeeping during evaluation. The standard SemiNaiveEngine.newEngine() skips this overhead.
Building a provenance tree
The following example (fromSemiNaiveEngine.java) initializes an engine with a transitive closure program and then walks the derivation tree for tc(c, c):
getJustification() returns one ground rule instance. Walking the body atoms recursively produces the full derivation tree. When getJustification() returns null for a body atom, that atom is a base EDB fact — the leaf of the tree.
Provenance information is collected during evaluation, not on demand. Enabling it with
newEngineWithProvenance() means the engine stores a justification entry for every derived fact, which adds memory overhead proportional to the size of the derived relation.