uk.ac.ic.doc.rodex.qproc
Class MiniConQueryRewriterAdaptive

java.lang.Object
  extended by uk.ac.ic.doc.rodex.qproc.QueryRewriter
      extended by uk.ac.ic.doc.rodex.qproc.MiniConQueryRewriter
          extended by uk.ac.ic.doc.rodex.qproc.MiniConQueryRewriterAdaptive

public class MiniConQueryRewriterAdaptive
extends MiniConQueryRewriter

MiniConQueryRewriterAdaptive.java Differs from MiniConQueryWriter in that this considers views which are only partially matched with the join sub-goals of the query. Instead of discarding these views, this algorithm keeps them with the partially matched (join) sub-goals for further check. If there exist other views which are mappable to the remaining sub-goals, then these views are then combined to make an MCD.

Author:
Duc M Le dmle@doc.ic.ac.uk

Nested Class Summary
 
Nested classes/interfaces inherited from class uk.ac.ic.doc.rodex.qproc.MiniConQueryRewriter
MiniConQueryRewriter.MiniConDescription
 
Field Summary
 
Fields inherited from class uk.ac.ic.doc.rodex.qproc.MiniConQueryRewriter
mcds, queryAnalyser, viewAnalysers
 
Fields inherited from class uk.ac.ic.doc.rodex.qproc.QueryRewriter
_qa, query, views
 
Constructor Summary
MiniConQueryRewriterAdaptive(ASG query, java.util.List views)
          Creates a new instance of QueryRewriterForFiltering
MiniConQueryRewriterAdaptive(ASG query, QueryAnalyser[] viewMetadata)
           
 
Method Summary
protected  java.util.List getMinimumCoverage(java.util.List sharedVars, QueryAnalyser view, java.util.Map invmap)
          Check that a query contains certain variables in its head and if not it
must contains all related 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:
 
Methods inherited from class uk.ac.ic.doc.rodex.qproc.MiniConQueryRewriter
analyse, checkComparisonPredicates, checkConstants, contains, createConjunctiveQueries, createQueryFromSubGoals, getLeastRestrictiveMapping, getMinimumCoverage, getQueryAnalyser, getSharedVariables, refineConjunctiveQueries, subtractList
 
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
 

Constructor Detail

MiniConQueryRewriterAdaptive

public MiniConQueryRewriterAdaptive(ASG query,
                                    java.util.List views)
Creates a new instance of QueryRewriterForFiltering


MiniConQueryRewriterAdaptive

public MiniConQueryRewriterAdaptive(ASG query,
                                    QueryAnalyser[] viewMetadata)
Method Detail

rewrite

public QueryRewriterResult rewrite()
                            throws QueryRewriterException
Description copied from class: MiniConQueryRewriter
Implements method in QueryWriter abstract parent class
Rewrite query using views based on the MiniCon algorithm following a two-phase process:

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.

Overrides:
rewrite in class MiniConQueryRewriter
Throws:
QueryRewriterException

getMinimumCoverage

protected java.util.List getMinimumCoverage(java.util.List sharedVars,
                                            QueryAnalyser view,
                                            java.util.Map invmap)
Check that a query contains certain variables in its head and if not it
must contains all related sub-goals

Parameters:
sharedVars - a List of shared variables to check
view - a QueryAnalyser object containing having the data structure
of the view that needs to be checked
Returns:
List a minimum list of view's sub-goals (if any) that cover

the shared variables; null if view fails to cover.