Interface DatalogEngine

All Known Subinterfaces:
DatalogEngineWithProvenance
All Known Implementing Classes:
AbstractQsqEngine, BottomUpEngineFrame, BottomUpEngineFrameWithProvenance, ConcurrentBottomUpEngine, ConcurrentChunkedBottomUpEngine, ConcurrentStratifiedNegationBottomUpEngine, IterativeQsqEngine, MstEngine, RecursiveQsqEngine, SemiNaiveEngine

public interface DatalogEngine
A Datalog evaluation engine. Datalog engines are initialized with a set of clauses that represent initial facts and rules that can be used to derive new facts. After initialization, clients can query about whether certain facts are derivable.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    init(Set<Clause> program)
    Initializes engine with a Datalog program, including EDB facts.
    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.
    Returns the set of all (minimal) substitutions that 1) ground the given conjunctive query, and 2) make it true with respect to the Datalog program backing this engine.
  • Method Details

    • init

      void init(Set<Clause> program) throws DatalogValidationException
      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.
      Parameters:
      program - program to evaluate
      Throws:
      DatalogValidationException
      IllegalStateException - if this engine has already been initialized
      DatalogValidationException - if the given program is invalid
    • query

      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.
      Parameters:
      q - the query
      Returns:
      facts
      Throws:
      IllegalStateException - if this engine has not been initialized with a program
    • query

      default Set<ConstOnlySubstitution> query(List<PositiveAtom> query)
      Returns the set of all (minimal) substitutions that 1) ground the given conjunctive query, and 2) make it true with respect to the Datalog program backing this engine. To get a concrete solution to the conjunctive query, apply one of the returned substitutions to the list representing the query (using, e.g., SubstitutionUtils.applyToPositiveAtoms).
      Parameters:
      query - the conjunctive query
      Returns:
      the set of minimal satisfying substitutions
      Throws:
      IllegalStateException - if this engine has not been initialized with a program