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

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


    domain.addFunction("H");
    domain.addFunction("J");

    FOLParser parser = new FOLParser(domain);

    Predicate expression = (Predicate) parser
        .parse("P(A,F(B,G(A,H(B)),C),D)");
    TermEquality assertion = (TermEquality) parser.parse("B = E");

    Predicate altExpression = (Predicate) demodulation.apply(assertion,
        expression);

    Assert.assertFalse(expression.equals(altExpression));
    Assert.assertEquals("P(A,F(E,G(A,H(B)),C),D)", altExpression.toString());

    altExpression = (Predicate) demodulation
        .apply(assertion, altExpression);

    Assert.assertEquals("P(A,F(E,G(A,H(E)),C),D)", altExpression.toString());

    assertion = (TermEquality) parser.parse("G(x,y) = J(x)");

    altExpression = (Predicate) demodulation.apply(assertion, expression);

    Assert.assertEquals("P(A,F(B,J(A),C),D)", altExpression.toString());
  }
View Full Code Here


    for (Variable v : vars) {
      // Ensure copies of the variables are used.
      terms.add(v.copy());
    }

    return new Literal(new Predicate(alName, terms));
  }
View Full Code Here

    terms.add(new Variable("v0"));

    Clause dcRule = weaponsKB.getAllDefiniteClauseImplications().get(0);
    Assert.assertNotNull(dcRule);
    Assert.assertEquals(true, dcRule.isImplicationDefiniteClause());
    Assert.assertEquals(new Literal(new Predicate("Criminal", terms)),
        dcRule.getPositiveLiterals().get(0));
  }
View Full Code Here

    for (int i = 0; i < terms.size(); i++) {
      Term t = terms.get(i);
      Term subsTerm = (Term) t.accept(this, arg);
      newTerms.add(subsTerm);
    }
    return new Predicate(predicate.getPredicateName(), newTerms);

  }
View Full Code Here

  public Sentence parsePredicate() {
    Token t = lookAhead(1);
    String predicateName = t.getText();
    List<Term> terms = processTerms();
    return new Predicate(predicateName, terms);
  }
View Full Code Here

TOP

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

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.