Package aima.core.logic.fol.kb.data

Examples of aima.core.logic.fol.kb.data.Literal


  // Note: To support FOL-FC-Ask
  public Set<Map<Variable, Term>> fetch(List<Literal> literals) {
    Set<Map<Variable, Term>> possibleSubstitutions = new LinkedHashSet<Map<Variable, Term>>();

    if (literals.size() > 0) {
      Literal first = literals.get(0);
      List<Literal> rest = literals.subList(1, literals.size());

      recursiveFetch(new LinkedHashMap<Variable, Term>(), first, rest,
          possibleSubstitutions);
    }
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

        // This means I am at the end of the chain of predicates
        // and have found a valid substitution.
        possibleSubstitutions.add(psubst);
      } else {
        // Need to move to the next link in the chain of substitutions
        Literal first = remainingLiterals.get(0);
        List<Literal> rest = remainingLiterals.subList(1,
            remainingLiterals.size());

        recursiveFetch(psubst, first, rest, possibleSubstitutions);
      }
View Full Code Here

      clauses.addAll(c.getFactors());
    }
    Sentence notAlpha = new NotSentence(alpha);
    // Want to use an answer literal to pull
    // query variables where necessary
    Literal answerLiteral = KB.createAnswerLiteral(notAlpha);
    Set<Variable> answerLiteralVariables = KB
        .collectAllVariables(answerLiteral.getAtomicSentence());
    Clause answerClause = new Clause();

    if (answerLiteralVariables.size() > 0) {
      Sentence notAlphaWithAnswer = new ConnectedSentence(Connectors.OR,
          notAlpha, answerLiteral.getAtomicSentence());
      for (Clause c : KB.convertToClauses(notAlphaWithAnswer)) {
        c = KB.standardizeApart(c);
        c.setProofStep(new ProofStepGoal(c));
        c.setStandardizedApartCheckNotRequired();
        clauses.addAll(c.getFactors());
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

TOP

Related Classes of aima.core.logic.fol.kb.data.Literal

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.