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

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


    }

    // Ensure reflexivity axiom is added to usable if using paramodulation.
    if (isUseParamodulation()) {
      // Reflexivity Axiom: x = x
      TermEquality reflexivityAxiom = new TermEquality(new Variable("x"),
          new Variable("x"));
      Clause reflexivityClause = new Clause();
      reflexivityClause.addLiteral(new Literal(reflexivityAxiom));
      reflexivityClause = KB.standardizeApart(reflexivityClause);
      reflexivityClause.setStandardizedApartCheckNotRequired();
      usable.add(reflexivityClause);
View Full Code Here


    List<Variable> replVariables = new ArrayList<Variable>();
    for (Variable v : sentence.getVariables()) {
      // If local variable has be renamed already
      // then I need to come up with own name
      if (seenSoFar.contains(v)) {
        Variable sV = new Variable(quantifiedIndexical.getPrefix()
            + quantifiedIndexical.getNextIndex());
        localSubst.put(v, sV);
        // Replacement variables should contain new name for variable
        replVariables.add(sV);
      } else {
View Full Code Here

        .collectAllVariables(sentence);
    Map<Variable, Term> renameSubstitution = new HashMap<Variable, Term>();
    Map<Variable, Term> reverseSubstitution = new HashMap<Variable, Term>();

    for (Variable var : toRename) {
      Variable v = null;
      do {
        v = new Variable(standardizeApartIndexical.getPrefix()
            + standardizeApartIndexical.getNextIndex());
        // Ensure the new variable name is not already
        // accidentally used in the sentence
      } while (toRename.contains(v));
View Full Code Here

    Set<Variable> toRename = variableCollector.collectAllVariables(clause);
    Map<Variable, Term> renameSubstitution = new HashMap<Variable, Term>();

    for (Variable var : toRename) {
      Variable v = null;
      do {
        v = new Variable(standardizeApartIndexical.getPrefix()
            + standardizeApartIndexical.getNextIndex());
        // Ensure the new variable name is not already
        // accidentally used in the sentence
      } while (toRename.contains(v));
View Full Code Here

    Set<Variable> toRename = variableCollector.collectAllVariables(chain);
    Map<Variable, Term> renameSubstitution = new HashMap<Variable, Term>();

    for (Variable var : toRename) {
      Variable v = null;
      do {
        v = new Variable(standardizeApartIndexical.getPrefix()
            + standardizeApartIndexical.getNextIndex());
        // Ensure the new variable name is not already
        // accidentally used in the sentence
      } while (toRename.contains(v));
View Full Code Here

    }

    Map<Variable, Term> renameSubstitution = new HashMap<Variable, Term>();

    for (Variable var : toRename) {
      Variable v = null;
      do {
        v = new Variable(standardizeApartIndexical.getPrefix()
            + standardizeApartIndexical.getNextIndex());
        // Ensure the new variable name is not already
        // accidentally used in the sentence
      } while (toRename.contains(v));
View Full Code Here

  @Test
  public void testParseSimpleVariable() {
    parser.setUpToParse("x");
    Term v = parser.parseVariable();
    Assert.assertEquals(v, new Variable("x"));
  }
View Full Code Here

  @Test
  public void testParseIndexedVariable() {
    parser.setUpToParse("x1");
    Term v = parser.parseVariable();
    Assert.assertEquals(v, new Variable("x1"));
  }
View Full Code Here

  public void testTermEquality2() {
    try {
      TermEquality te = (TermEquality) parser
          .parse("BrotherOf(John) = x)");
      Assert.assertEquals(te, new TermEquality(
          getBrotherOfFunction(new Constant("John")), new Variable(
              "x")));
    } catch (RuntimeException e) {
      Assert.fail("RuntimeException thrown");
    }
  }
View Full Code Here

  @Test
  public void testQuantifiedSentenceWithSingleVariable() {
    Sentence qs = parser.parse("FORALL x  King(x)");
    List<Variable> vars = new ArrayList<Variable>();
    vars.add(new Variable("x"));
    Assert.assertEquals(qs, new QuantifiedSentence("FORALL", vars,
        getKingPredicate(new Variable("x"))));
  }
View Full Code Here

TOP

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

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.