Examples of AtomicSentence


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

    if (renameSubstitution.size() > 0) {
      List<Literal> lits = new ArrayList<Literal>();

      for (Literal l : chain.getLiterals()) {
        AtomicSentence atom = (AtomicSentence) substVisitor.subst(
            renameSubstitution, l.getAtomicSentence());
        lits.add(l.newInstance(atom));
      }

      Chain renamed = new Chain(lits);
View Full Code Here

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

              // I have a cancellation
              // Need to apply subst to all of the
              // literals in the cancellation
              List<Literal> cancLits = new ArrayList<Literal>();
              for (Literal lfc : c.getTail()) {
                AtomicSentence a = (AtomicSentence) substVisitor
                    .subst(subst, lfc.getAtomicSentence());
                cancLits.add(lfc.newInstance(a));
              }
              Chain cancellation = new Chain(cancLits);
              cancellation
View Full Code Here

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

      candidateHeads = negHeads;
    } else {
      candidateHeads = posHeads;
    }

    AtomicSentence nearAtom = nearLiteral.getAtomicSentence();
    String nearestKey = nearAtom.getSymbolicName();
    List<Chain> farParents = candidateHeads.get(nearestKey);
    if (null != farParents) {
      Chain farParent = farParents.get(farParentIndex);
      standardizeApart(farParent);
      Literal farLiteral = farParent.getHead();
      AtomicSentence farAtom = farLiteral.getAtomicSentence();
      Map<Variable, Term> subst = unifier.unify(nearAtom, farAtom);

      // If I was able to unify with one
      // of the far heads
      if (null != subst) {
        // Want to always apply reduction uniformly
        Chain topChain = farParent;
        Literal botLit = nearLiteral;
        Chain botChain = nearParent;

        // Need to apply subst to all of the
        // literals in the reduction
        List<Literal> reduction = new ArrayList<Literal>();
        for (Literal l : topChain.getTail()) {
          AtomicSentence atom = (AtomicSentence) substVisitor.subst(
              subst, l.getAtomicSentence());
          reduction.add(l.newInstance(atom));
        }
        reduction.add(new ReducedLiteral((AtomicSentence) substVisitor
            .subst(subst, botLit.getAtomicSentence()), botLit
            .isNegativeLiteral()));
        for (Literal l : botChain.getTail()) {
          AtomicSentence atom = (AtomicSentence) substVisitor.subst(
              subst, l.getAtomicSentence());
          reduction.add(l.newInstance(atom));
        }

        nnpc = new Chain(reduction);
View Full Code Here

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

  public Clause apply(TermEquality assertion, Clause clExpression) {
    Clause altClExpression = null;

    for (Literal l1 : clExpression.getLiterals()) {
      AtomicSentence altExpression = apply(assertion,
          l1.getAtomicSentence());
      if (null != altExpression) {
        // I have an alternative, create a new clause
        // with the alternative and return
        List<Literal> newLits = new ArrayList<Literal>();
View Full Code Here

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

    return altClExpression;
  }

  public AtomicSentence apply(TermEquality assertion,
      AtomicSentence expression) {
    AtomicSentence altExpression = null;

    IdentifyCandidateMatchingTerm icm = getMatchingSubstitution(
        assertion.getTerm1(), expression);

    if (null != icm) {
View Full Code Here

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

              // I have a cancellation
              // Need to apply subst to all of the
              // literals in the cancellation
              List<Literal> cancLits = new ArrayList<Literal>();
              for (Literal lfc : c.getTail()) {
                AtomicSentence a = (AtomicSentence) substVisitor
                    .subst(subst, lfc.getAtomicSentence());
                cancLits.add(lfc.newInstance(a));
              }
              Chain cancellation = new Chain(cancLits);
              cancellation
View Full Code Here

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

      candidateHeads = negHeads;
    } else {
      candidateHeads = posHeads;
    }

    AtomicSentence nearAtom = nearLiteral.getAtomicSentence();
    String nearestKey = nearAtom.getSymbolicName();
    List<Chain> farParents = candidateHeads.get(nearestKey);
    if (null != farParents) {
      Chain farParent = farParents.get(farParentIndex);
      standardizeApart(farParent);
      Literal farLiteral = farParent.getHead();
      AtomicSentence farAtom = farLiteral.getAtomicSentence();
      Map<Variable, Term> subst = unifier.unify(nearAtom, farAtom);

      // If I was able to unify with one
      // of the far heads
      if (null != subst) {
        // Want to always apply reduction uniformly
        Chain topChain = farParent;
        Literal botLit = nearLiteral;
        Chain botChain = nearParent;

        // Need to apply subst to all of the
        // literals in the reduction
        List<Literal> reduction = new ArrayList<Literal>();
        for (Literal l : topChain.getTail()) {
          AtomicSentence atom = (AtomicSentence) substVisitor.subst(
              subst, l.getAtomicSentence());
          reduction.add(l.newInstance(atom));
        }
        reduction.add(new ReducedLiteral((AtomicSentence) substVisitor
            .subst(subst, botLit.getAtomicSentence()), botLit
            .isNegativeLiteral()));
        for (Literal l : botChain.getTail()) {
          AtomicSentence atom = (AtomicSentence) substVisitor.subst(
              subst, l.getAtomicSentence());
          reduction.add(l.newInstance(atom));
        }

        nnpc = new Chain(reduction);
View Full Code Here

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

    domain.addFunction("F");

    FOLParser parser = new FOLParser(domain);

    List<Literal> lits = new ArrayList<Literal>();
    AtomicSentence a1 = (AtomicSentence) parser.parse("P(F(x,B),x)");
    AtomicSentence a2 = (AtomicSentence) parser.parse("Q(x)");
    lits.add(new Literal(a1));
    lits.add(new Literal(a2));

    Clause c1 = new Clause(lits);
View Full Code Here

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

    domain.addFunction("F");

    FOLParser parser = new FOLParser(domain);

    List<Literal> lits = new ArrayList<Literal>();
    AtomicSentence a1 = (AtomicSentence) parser.parse("F(C,x) = D");
    AtomicSentence a2 = (AtomicSentence) parser.parse("A = D");
    AtomicSentence a3 = (AtomicSentence) parser.parse("P(F(x,B),x)");
    AtomicSentence a4 = (AtomicSentence) parser.parse("Q(x)");
    AtomicSentence a5 = (AtomicSentence) parser.parse("R(C)");
    lits.add(new Literal(a1));
    lits.add(new Literal(a2));
    lits.add(new Literal(a3));
    lits.add(new Literal(a4));
    lits.add(new Literal(a5));
View Full Code Here

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

    domain.addFunction("F");

    FOLParser parser = new FOLParser(domain);

    List<Literal> lits = new ArrayList<Literal>();
    AtomicSentence a1 = (AtomicSentence) parser.parse("P(y, F(A,y))");
    lits.add(new Literal(a1));

    Clause c1 = new Clause(lits);

    lits.clear();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.