Package aima.core.logic.fol.parsing.ast

Examples of aima.core.logic.fol.parsing.ast.Constant


      InferenceProcedure infp, boolean expectedToFail) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCDEqualityAndSubstitutionKnowledgeBase(infp, false);

    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("A"));
    Function fa = new Function("F", terms);
    terms = new ArrayList<Term>();
    terms.add(fa);
    TermEquality query = new TermEquality(new Function("F", terms),
        new Constant("A"));

    InferenceResult answer = akb.ask(query);

    Assert.assertTrue(null != answer);
    if (expectedToFail) {
View Full Code Here


      InferenceProcedure infp, boolean expectedToFail) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCDEqualityAndSubstitutionKnowledgeBase(infp, false);

    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("D"));
    Predicate query = new Predicate("P", terms);

    InferenceResult answer = akb.ask(query);

    Assert.assertTrue(null != answer);
View Full Code Here

      InferenceProcedure infp, boolean expectedToFail) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCDEqualityAndSubstitutionKnowledgeBase(infp, false);

    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("A"));
    Function fa = new Function("F", terms);
    terms = new ArrayList<Term>();
    terms.add(fa);
    Function ffa = new Function("F", terms);
    terms = new ArrayList<Term>();
View Full Code Here

        .createKingsKnowledgeBase(ip);

    String kbStr = kb.toString();

    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("John"));
    Predicate query = new Predicate("Evil", terms);

    InferenceResult answer = kb.ask(query);

    System.out.println("Kings Knowledge Base:");
View Full Code Here

        .createLovesAnimalKnowledgeBase(ip);

    String kbStr = kb.toString();

    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("Curiosity"));
    terms.add(new Constant("Tuna"));
    Predicate query = new Predicate("Kills", terms);

    InferenceResult answer = kb.ask(query);

    System.out.println("Loves Animal Knowledge Base:");
View Full Code Here

    FOLKnowledgeBase kb = FOLKnowledgeBaseFactory
        .createABCEqualityKnowledgeBase(ip, true);

    String kbStr = kb.toString();

    TermEquality query = new TermEquality(new Constant("A"), new Constant(
        "C"));

    InferenceResult answer = kb.ask(query);

    System.out.println("ABC Equality Axiom Knowledge Base:");
View Full Code Here

    FOLKnowledgeBase kb = FOLKnowledgeBaseFactory
        .createABCEqualityKnowledgeBase(ip, false);

    String kbStr = kb.toString();

    TermEquality query = new TermEquality(new Constant("A"), new Constant(
        "C"));

    InferenceResult answer = kb.ask(query);

    System.out.println("ABC Equality No Axiom Knowledge Base:");
View Full Code Here

  }

  @Test
  public void testVariableEqualsConstant() {
    Variable var1 = new Variable("x");
    Constant constant = new Constant("John");

    Map<Variable, Term> result = unifier.unify(var1, constant, theta);
    Assert.assertEquals(theta, result);
    Assert.assertEquals(1, theta.keySet().size());
    Assert.assertTrue(theta.keySet().contains(var1));
View Full Code Here

    List<Term> terms1 = new ArrayList<Term>();
    terms1.add(var1);
    Predicate p1 = new Predicate("King", terms1); // King(x)

    List<Term> terms2 = new ArrayList<Term>();
    terms2.add(new Constant("John"));
    Predicate p2 = new Predicate("King", terms2); // King(John)

    Map<Variable, Term> result = unifier.unify(p1, p2, theta);
    Assert.assertEquals(theta, result);
    Assert.assertEquals(1, theta.keySet().size());
    Assert.assertTrue(theta.keySet().contains(new Variable("x"))); // x =
    Assert.assertEquals(new Constant("John"), theta.get(var1)); // John
  }
View Full Code Here

    Sentence query = parser.parse("Knows(John,x)");
    Sentence johnKnowsJane = parser.parse("Knows(John,Jane)");
    Map<Variable, Term> result = unifier.unify(query, johnKnowsJane, theta);
    Assert.assertEquals(theta, result);
    Assert.assertTrue(theta.keySet().contains(new Variable("x"))); // x =
    Assert.assertEquals(new Constant("Jane"), theta.get(new Variable("x"))); // Jane
  }
View Full Code Here

TOP

Related Classes of aima.core.logic.fol.parsing.ast.Constant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.