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

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.qproc.reformulate.QueryReformulator
All Implemented Interfaces:
QueryReformulationProvider

public class QueryReformulator
extends java.lang.Object
implements QueryReformulationProvider

Responsible for reformulating a query along AutoMed pathways (GAV, LAV or BAV). Reformulation logic is the same irrespective of the reformulation technique(GAV, BAV, LAV). This is because the functionality to create composite views takes care of providing the correct set of views to the reformulation class. Query reformulator is constructed as an empty instance. When using the reformulate() method, the source schema, target schema and the query processor configuration is provided. Because of caching of composite and atomics views at lower levels, its very cheap to have any number of instances of this class and just use reformulate method whenever needed.

Author:
Sandeep Mittal, Lucas Zamboulis

Field Summary
protected  java.util.logging.Logger _logger
           
protected  java.lang.String _schemaPrefix
           
protected  QueryProcessorConfiguration originalQpc
           
 
Constructor Summary
QueryReformulator()
          Constructs an instance of this class.
 
Method Summary
private  void changeCollectionSemantics(Cell c, java.lang.String desiredColType)
           
private  void convertQueryToTargets(Cell qc, Schema source, Schema[] targets, java.lang.String integrationSemantics, QueryProcessorConfiguration qpc)
           
protected  void convertSchemeToTarget(Cell n, Schema source, Schema[] targets, java.lang.String integrationSemantics, QueryProcessorConfiguration qpc)
           
private  java.lang.String createIdQueryString(java.lang.String integrationSemantics, Schema[] targets)
           
private  CompositeViewMap getCompositeViewMap(Schema source, Schema target, QueryProcessorConfiguration qpc)
           
private  Schema getDualModelDataSource(Schema target)
           
private  java.lang.String getIdSemanticsFromPathways(Schema source, Schema[] targets)
           
private  Cell getTargetsIdSemantics(java.lang.String integrationSemantics, Schema source, Schema[] targets)
          Semantics of how to combine the results from data sources.
static void main(java.lang.String[] args)
           
protected  void o(java.lang.Object s)
           
protected  void o(java.lang.Object s, java.util.logging.Level logLevel)
          Logging functionality
 void reformulate(ASG query, Schema source, Schema[] targets, java.lang.String integrationSemantics, QueryProcessorConfiguration qpc)
          Reformulate an IQL query based on a given configuration
protected  void reformulateInternal(Cell query, Schema source, Schema[] targets, java.lang.String integrationSemantics, QueryProcessorConfiguration qpc)
           
private  void replaceIdGraph(Cell idc, java.util.Map finalViewMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_schemaPrefix

protected final java.lang.String _schemaPrefix
See Also:
Constant Field Values

_logger

protected java.util.logging.Logger _logger

originalQpc

protected QueryProcessorConfiguration originalQpc
Constructor Detail

QueryReformulator

public QueryReformulator()
Constructs an instance of this class.

Method Detail

reformulate

public void reformulate(ASG query,
                        Schema source,
                        Schema[] targets,
                        java.lang.String integrationSemantics,
                        QueryProcessorConfiguration qpc)
                 throws QueryReformulationException
Description copied from interface: QueryReformulationProvider
Reformulate an IQL query based on a given configuration

Specified by:
reformulate in interface QueryReformulationProvider
Parameters:
query - an ASG object of an IQL query
integrationSemantics - Semantics of how to combine results from various target databases.
qpc - a {@link QueryProcessingConfiguration) object specific for query reformulation
Throws:
QueryReformulationException

reformulateInternal

protected void reformulateInternal(Cell query,
                                   Schema source,
                                   Schema[] targets,
                                   java.lang.String integrationSemantics,
                                   QueryProcessorConfiguration qpc)
                            throws QueryReformulationException
Throws:
QueryReformulationException

convertQueryToTargets

private void convertQueryToTargets(Cell qc,
                                   Schema source,
                                   Schema[] targets,
                                   java.lang.String integrationSemantics,
                                   QueryProcessorConfiguration qpc)
                            throws QueryReformulationException
Throws:
QueryReformulationException

convertSchemeToTarget

protected void convertSchemeToTarget(Cell n,
                                     Schema source,
                                     Schema[] targets,
                                     java.lang.String integrationSemantics,
                                     QueryProcessorConfiguration qpc)
                              throws QueryReformulationException
Throws:
QueryReformulationException

getDualModelDataSource

private Schema getDualModelDataSource(Schema target)

getCompositeViewMap

private CompositeViewMap getCompositeViewMap(Schema source,
                                             Schema target,
                                             QueryProcessorConfiguration qpc)
                                      throws QueryReformulationException
Throws:
QueryReformulationException

replaceIdGraph

private void replaceIdGraph(Cell idc,
                            java.util.Map finalViewMap)
                     throws QueryReformulationException
Throws:
QueryReformulationException

getTargetsIdSemantics

private Cell getTargetsIdSemantics(java.lang.String integrationSemantics,
                                   Schema source,
                                   Schema[] targets)
                            throws QueryReformulationException
Semantics of how to combine the results from data sources. Given a set of data sources, e.g. DS1 , DS2 and DS3 , a user has the following ways of specifying the integration semantics to an instance of GQP:

Throws:
QueryReformulationException

createIdQueryString

private java.lang.String createIdQueryString(java.lang.String integrationSemantics,
                                             Schema[] targets)

getIdSemanticsFromPathways

private java.lang.String getIdSemanticsFromPathways(Schema source,
                                                    Schema[] targets)

changeCollectionSemantics

private void changeCollectionSemantics(Cell c,
                                       java.lang.String desiredColType)

o

protected void o(java.lang.Object s,
                 java.util.logging.Level logLevel)
Logging functionality

Parameters:
s -
logLevel -

o

protected void o(java.lang.Object s)

main

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