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

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

public class AtomicViewMap
extends java.lang.Object

This class creates atomic views from the Automed Transformations. These views are binary views, i.e., they are created for a pair of source and target schemas. Views are direction sensitive, i.e., direction reflected in the view is from source schema to target schema. No processing is done to the extent query defined in the transformations. For each kind of transformation (ADD/EXTEND/DELETE/CONTRACT/RENAME/IDENTITY) there is a separate view map. Key for the view maps is a special key class called ViewKey which currently wraps a SchemeInfo class. But the key for the view map is the repository object id for each construct, hence the equals() method of ViewKey class has been redefined to compare only the repository object ids. This class also stores a cache of its own instances so that if asked for an existing set of views, it returns a reference to an existing instance of itself rather than recalculating the views again. This is to minimize the repository access which can be expensive.

Author:
Sandeep Mittal, Lucas Zamboulis

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 AtomicViewMap(Schema source, Schema target, QueryProcessorConfiguration qpc, int action)
          Constructs a new AtomicViewMap object for the input source and target schemas, then populates it.
 
Method Summary
static void addToViewMap(SchemeInfo fromScheme, Cell targetQuery, java.util.Map map, int rangeSemantics)
           
protected  void buildViews()
          Traverses the pathway between the source and the target schema and populates the AtomicViewMap with views between a single source schema and a single target schema.
static java.lang.String computeName(Schema source, Schema target, QueryProcessorConfiguration qpc, int action)
           
static AtomicViewMap getInstance(Schema source, Schema target, QueryProcessorConfiguration qpc, int action)
           
 java.lang.String getName()
           
protected  Cell getQueryBasedOnRangeSemantics(java.lang.String suppliedQuery)
           
 java.util.Map getViewMap()
           
protected  void processTransformation(Schema fromSchema, Schema toSchema)
           
static void showInstanceCache()
           
 void showViewMap()
           
 
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

_instanceCache

protected static java.util.Map _instanceCache

_sourceSchema

protected Schema _sourceSchema

_targetSchema

protected Schema _targetSchema

_name

protected java.lang.String _name

_viewMap

protected java.util.Map _viewMap

_qpc

protected QueryProcessorConfiguration _qpc
Constructor Detail

AtomicViewMap

protected AtomicViewMap(Schema source,
                        Schema target,
                        QueryProcessorConfiguration qpc,
                        int action)
                 throws BuildViewException
Constructs a new AtomicViewMap object for the input source and target schemas, then populates it.

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

getViewMap

public java.util.Map getViewMap()

getInstance

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

computeName

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

getName

public java.lang.String getName()

buildViews

protected void buildViews()
                   throws BuildViewException
Traverses the pathway between the source and the target schema and populates the AtomicViewMap with views between a single source schema and a single target schema.

Throws:
BuildViewException - if a problem is encountered during the population of the map

processTransformation

protected void processTransformation(Schema fromSchema,
                                     Schema toSchema)
                              throws BuildViewException
Throws:
BuildViewException

addToViewMap

public static void addToViewMap(SchemeInfo fromScheme,
                                Cell targetQuery,
                                java.util.Map map,
                                int rangeSemantics)
                         throws BuildViewException
Throws:
BuildViewException

getQueryBasedOnRangeSemantics

protected Cell getQueryBasedOnRangeSemantics(java.lang.String suppliedQuery)
                                      throws BuildViewException
Throws:
BuildViewException

showViewMap

public void showViewMap()

showInstanceCache

public static void showInstanceCache()