Class QueryPlan
A single QueryPlan can be used to create multiple QueryStatement objects. If you are intending to
execute the same query multiple times then, for performance reasons, it is recommended to use a QueryPlan
rather than create multiple QueryStatement directly. When using a QueryPlan the Prolog syntax will
only be parsed once and the plan for executing the query will be optimised for performance.
-
Method Summary
Modifier and TypeMethodDescriptionReturn a newly createdQueryStatementfor the query represented by this plan.voidEvaluate once the query represented by this statement.Return a newly createdQueryResultfor the query represented by this plan.doublelong
-
Method Details
-
createStatement
Return a newly createdQueryStatementfor the query represented by this plan.Before the query is executed, values can be assigned to variables in the query by using
QueryStatement.setTerm(String, Term). The query can be executed by callingQueryStatement.executeQuery().Note: If you do not intend to assign terms to variables then
executeQuery()can be called instead.- See Also:
-
executeQuery
Return a newly createdQueryResultfor the query represented by this plan.The
QueryResult.next()andQueryResult.getTerm(String)methods can be used to evaluate the query and access values unified to the variables of the query.- See Also:
-
executeOnce
public void executeOnce()Evaluate once the query represented by this statement.The query will only be evaluated once, even if further solutions could of been found on backtracking.
- Throws:
ProjogException- if no solution can be found- See Also:
-
findFirstAsAtomName
-
findFirstAsDouble
public double findFirstAsDouble() -
findFirstAsLong
public long findFirstAsLong() -
findFirstAsTerm
-
findFirstAsOptionalAtomName
-
findFirstAsOptionalDouble
-
findFirstAsOptionalLong
-
findFirstAsOptionalTerm
-
findAllAsAtomName
-
findAllAsDouble
-
findAllAsLong
-
findAllAsTerm
-