|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the high-level interface to the tolog 1.0 query engine. Using this interface you can initialise the evaluator by loading one or more rules module files or by adding rules as strings. This class also supports the registration of extension predicates.
Method Summary | |
void |
addRule(java.lang.String rule)
Adds a new rule to the QueryEvaluator. |
void |
addRulesModule(java.io.InputStream src,
java.lang.String prefix)
Loads a rules module from the specified stream. |
TologResultsSet |
execute(java.lang.String queryString)
A convenience method that parses and optimizes the specified tolog query and then executes it immediately. |
TologResultsSet |
execute(java.lang.String queryString,
java.lang.Object[] queryParams)
A convenience method that parses and optimizes the specified tolog query and then executes it immediately. |
java.util.Map |
getRegisteredPredicates()
Returns a Map of the predicates currently registered with the QueryEvaluator. |
PreparedQuery |
prepareQuery(java.lang.String queryString)
Parses (and possibly optimizes) the specified tolog query string. |
void |
registerPredicateClass(java.lang.String predicateName,
java.lang.Class predicateClass)
Registers an extension predicate with the QueryEvaluator. |
Method Detail |
public void addRulesModule(java.io.InputStream src, java.lang.String prefix) throws java.io.IOException, TologParserException
src
- the input stream to be parsed
java.io.IOException
- if the module file could not be read.
TologParserException
- if the module file could be
read but contained syntax errors.public void addRule(java.lang.String rule) throws TologParserException
rule
- the rule string in tolog syntax
TologParserException
- if there is a syntax error in the rule string.public PreparedQuery prepareQuery(java.lang.String queryString) throws TologParserException, TologProcessingException
queryString
- the tolog query string to be parsed.
TologParserException
- if a syntax error or parse-time error is found in queryString
TologProcessingException
- if an error occurs during optimisation of the query.public TologResultsSet execute(java.lang.String queryString) throws TologParserException, TologProcessingException
queryString
- the tolog query string to be evaluated
TologParserException
- if a syntax error or parse-time error is found in queryString
TologProcessingException
- if an error occurrs during the optimisation or evaluation of the query.public TologResultsSet execute(java.lang.String queryString, java.lang.Object[] queryParams) throws TologParserException, TologProcessingException
queryString
- the tolog query string to be evaluatedqueryParams
- the replacement values for % references in the query string
TologParserException
- if a syntax error or parse-time error is found in queryString
TologProcessingException
- if an error occurrs during the optimisation or evaluation of the query.public void registerPredicateClass(java.lang.String predicateName, java.lang.Class predicateClass) throws java.lang.IllegalArgumentException
Predicate
interface.
If predicateName
is the name of an already registered predicate,
then the new registration overwrites the old one.
predicateName
- the name to be used to reference the predicate from a tolog query.predicateClass
- the implementation class for the predicate.
java.lang.IllegalArgumentException
- if the specified implementation class does not implement the Predicate interface.public java.util.Map getRegisteredPredicates()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |