Class ClingoProver

java.lang.Object
edu.tufts.hrilab.belief.provers.clingo.ClingoProver
All Implemented Interfaces:
Prover

public class ClingoProver extends Object implements Prover
  • Constructor Details

    • ClingoProver

      public ClingoProver()
  • Method Details

    • querySupport

      public Boolean querySupport(Term query)
      Description copied from interface: Prover
      checks validity of a belief.
      Specified by:
      querySupport in interface Prover
      Parameters:
      query - The query / belief
      Returns:
      whether the belief holds
    • querySupportWithExplanation

      public org.apache.commons.lang3.tuple.Pair<Boolean,Map<Term,Boolean>> querySupportWithExplanation(Term query)
      Description copied from interface: Prover
      checks validity of a belief, with an explanation from spy.
      Specified by:
      querySupportWithExplanation in interface Prover
      Parameters:
      query - The query / belief
      Returns:
      whether the belief holds
    • queryBelief

      public List<Map<Variable,Symbol>> queryBelief(Term query)
      Queries the Belief State about the term in the argument, and a set of bindings corresponding to all of the found answers.
      Specified by:
      queryBelief in interface Prover
      Parameters:
      query - : a query in Term format
      Returns:
      an ArrayList of bindings: here represented as a HashMap from Variables to Symbols
    • assertBelief

      public void assertBelief(Term belief)
      Adds a single belief to the Belief State of the agent. Note: new beliefs are added such that they take priority in unification to old beliefs. queryBelief() will still return all asserted and inferred bindings.
      Specified by:
      assertBelief in interface Prover
      Parameters:
      belief -
    • retractBelief

      public void retractBelief(Term belief)
      Removes a single belief from the Belief State of the agent.
      Specified by:
      retractBelief in interface Prover
      Parameters:
      belief -
    • assertRule

      public void assertRule(Term head, List<Term> body)
      Specified by:
      assertRule in interface Prover
      Parameters:
      head -
      body -
    • getRules

      public List<org.apache.commons.lang3.tuple.Pair<Term,List<Term>>> getRules()
    • retractRule

      public void retractRule(Term head, List<Term> body)
      Description copied from interface: Prover
      remove the specified rule
      Specified by:
      retractRule in interface Prover
    • initializeFromFiles

      public void initializeFromFiles(List<String> files) throws IOException
      initialize the knowledge base from a file
      Specified by:
      initializeFromFiles in interface Prover
      Throws:
      IOException
    • getTheory

      public String getTheory()
      Get the theory representation as a string in target language format. Returned string depends on prover implementation.
      Specified by:
      getTheory in interface Prover
      Returns:
      internal theory representation
    • getInternalTheory

      public Object getInternalTheory()
      Get the theory representation in its source format
      Specified by:
      getInternalTheory in interface Prover
      Returns:
      internal theory representation
    • setTheory

      public boolean setTheory(String theory)
      Set the theory (aka beliefs aka assumptions).
      Specified by:
      setTheory in interface Prover
      Returns:
      true if theory was set successfully
    • queryString

      public List<Map<Variable,Symbol>> queryString(String query)
    • queryBelief

      public Boolean queryBelief(String query)
    • assertBelief

      public void assertBelief(String belief)
      Description copied from interface: Prover
      Assert belief to prover.
      Specified by:
      assertBelief in interface Prover
    • retractBelief

      public void retractBelief(String belief)
      Description copied from interface: Prover
      Retract belief from prover.
      Specified by:
      retractBelief in interface Prover
    • assertRule

      public void assertRule(String belief)
      Description copied from interface: Prover
      Add rule to prover.
      Specified by:
      assertRule in interface Prover
    • retractRule

      public void retractRule(String belief)
      Description copied from interface: Prover
      Retract rule from prover.
      Specified by:
      retractRule in interface Prover
    • sanitize

      public String sanitize(Term term)
      Description copied from interface: Prover
      Convert DIARC FOL Term to appropriate prover syntax. TODO: consolidate all code related to converting FOL to/from Prover and replace this method with two new methods (1) convertToProverForm and (2) convertToDiarcForm
      Specified by:
      sanitize in interface Prover
      Returns: