Class AbstractQsqEngine

java.lang.Object
edu.harvard.seas.pl.abcdatalog.engine.topdown.AbstractQsqEngine
All Implemented Interfaces:
DatalogEngine
Direct Known Subclasses:
IterativeQsqEngine, RecursiveQsqEngine

public abstract class AbstractQsqEngine extends Object implements DatalogEngine
A Datalog engine that uses a variant of the query-subquery evaluation method.
  • Field Details

  • Constructor Details

    • AbstractQsqEngine

      public AbstractQsqEngine()
  • Method Details

    • init

      public void init(Set<Clause> program) throws DatalogValidationException
      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 interface DatalogEngine
      Parameters:
      program - program to evaluate
      Throws:
      DatalogValidationException
      DatalogValidationException - if the given program is invalid
    • query

      public abstract Set<PositiveAtom> query(PositiveAtom q)
      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 interface DatalogEngine
      Parameters:
      q - the query
      Returns:
      facts
    • applyBoundArgs

      protected 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.
      Parameters:
      t -
      adornment - specifies bound terms of t
      input -
      Returns:
      new tuple
    • checkIfEdbQuery

      protected Set<PositiveAtom> checkIfEdbQuery(PositiveAtom q)
      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