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

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


    Assert.assertFalse(answer.isUnknownDueToTimeout());
    Assert.assertFalse(answer.isPartialResultDueToTimeout());
    Assert.assertTrue(1 == answer.getProofs().size());
    Assert.assertTrue(1 == answer.getProofs().get(0).getAnswerBindings()
        .size());
    Assert.assertEquals(new Constant("West"), answer.getProofs().get(0)
        .getAnswerBindings().get(new Variable("x")));
  }
View Full Code Here


        .size());
    Assert.assertEquals(1, answer.getProofs().get(3).getAnswerBindings()
        .size());

    List<Constant> expected = new ArrayList<Constant>();
    expected.add(new Constant("Nancy"));
    expected.add(new Constant("Red"));
    expected.add(new Constant("Bert"));
    expected.add(new Constant("Drew"));
    for (Proof p : answer.getProofs()) {
      expected.remove(p.getAnswerBindings().get(new Variable("x")));
    }
    Assert.assertEquals(0, expected.size());
  }
View Full Code Here

  protected void testFullFOLKBLovesAnimalQueryKillsCuriosityTunaSucceeds(
      InferenceProcedure infp, boolean expectedToTimeOut) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createLovesAnimalKnowledgeBase(infp);
    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("Curiosity"));
    terms.add(new Constant("Tuna"));
    Predicate query = new Predicate("Kills", terms);

    InferenceResult answer = akb.ask(query);
    Assert.assertTrue(null != answer);
    if (expectedToTimeOut) {
View Full Code Here

  protected void testFullFOLKBLovesAnimalQueryNotKillsJackTunaSucceeds(
      InferenceProcedure infp, boolean expectedToTimeOut) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createLovesAnimalKnowledgeBase(infp);
    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("Jack"));
    terms.add(new Constant("Tuna"));
    NotSentence query = new NotSentence(new Predicate("Kills", terms));

    InferenceResult answer = akb.ask(query);

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

  protected void testFullFOLKBLovesAnimalQueryKillsJackTunaFalse(
      InferenceProcedure infp, boolean expectedToTimeOut) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createLovesAnimalKnowledgeBase(infp);
    List<Term> terms = new ArrayList<Term>();
    terms.add(new Constant("Jack"));
    terms.add(new Constant("Tuna"));
    Predicate query = new Predicate("Kills", terms);

    InferenceResult answer = akb.ask(query);

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

  protected void testEqualityAxiomsKBabcAEqualsCSucceeds(
      InferenceProcedure infp) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCEqualityKnowledgeBase(infp, true);

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

    InferenceResult answer = akb.ask(query);

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

      InferenceProcedure infp) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCDEqualityAndSubstitutionKnowledgeBase(infp, true);

    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);
    Assert.assertFalse(answer.isPossiblyFalse());
View Full Code Here

      InferenceProcedure infp) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCDEqualityAndSubstitutionKnowledgeBase(infp, true);

    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 expectedToTimeOut) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCDEqualityAndSubstitutionKnowledgeBase(infp, true);

    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

  protected void testEqualityNoAxiomsKBabcAEqualsCSucceeds(
      InferenceProcedure infp, boolean expectedToFail) {
    FOLKnowledgeBase akb = FOLKnowledgeBaseFactory
        .createABCEqualityKnowledgeBase(infp, false);

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

    InferenceResult answer = akb.ask(query);

    Assert.assertTrue(null != answer);
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.