|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tm4j.tolog.QueryEvaluator
Nested Class Summary | |
protected class |
QueryEvaluator.ExpansionInfo
Deprecated. |
protected class |
QueryEvaluator.ListTable
Deprecated. |
Constructor Summary | |
QueryEvaluator(TopicMap tm)
Deprecated. Creates a new QueryEvaluator to evaluate Tolog queries over the topic map tm |
Method Summary | |
void |
addRule(java.lang.String ruleString)
Deprecated. |
protected void |
addRules(org.tm4j.tolog.parser.ASTScript script)
Deprecated. |
protected void |
dumpMatches(java.util.List matches)
Deprecated. |
protected void |
dumpVars(java.util.Hashtable vars,
java.lang.String prefix)
Deprecated. |
TologResultsSet |
evaluate(java.lang.String queryString)
Deprecated. Performs the evaluation of the query queryString . |
protected QueryEvaluator.ExpansionInfo |
expand(org.tm4j.tolog.parser.ASTClause clause)
Deprecated. |
protected org.tm4j.tolog.parser.ASTClauseList |
expand(org.tm4j.tolog.parser.ASTClauseList clauseList)
Deprecated. |
protected java.lang.String |
getExpandPrefix()
Deprecated. |
protected void |
getMatches(org.tm4j.tolog.parser.ASTAlternates alternates,
java.util.Hashtable vars,
java.util.List matches)
Deprecated. Processes the alternatives construct represented by alt using the
variable binding specified by vars . |
protected void |
getMatches(org.tm4j.tolog.parser.ASTClauseList clauseList,
java.util.List matches)
Deprecated. |
protected boolean |
getMatches(org.tm4j.tolog.parser.ASTParameterList params,
java.util.List prPairs,
java.util.Hashtable vars,
java.util.List matches)
Deprecated. |
protected void |
getMatches(java.util.List clauses,
int clauseIx,
java.util.Hashtable vars,
java.util.List matches)
Deprecated. |
protected boolean |
getMatches(java.util.List params,
int paramIx,
java.util.List prPairs,
java.util.Hashtable vars,
java.util.List matches)
Deprecated. |
protected java.util.List |
getPlayerRolePairs(Association a)
Deprecated. |
protected boolean |
invokeExtension(java.lang.Class extCls,
org.tm4j.tolog.parser.ASTParameterList params,
java.util.Hashtable vars,
java.util.List matches)
Deprecated. |
protected boolean |
invokeExtensionTest(java.lang.Class extCls,
org.tm4j.tolog.parser.ASTParameterList params,
java.util.Hashtable vars)
Deprecated. Invokes the extension class extCls to test the
extension predicate under the set of bound variables specified
in vars |
void |
loadRules(java.lang.String fileName)
Deprecated. |
protected java.util.List |
optimiseClauseList(org.tm4j.tolog.parser.ASTClauseList clauseList)
Deprecated. Optimises the contents of the clause list. |
protected java.util.List |
optimiseParams(org.tm4j.tolog.parser.ASTParameterList params,
java.util.Hashtable vars)
Deprecated. Alters the ordering of params so that
all facts (parameters with no variables) occur at the
start of the list. |
protected void |
populateReplacementVariablesFromExpandedClause(org.tm4j.tolog.parser.ASTParameterList params,
org.tm4j.tolog.parser.ASTClause repHead,
java.lang.String repPrefix,
java.util.Map replacementVars)
Deprecated. Processes the specified clause to map any bound variables in the clause to the new replacement variable name. |
protected org.tm4j.tolog.TologResultsSetImpl |
projectAllResults(java.util.List results)
Deprecated. Creates a results set in which all variables in the original query are mapped to columns in the results set. |
protected org.tm4j.tolog.TologResultsSetImpl |
projectResults(java.util.List results,
org.tm4j.tolog.parser.ASTProjection projection)
Deprecated. |
protected void |
pruneInternal(java.util.List matches)
Deprecated. |
void |
registerExtension(java.lang.String predicate,
java.lang.Class implCls)
Deprecated. Registers a new extension predicate with the query engine. |
void |
setSortComparator(java.util.Comparator comp)
Deprecated. Registers a sort order comparator with the query engine. |
protected static java.lang.String |
shortAddress(Topic t)
Deprecated. |
protected void |
sortResults(org.tm4j.tolog.TologResultsSetImpl results,
org.tm4j.tolog.parser.ASTSort sort)
Deprecated. |
protected boolean |
test(org.tm4j.tolog.parser.ASTClause clause,
java.util.Hashtable vars)
Deprecated. |
protected boolean |
testMatches(org.tm4j.tolog.parser.ASTParameterList params,
java.util.List prPairs,
java.util.Hashtable vars)
Deprecated. Tests the parameters in params against the bound variables in vars. |
protected void |
testMatches(java.util.List clauses,
int clauseIx,
java.util.Hashtable vars,
java.util.List matches)
Deprecated. Implementation of not() processing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public QueryEvaluator(TopicMap tm) throws IndexManagerException, IndexException
tm
tm
- The topic map to be queried.
IndexManagerException
- If a problem was encountered in retrieving the
AssociationTypesIndex
of tm
IndexException
- If a problem was encountered while opening
the AssociationTypesIndex
of tm
Method Detail |
protected java.lang.String getExpandPrefix()
public void registerExtension(java.lang.String predicate, java.lang.Class implCls) throws java.lang.IllegalArgumentException
Extension
inteface.
predicate
- The predicate which the extension implements.implCls
- The class providing the implementation. This class must
implement the Extension interface.
java.lang.IllegalArgumentException
- If implCls is not a class
implementing the Extension interface.
public void setSortComparator(java.util.Comparator comp)
comp
will be used to determine the sort
order of results for queries which include an "order by" clause.
public TologResultsSet evaluate(java.lang.String queryString) throws TologParserException, TologEvaluationException
queryString
.
queryString
- The tolog query to be evaluated.
TologResultsSet
for the query evaluation
TologParserException
- if the query is not syntactically correct.
TologEvaluationException
- if the query is syntactically correct
but cannot be evaluated for some other reason.protected org.tm4j.tolog.TologResultsSetImpl projectAllResults(java.util.List results)
results
- The list of matches to be processed into a results set
protected org.tm4j.tolog.TologResultsSetImpl projectResults(java.util.List results, org.tm4j.tolog.parser.ASTProjection projection)
protected void sortResults(org.tm4j.tolog.TologResultsSetImpl results, org.tm4j.tolog.parser.ASTSort sort)
protected void pruneInternal(java.util.List matches)
protected void getMatches(org.tm4j.tolog.parser.ASTClauseList clauseList, java.util.List matches) throws TologEvaluationException
TologEvaluationException
protected org.tm4j.tolog.parser.ASTClauseList expand(org.tm4j.tolog.parser.ASTClauseList clauseList)
protected QueryEvaluator.ExpansionInfo expand(org.tm4j.tolog.parser.ASTClause clause)
protected void populateReplacementVariablesFromExpandedClause(org.tm4j.tolog.parser.ASTParameterList params, org.tm4j.tolog.parser.ASTClause repHead, java.lang.String repPrefix, java.util.Map replacementVars)
params
- the parameter list from the clause being expandedrepHead
- the head clause of the replacement expansionrepPrefix
- the prefix used to generate a replacement variable name from an existing variable namereplacementVars
- the replacement variable map - this is updated in-place by this method.protected java.util.List optimiseClauseList(org.tm4j.tolog.parser.ASTClauseList clauseList)
protected void getMatches(java.util.List clauses, int clauseIx, java.util.Hashtable vars, java.util.List matches) throws TologEvaluationException
TologEvaluationException
protected void getMatches(org.tm4j.tolog.parser.ASTAlternates alternates, java.util.Hashtable vars, java.util.List matches) throws TologEvaluationException
alt
using the
variable binding specified by vars
. Each alternate clause list
in alternates
is processed inidividually and all of the matches
added to the output variable matches
TologEvaluationException
protected void testMatches(java.util.List clauses, int clauseIx, java.util.Hashtable vars, java.util.List matches) throws TologEvaluationException
TologEvaluationException
protected boolean test(org.tm4j.tolog.parser.ASTClause clause, java.util.Hashtable vars) throws TologEvaluationException
TologEvaluationException
protected void dumpMatches(java.util.List matches)
protected void dumpVars(java.util.Hashtable vars, java.lang.String prefix)
protected boolean getMatches(org.tm4j.tolog.parser.ASTParameterList params, java.util.List prPairs, java.util.Hashtable vars, java.util.List matches) throws TologEvaluationException
TologEvaluationException
protected boolean getMatches(java.util.List params, int paramIx, java.util.List prPairs, java.util.Hashtable vars, java.util.List matches)
protected boolean testMatches(org.tm4j.tolog.parser.ASTParameterList params, java.util.List prPairs, java.util.Hashtable vars) throws TologEvaluationException
TologEvaluationException
protected java.util.List optimiseParams(org.tm4j.tolog.parser.ASTParameterList params, java.util.Hashtable vars) throws TologEvaluationException
params
so that
all facts (parameters with no variables) occur at the
start of the list.
This method also replaces any variables with the assumed
value specified in vars.
params
- The ASTParameterList of the parsed queryvars
- The assumed values for the variables so far
TologEvaluationException
protected java.util.List getPlayerRolePairs(Association a)
protected static java.lang.String shortAddress(Topic t)
public void addRule(java.lang.String ruleString) throws org.tm4j.tolog.parser.ParseException
org.tm4j.tolog.parser.ParseException
public void loadRules(java.lang.String fileName) throws java.io.FileNotFoundException, TologParserException
java.io.FileNotFoundException
TologParserException
protected void addRules(org.tm4j.tolog.parser.ASTScript script)
protected boolean invokeExtension(java.lang.Class extCls, org.tm4j.tolog.parser.ASTParameterList params, java.util.Hashtable vars, java.util.List matches) throws TologEvaluationException
TologEvaluationException
protected boolean invokeExtensionTest(java.lang.Class extCls, org.tm4j.tolog.parser.ASTParameterList params, java.util.Hashtable vars) throws TologEvaluationException
extCls
to test the
extension predicate under the set of bound variables specified
in vars
vars
, false otherwise
TologEvaluationException
- If one or more variables in
params
are not bound under vars
, or
if the extension class can not be instantiated.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |