|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.ac.ic.doc.rodex.qproc.QueryRewriter
uk.ac.ic.doc.rodex.qproc.MiniConQueryRewriter
public class MiniConQueryRewriter
| Nested Class Summary | |
|---|---|
protected class |
MiniConQueryRewriter.MiniConDescription
A private inner class to represent an MCD |
| Field Summary | |
|---|---|
protected java.util.List |
mcds
|
protected QueryAnalyser |
queryAnalyser
|
protected QueryAnalyser[] |
viewAnalysers
|
| Fields inherited from class uk.ac.ic.doc.rodex.qproc.QueryRewriter |
|---|
_qa, query, views |
| Constructor Summary | |
|---|---|
MiniConQueryRewriter(ASG query,
java.util.List views)
Creates a new instance of MiniConQueryRewriter given only a list of cached views |
|
MiniConQueryRewriter(ASG query,
QueryAnalyser[] viewMetadata)
Creates a new instance of MiniConQueryRewriter given a list of metadata objects of cached views |
|
| Method Summary | |
|---|---|
QueryAnalyser |
analyse()
Implements method in QueryWriter parent class Analyse query and view rules into head vars and sub-goals in order to prepare for the actual rewrite to take place |
protected java.util.Map |
checkComparisonPredicates(QueryAnalyser qa,
MiniConQueryRewriter.MiniConDescription mcd)
keep a mapping b/w pairs of query-view whose predicates have been checked |
protected java.util.Map |
checkConstants(QueryAnalyser qa,
MiniConQueryRewriter.MiniConDescription mcd)
Check if the current MCD support any constants in the query |
protected boolean |
contains(java.util.List goalSet1,
java.util.List goalSet2)
Check if a set of query sub-goals contains another set of sub-goals |
protected java.util.List |
createConjunctiveQueries(java.util.List mcds,
java.util.List qSubGoals)
Create the conjunctive queries from MCDs |
protected java.lang.String |
createQueryFromSubGoals(java.util.List subGoals)
|
protected QuerySubGoal |
getLeastRestrictiveMapping(QuerySubGoal querySubGoal,
java.util.List viewSubGoals)
Check for sub-goal mapping between a query's sub-goal and a view. |
protected java.util.List |
getMinimumCoverage(java.util.List sharedVars,
QueryAnalyser view)
Check that a query contains certain variables in its head and if not it must contains all related sub-goals |
QueryAnalyser |
getQueryAnalyser()
Return query analyser |
protected java.util.List |
getSharedVariables(QuerySubGoal qsg)
Get all shared variables between a query and one of its sub-goal |
protected void |
refineConjunctiveQueries(java.util.List conjQueries,
QueryRewriterResult result)
Refine the conjunctive queries by, for example, removing duplicate views or sub-goals. |
QueryRewriterResult |
rewrite()
Implements method in QueryWriter abstract parent class Rewrite query using views based on the MiniCon algorithm following a two-phase process: |
protected java.util.List |
subtractList(java.util.List srcList,
java.util.List fromList)
|
| Methods inherited from class uk.ac.ic.doc.rodex.qproc.QueryRewriter |
|---|
getQueryRewriterInstance, getQueryRewriterInstance, getQueryRewriterInstance, getQueryRewriterInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected QueryAnalyser queryAnalyser
protected QueryAnalyser[] viewAnalysers
protected java.util.List mcds
| Constructor Detail |
|---|
public MiniConQueryRewriter(ASG query,
java.util.List views)
public MiniConQueryRewriter(ASG query,
QueryAnalyser[] viewMetadata)
| Method Detail |
|---|
public QueryAnalyser analyse()
throws QueryRewriterException,
QueryIntegrityException
QueryWriter parent class
analyse in class QueryRewriterQueryAnalysre object that contains query's metadata
QueryRewriterException
QueryIntegrityExceptionpublic QueryAnalyser getQueryAnalyser()
getQueryAnalyser in class QueryRewriter
public QueryRewriterResult rewrite()
throws QueryRewriterException
QueryWriter abstract parent class Phase 1: For each view we check to see if there is a mapping between any of the query
subgoals and the view's. If a mapping exists and there are shared variables
in the query subgoal which are also in the query's head but not in the view's head,
a further check is carried out to find the mininum set of query sub-goals containing
the shared variables that the view need to cover.
If there are any comparison predicates in the query (e.g. >, <, = etc.) and they
are mutually consistent with those found in a view mentioned above then an MCD can be created
for that view.
Phase 2: Identify disjoint sets of MCDs found in phase 1 with each set covering all query's subgoals.
Combine MCDs in each set to produce a conjunctive rewriting of the query.
The final query re-writing is the union of all conjunctive rewritten queries.
rewrite in class QueryRewriterQueryRewriterException
protected QuerySubGoal getLeastRestrictiveMapping(QuerySubGoal querySubGoal,
java.util.List viewSubGoals)
querySubGoal - an QuerySubGoal object in the queryviewSubGoals - a List of QuerySubGoal objects in a view
QuerySubGoal object for least restrictive mappingquery_sub_goal and view_sub_goal. null if no mapping existsprotected java.util.List getSharedVariables(QuerySubGoal qsg)
List a list of sub-goals
protected java.util.List getMinimumCoverage(java.util.List sharedVars,
QueryAnalyser view)
sharedVars - a List of shared variables to checkview - a QueryAnalyser object containing having the data structure List a minimum list of view's sub-goals (if any) that cover null if view fails to cover.
protected java.util.Map checkConstants(QueryAnalyser qa,
MiniConQueryRewriter.MiniConDescription mcd)
MCD support any constants in the query
qa - the QueryAnalyser object of the querymcd - the MiniConQueryRewriter.MiniConDescription object found
HashMap object for storing matches found
protected java.util.Map checkComparisonPredicates(QueryAnalyser qa,
MiniConQueryRewriter.MiniConDescription mcd)
protected java.util.List createConjunctiveQueries(java.util.List mcds,
java.util.List qSubGoals)
mcds - a List of MiniConQueryRewriter.MiniConDescription objects
List list of condidate queries
protected void refineConjunctiveQueries(java.util.List conjQueries,
QueryRewriterResult result)
conjQueries - a List of conjunctive queries resulted from rewriting operationresult - the QueryRewriterResult object to update with refinements
protected java.lang.String createQueryFromSubGoals(java.util.List subGoals)
throws QueryRewriterException
QueryRewriterException
protected boolean contains(java.util.List goalSet1,
java.util.List goalSet2)
goalSet1 - a List of goals of the first setgoalSet2 - a List of goals of the second set
true if goalSet1 contains goalSet2, false otherwise
protected java.util.List subtractList(java.util.List srcList,
java.util.List fromList)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||