Class DatalogParallelExecutor
java.lang.Object
edu.harvard.seas.pl.abcdatalog.executor.DatalogParallelExecutor
- All Implemented Interfaces:
DatalogExecutor
A Datalog executor that runs the actual Datalog evaluation concurrently in separate threads.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFactAsynchronously
(PositiveAtom edbFact) Asynchronously adds a new EDB fact to the Datalog evaluation.void
initialize
(Set<Clause> program, Set<PredicateSym> extensibleEdbPreds) Initializes the Datalog engine with a program and specifies which EDB relations can be extended (with DatalogExecutor.addFactAsynchronously()) during evaluation.void
registerListener
(PredicateSym p, DatalogListener listener) Associates a listener with a given predicate symbol, so that if any fact is derived during evaluation with that predicate symbol, the listener will be invoked with that fact.void
shutdown()
Shuts down the executor, which cannot be reused.void
start()
Starts the Datalog evaluation.
-
Constructor Details
-
DatalogParallelExecutor
public DatalogParallelExecutor()
-
-
Method Details
-
initialize
public void initialize(Set<Clause> program, Set<PredicateSym> extensibleEdbPreds) throws DatalogValidationException Description copied from interface:DatalogExecutor
Initializes the Datalog engine with a program and specifies which EDB relations can be extended (with DatalogExecutor.addFactAsynchronously()) during evaluation. This should only be called once.- Specified by:
initialize
in interfaceDatalogExecutor
- Parameters:
program
- the programextensibleEdbPreds
- the extendible EDB relations- Throws:
DatalogValidationException
- if program is invalid
-
start
public void start()Description copied from interface:DatalogExecutor
Starts the Datalog evaluation.- Specified by:
start
in interfaceDatalogExecutor
-
shutdown
public void shutdown()Description copied from interface:DatalogExecutor
Shuts down the executor, which cannot be reused.- Specified by:
shutdown
in interfaceDatalogExecutor
-
addFactAsynchronously
Description copied from interface:DatalogExecutor
Asynchronously adds a new EDB fact to the Datalog evaluation. The EDB fact must be part of a relation that is specified in DatalogExecutor.initialize() as being extendible. A fact is a ground atom (i.e., an atom without any variables).- Specified by:
addFactAsynchronously
in interfaceDatalogExecutor
- Parameters:
edbFact
- the new EDB fact
-
registerListener
Description copied from interface:DatalogExecutor
Associates a listener with a given predicate symbol, so that if any fact is derived during evaluation with that predicate symbol, the listener will be invoked with that fact. The listener can be executed in an arbitrary thread and should not block.- Specified by:
registerListener
in interfaceDatalogExecutor
- Parameters:
p
- the predicate symbollistener
- the listener
-