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

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.qproc.reformulate.CompositeViewMap
Direct Known Subclasses:
BAVViewMap, GAVViewMap, LAVInvRulesViewMap

public abstract class CompositeViewMap
extends java.lang.Object

Class containing common functionality for creating composite views from atomic views. Composite views are constructed from ADD, EXTEND, DELETE, CONTRACT, RENAME and IDENTITY atomic views. For LAV and BAV techniques, the ADD and EXTEND atomic views need to be processed further before these could be used to form composite views. Currently we used Inverse Rules algorithm as described in the following paper:

              P.J. McBrien and A. Poulovassilis. P2P query reformulation over Both-as-View
              data transformation rules. In Proc of DBISP2P 2006.
 

Author:
Lucas Zamboulis, Sandeep Mittal

Field Summary
protected static java.util.Map _instanceCache
           
protected static java.util.logging.Logger _logger
           
protected  java.lang.String _name
           
protected  QueryProcessorConfiguration _qpc
           
protected  Schema _sourceSchema
           
protected  Schema _targetSchema
           
protected  java.util.Map _viewMap
           
 
Constructor Summary
protected CompositeViewMap(Schema source, Schema target, QueryProcessorConfiguration qpc)
          Constructs a new CompositeViewMap object for the input source and target schemas, then populates it.
 
Method Summary
protected abstract  void buildViews()
           
protected  void buildViews(java.util.Map[] maps)
           
protected  Cell composeView(java.util.Map[] maps, ViewKey vk)
           
static java.lang.String computeName(Schema source, Schema target, QueryProcessorConfiguration qpc)
           
protected  java.util.Set getFinalConstructs()
           
static CompositeViewMap getInstance(Schema source, Schema target, QueryProcessorConfiguration qpc)
           
 java.lang.String getName()
           
 Schema getSourceSchema()
           
 Schema getTargetSchema()
           
 java.util.Map getViewMap()
           
protected  void populateViewMap(Schema schema)
          Populates the LHS of the viewmap with schemes from source schema.
protected  boolean searchAndReplace(Cell c, java.util.Map[] maps, java.util.Set vkSet)
          Goes through an IQL query and replaces each scheme encountered with its view definition found in the AtomicViewMaps
static void showInstanceCache()
           
protected  void showViewMap()
           
protected  void updateSchemaRef(Cell n, Schema aSchema)
          Forces the schema reference for a Cell tree to the given schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected static java.util.logging.Logger _logger

_sourceSchema

protected Schema _sourceSchema

_targetSchema

protected Schema _targetSchema

_name

protected java.lang.String _name

_viewMap

protected java.util.Map _viewMap

_instanceCache

protected static java.util.Map _instanceCache

_qpc

protected QueryProcessorConfiguration _qpc
Constructor Detail

CompositeViewMap

protected CompositeViewMap(Schema source,
                           Schema target,
                           QueryProcessorConfiguration qpc)
Constructs a new CompositeViewMap object for the input source and target schemas, then populates it.

Parameters:
source - the input source schema
target - the input target schema
qpc - Query processor configuration
Throws:
BuildViewException - if a problem is encountered during the population of the map
Method Detail

getInstance

public static CompositeViewMap getInstance(Schema source,
                                           Schema target,
                                           QueryProcessorConfiguration qpc)
                                    throws BuildViewException
Parameters:
source - source schema
target - target schema
qpc - Query processor configuration
Returns:
the CompositeViewMap specified by the input parameters - if one exists in the internal cache, a reference to it is returned, otherwise a new CompositeViewMap is created based on the input parameters
Throws:
BuildViewException

computeName

public static java.lang.String computeName(Schema source,
                                           Schema target,
                                           QueryProcessorConfiguration qpc)

getViewMap

public java.util.Map getViewMap()

getTargetSchema

public Schema getTargetSchema()

getSourceSchema

public Schema getSourceSchema()

getName

public java.lang.String getName()

buildViews

protected abstract void buildViews()
                            throws BuildViewException
Throws:
BuildViewException

buildViews

protected void buildViews(java.util.Map[] maps)
                   throws BuildViewException
Throws:
BuildViewException

getFinalConstructs

protected java.util.Set getFinalConstructs()

searchAndReplace

protected boolean searchAndReplace(Cell c,
                                   java.util.Map[] maps,
                                   java.util.Set vkSet)
                            throws BuildViewException
Goes through an IQL query and replaces each scheme encountered with its view definition found in the AtomicViewMaps

Parameters:
c - the root of the IQL query
Throws:
BuildViewException

composeView

protected Cell composeView(java.util.Map[] maps,
                           ViewKey vk)
                    throws NotFoundException
Throws:
NotFoundException

populateViewMap

protected void populateViewMap(Schema schema)
Populates the LHS of the viewmap with schemes from source schema. Note that the viewmap contains two versions of each scheme (shorthand + verbose).

Parameters:
schema - the source schema

updateSchemaRef

protected void updateSchemaRef(Cell n,
                               Schema aSchema)
Forces the schema reference for a Cell tree to the given schema.

Parameters:
n - Root cell of a comprehension or Cell tree.
aSchema - New schema reference.

showViewMap

protected void showViewMap()

showInstanceCache

public static void showInstanceCache()