uk.ac.bbk.dcs.automed.qproc.reformulate
Class CacheQueryReformulationProvider

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.qproc.reformulate.CacheQueryReformulationProvider

public class CacheQueryReformulationProvider
extends java.lang.Object

Modified verions of the GAVQueryReformulationProvider that does not require the schemes in a query to be only from the global schema.

Author:
Lucas Zamboulis

Field Summary
private  QueryProcessorConfiguration _qpc
           
protected  java.util.logging.Logger logger
           
protected  Schema sourceSchema
           
protected  Schema[] targetSchemata
           
protected  java.util.HashMap viewmap
          Viewmap contains the constructs of the source schema in the LHS and the IQL view of each construct of the LHS in the RHS.
 
Constructor Summary
protected CacheQueryReformulationProvider()
           
  CacheQueryReformulationProvider(Schema sourceschema, Schema[] targetschemata)
          Deprecated. use #GAVQueryReformulationProvider(Schema, Schema[], QueryProcessorConfiguration) instead
  CacheQueryReformulationProvider(Schema sourceSchema, Schema[] targetSchemata, QueryProcessorConfiguration qpc)
           
 
Method Summary
private  void branch(Cell n, Schema fromSchema, java.lang.Object[] tos)
          Updates the view definitions (viewmap).
protected  void buildViews()
          Traverses BAV pathways and builds GAV views.
private  void changeSchemaRef(Cell n, Schema fromSchema, Schema to)
          Updates the view definition hashmap when the 'from' schema has only one 'to' schema.
private  void checkFinalConstructs()
           
 void finalize()
           
static void main(java.lang.String[] args)
           
private static void o(java.lang.Object s)
           
private  void populateViewMapLHS(Schema sourceSchema)
          Populates the LHS of the viewmap with schemes from source schema
private  void processTransformation(Schema fromSchema, Schema toSchema)
           
 void reformulate(ASG g, QueryProcessorConfiguration qpc)
          Reformulates the query represented by the ASG g according to the view defintions it has stored.
private  void replace(SchemeInfo si, Cell q, Cell root)
           
private  void replaceNullSchemaRefs(Cell r, java.lang.String sName)
           
private  void showViewMap()
           
private  void tempFun(Cell c)
           
private  void unifyViewDefinitions()
          Performs variable unification on each view definition in the viewmap.
private  void updateSchemeInfo(Cell c)
           
private  void updateSchemeInfoInViewMap()
          Method goes through all view definitions and updates SchemeInfo objects with Model, ConstructType and Type information (if present in the repository).
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected java.util.logging.Logger logger

sourceSchema

protected Schema sourceSchema

targetSchemata

protected Schema[] targetSchemata

viewmap

protected java.util.HashMap viewmap
Viewmap contains the constructs of the source schema in the LHS and the IQL view of each construct of the LHS in the RHS.


_qpc

private QueryProcessorConfiguration _qpc
Constructor Detail

CacheQueryReformulationProvider

protected CacheQueryReformulationProvider()

CacheQueryReformulationProvider

public CacheQueryReformulationProvider(Schema sourceschema,
                                       Schema[] targetschemata)
                                throws QueryReformulationException
Deprecated. use #GAVQueryReformulationProvider(Schema, Schema[], QueryProcessorConfiguration) instead

Throws:
QueryReformulationException

CacheQueryReformulationProvider

public CacheQueryReformulationProvider(Schema sourceSchema,
                                       Schema[] targetSchemata,
                                       QueryProcessorConfiguration qpc)
                                throws QueryReformulationException
Parameters:
sourceschema - the source schema
targetschemata - the target schemata
qpc - the input configuration
Throws:
QueryReformulationException - if there was a problem building the view definitions of the source schema constructs over target schema constructs
Method Detail

buildViews

protected void buildViews()
                   throws QueryReformulationException
Traverses BAV pathways and builds GAV views.

Throws:
QueryReformulationException
IntegrityException
NotFoundException

showViewMap

private void showViewMap()

populateViewMapLHS

private void populateViewMapLHS(Schema sourceSchema)
Populates the LHS of the viewmap with schemes from source schema

Parameters:
sourceSchema - the source schema

unifyViewDefinitions

private void unifyViewDefinitions()
                           throws QueryReformulationException
Performs variable unification on each view definition in the viewmap.

Throws:
QueryReformulationException
QueryReformulationException

updateSchemeInfoInViewMap

private void updateSchemeInfoInViewMap()
                                throws NotFoundException
Method goes through all view definitions and updates SchemeInfo objects with Model, ConstructType and Type information (if present in the repository).

Throws:
NotFoundException

updateSchemeInfo

private void updateSchemeInfo(Cell c)
                       throws NotFoundException
Throws:
NotFoundException

processTransformation

private void processTransformation(Schema fromSchema,
                                   Schema toSchema)
                            throws NotFoundException,
                                   QueryReformulationException
Throws:
NotFoundException
QueryReformulationException

replaceNullSchemaRefs

private void replaceNullSchemaRefs(Cell r,
                                   java.lang.String sName)

replace

private void replace(SchemeInfo si,
                     Cell q,
                     Cell root)

changeSchemaRef

private void changeSchemaRef(Cell n,
                             Schema fromSchema,
                             Schema to)
                      throws NotFoundException
Updates the view definition hashmap when the 'from' schema has only one 'to' schema. The only thing it updates is the schema reference of SchemeInfo objects found in the view definitions.

Parameters:
n - the view to be updated
fromSchema - the 'from' schema
to - the 'to' schema
Throws:
NotFoundException

branch

private void branch(Cell n,
                    Schema fromSchema,
                    java.lang.Object[] tos)
             throws NotFoundException,
                    QueryReformulationException
Updates the view definitions (viewmap). Building viewmap occurs by a breadth-first traversal, so at each depth, and for each pathway, if a 'from' schema has more than one 'to' schemas, the viewmap is updated using this method.

Parameters:
n - the view definition to be updated
fromSchema - the schema where the branching occurs
tos - the schemas resulting from the branching
Throws:
NotFoundException
QueryReformulationException

reformulate

public void reformulate(ASG g,
                        QueryProcessorConfiguration qpc)
                 throws QueryReformulationException
Reformulates the query represented by the ASG g according to the view defintions it has stored.

Throws:
QueryReformulationException

tempFun

private void tempFun(Cell c)

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

checkFinalConstructs

private void checkFinalConstructs()

o

private static void o(java.lang.Object s)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception