Clause clause = sentence.getT();
/** {@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); } } }
/** * 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); } }
Clause clause = clauseSentence.getT(); PrologCompiledClause result = new PrologCompiledClause(clause.getHead(), clause.getBody());