/** {@inheritDoc} */ public String toString(VariableAndFunctorInterner interner, boolean printVarName, boolean printBindings) { String result = ""; if (head != null) { result += head.toString(interner, printVarName, printBindings); } if (body != null) { result += isQuery() ? "?- " : " :- "; for (int i = 0; i < body.length; i++) { result += body[i].toString(interner, printVarName, printBindings) + ((i < (body.length - 1)) ? ", " : ""); } } return result; } }
/** {@inheritDoc} */ public String toString(VariableAndFunctorInterner interner, boolean printVarName, boolean printBindings) { String result = ""; if (head != null) { result += head.toString(interner, printVarName, printBindings); } if (body != null) { result += isQuery() ? "?- " : " :- "; for (int i = 0; i < body.length; i++) { result += body[i].toString(interner, printVarName, printBindings) + ((i < (body.length - 1)) ? ", " : ""); } } return result; } }
if (clause.isQuery())
/** {@inheritDoc} */ public void compile(Sentence<Clause> sentence) throws SourceCodeException { Clause clause = sentence.getT(); substituteBuiltIns(clause); initialiseSymbolTable(clause); topLevelCheck(clause); if (observer != null) { if (clause.isQuery()) { observer.onQueryCompilation(sentence); } else { observer.onCompilation(sentence); } } }
int clauseIndex; if (clause.isQuery())
int clauseIndex; if (clause.isQuery())
/** * Evaluates a query against the resolver or adds a clause to the resolvers domain. * * @param sentence The clausal sentence to run as a query or as a clause to add to the domain. * * @throws SourceCodeException If the query or domain clause fails to compile or link into the resolver. */ private void evaluate(Sentence<Clause> sentence) throws SourceCodeException { Clause clause = sentence.getT(); if (clause.isQuery()) { engine.endScope(); engine.compile(sentence); evaluateQuery(); } else { // Check if the program clause is new, or a continuation of the current predicate. int name = clause.getHead().getName(); if ((currentPredicateName == null) || (currentPredicateName != name)) { engine.endScope(); currentPredicateName = name; } addProgramClause(sentence); } }