java.lang.Object
edu.harvard.seas.pl.abcdatalog.engine.topdown.MstEngine
All Implemented Interfaces:
DatalogEngine

public class MstEngine extends Object implements DatalogEngine
A Datalog evaluation engine that uses the magic set transformation technique. Given a query, this engine rewrites the program in such a way that it can evaluate the query efficiently using a bottom-up engine.

NOTE: predicate symbols that use '%' might not work with this engine.

  • Constructor Details

    • MstEngine

      public MstEngine()
  • 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 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