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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFactAsynchronously(PositiveAtom edbFact) Asynchronously adds a new EDB fact to the Datalog evaluation.voidinitialize(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.voidregisterListener(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.voidshutdown()Shuts down the executor, which cannot be reused.voidstart()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:DatalogExecutorInitializes 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:
initializein interfaceDatalogExecutor- Parameters:
program- the programextensibleEdbPreds- the extendible EDB relations- Throws:
DatalogValidationException- if program is invalid
-
start
public void start()Description copied from interface:DatalogExecutorStarts the Datalog evaluation.- Specified by:
startin interfaceDatalogExecutor
-
shutdown
public void shutdown()Description copied from interface:DatalogExecutorShuts down the executor, which cannot be reused.- Specified by:
shutdownin interfaceDatalogExecutor
-
addFactAsynchronously
Description copied from interface:DatalogExecutorAsynchronously 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:
addFactAsynchronouslyin interfaceDatalogExecutor- Parameters:
edbFact- the new EDB fact
-
registerListener
Description copied from interface:DatalogExecutorAssociates 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:
registerListenerin interfaceDatalogExecutor- Parameters:
p- the predicate symbollistener- the listener
-