Bottom-up evaluation starts from the extensional database (EDB) — the base facts supplied toDocumentation 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.
init() — and repeatedly applies rules until no new facts can be derived (fixpoint / saturation). AbcDatalog provides four bottom-up engines: one sequential and three concurrent. All implement the DatalogEngine interface, so the calling code is identical regardless of which engine you choose.
How semi-naive evaluation works
Naive bottom-up evaluation joins every rule against the complete set of known facts on each iteration. The semi-naive optimization keeps track of which facts were derived in the most recent iteration (the “delta”) and restricts each join so that at least one body atom matches a new fact. This avoids repeating joins that cannot produce new results, dramatically reducing redundant work for recursive programs.SemiNaiveEngine (sequential)
SemiNaiveEngine is the classic sequential semi-naive engine. It is the most feature-complete engine in AbcDatalog: it supports stratified negation and binary unification/disunification in rule bodies.
Factory methods:
SemiNaiveEngine.newEngine()— returns aDatalogEngine.SemiNaiveEngine.newEngineWithProvenance()— returns aDatalogEngineWithProvenancethat records which rule instance justified each derived fact.
EngineExample.java):
ConcurrentBottomUpEngine (parallel)
ConcurrentBottomUpEngine runs the same semi-naive saturation algorithm as SemiNaiveEngine but uses concurrent data structures and a thread pool to evaluate rules in parallel. Use it when you have a large program and want to take advantage of multiple CPU cores.
Limitations: does not support negation.
ConcurrentChunkedBottomUpEngine (parallel, chunked)
ConcurrentChunkedBottomUpEngine is a variant of the concurrent engine that groups newly derived facts into chunks of a configurable size before submitting them as work items to the thread pool. This reduces task-scheduling overhead when many facts are produced in each iteration and can improve throughput for large programs.
Constructor: new ConcurrentChunkedBottomUpEngine(int chunkSize) — the chunkSize parameter controls how many facts are bundled per work item.
Limitations: does not support negation.
ConcurrentStratifiedNegationBottomUpEngine (parallel, with negation)
ConcurrentStratifiedNegationBottomUpEngine extends the concurrent approach to also handle stratified negation. It is described in the source as experimental. Choose it when you need both parallel execution and negation-as-failure in a stratifiable program.
Swapping engines
Because all bottom-up engines implementDatalogEngine, switching between them requires changing only the instantiation line:
All bottom-up engines implement the
DatalogEngine interface. Code written against the interface works with any engine, making it straightforward to benchmark or switch strategies without modifying business logic.