Class AbstractQsqEngine
java.lang.Object
edu.harvard.seas.pl.abcdatalog.engine.topdown.AbstractQsqEngine
- All Implemented Interfaces:
DatalogEngine
- Direct Known Subclasses:
IterativeQsqEngine
,RecursiveQsqEngine
A Datalog engine that uses a variant of the query-subquery evaluation method.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map
<PredicateSym, Relation> EDB facts mapped by predicate symbol.protected final Map
<PredicateSym, Set<DatalogValidator.ValidClause>> Rules for deriving IDB facts mapped by predicate symbol. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Tuple
applyBoundArgs
(Tuple t, List<Boolean> adornment, Tuple input) Creates a new tuple that is like t except the bound terms of t have been replaced by the terms in input.protected Set
<PositiveAtom> If query is for an EDB relation, returns facts that unify with that query.void
Initializes engine with a Datalog program, including EDB facts.abstract Set
<PositiveAtom> Returns all facts that 1) can be derived from the rules and initial facts that were used to initialize this engine and 2) unify with the query.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.harvard.seas.pl.abcdatalog.engine.DatalogEngine
query
-
Field Details
-
edbRelations
EDB facts mapped by predicate symbol. -
idbRules
Rules for deriving IDB facts mapped by predicate symbol.
-
-
Constructor Details
-
AbstractQsqEngine
public AbstractQsqEngine()
-
-
Method Details
-
init
Description copied from interface:DatalogEngine
Initializes engine with a Datalog program, including EDB facts. The set that is passed into this method should include rules for deriving new facts as well as the initial facts, which can be encoded as clauses with empty bodies.- Specified by:
init
in interfaceDatalogEngine
- Parameters:
program
- program to evaluate- Throws:
DatalogValidationException
DatalogValidationException
- if the given program is invalid
-
query
Description copied from interface:DatalogEngine
Returns all facts that 1) can be derived from the rules and initial facts that were used to initialize this engine and 2) unify with the query.- Specified by:
query
in interfaceDatalogEngine
- Parameters:
q
- the query- Returns:
- facts
-
applyBoundArgs
Creates a new tuple that is like t except the bound terms of t have been replaced by the terms in input.- Parameters:
t
-adornment
- specifies bound terms of tinput
-- Returns:
- new tuple
-
checkIfEdbQuery
If query is for an EDB relation, returns facts that unify with that query.- Parameters:
q
- query- Returns:
- facts, or null if query is for an IDB relation
-