HarvardPL/AbcDatalog

Bug with extensible predicates and parallel executor

tmoux opened this issue · 1 comments

tmoux commented

I tried running the "ExecutorExample" program and encountered this exception:

Exception in thread "main" java.lang.IllegalArgumentException: Predicate true is not marked as extensible.
	at edu.harvard.seas.pl.abcdatalog.engine.bottomup.concurrent.ExtensibleBottomUpEvalManager.addFact(ExtensibleBottomUpEvalManager.java:182)
	at edu.harvard.seas.pl.abcdatalog.engine.bottomup.concurrent.ExtensibleBottomUpEvalManager.eval(ExtensibleBottomUpEvalManager.java:123)
	at edu.harvard.seas.pl.abcdatalog.executor.DatalogParallelExecutor.start(DatalogParallelExecutor.java:90)
	at edu.harvard.seas.pl.abcdatalog.executor.ExecutorExample.main(ExecutorExample.java:122)

After some poking around I found there is a fact "true" that always gets added to the list of initial facts:

rewrittenClauses.add(new ValidClause(True.getTrueAtom(), Collections.emptyList()));

The example uses the DatalogParallelExecutor, which uses the ExtensibleBottomUpEvalManager.
The exception is thrown here when trying to add the "true" fact:

public void addFact(PositiveAtom fact) {
if (!this.extensiblePreds.contains(fact.getPred())) {
throw new IllegalArgumentException(
"Predicate " + fact.getPred().getSym() + " is not marked as extensible.");
}

In the example file, the executor is initialized here:

DatalogParallelExecutor ex = new DatalogParallelExecutor();
ex.initialize(ast, Collections.singleton(edge));

However, there doesn't seem to be a way to add the "true" predicate here as it is private.
Thus, it seems this exception will occur whenever the DatalogParallelExecutor is used.

Thanks for identifying this and diagnosing the problem! I suspect the true fact was added to handle some corner cases with negation and then DatalogParallelExecutor wasn't subsequently tested (since it doesn't support negation). I've created a bunch of issues (#12, #13, #14) to avoid this in the future.