uk.ac.bbk.dcs.automed.qproc
Class QueryProcessor

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

public class QueryProcessor
extends java.lang.Object

The new query processor class provides query reformulation for three techniques - GAV, LAV and BAV. Also this class provides functionality for Range semantics, i.e., query reformulation using the lower bound, upper bound or the range. A user can provide integration semantics while issuing a query over multiple target schemas, thus overriding the integration semantics derived from the transformation pathways.

Author:
Lucas Zamboulis, Sandeep Mittal

Field Summary
protected static java.util.Map _cache
           
protected  boolean _cacheOn
           
protected  java.util.logging.Logger _logger
           
protected  long afterEv
           
protected  long afterLO
           
protected  long afterQAFP
           
protected  long afterQR
           
protected  long afterSubmit
           
protected  long afterTranslation
           
protected  long afterVU
           
protected  long beforeTranslation
           
 
Constructor Summary
QueryProcessor()
          Create an instance of the Query Processor.
 
Method Summary
 java.util.Map getCache()
           
protected  void loggingInit()
           
 void process(ASG g, Schema source, Schema[] targets, java.lang.String integrationSemantics, QueryProcessorConfiguration qpc)
          Main processing method for issuing a query.
 java.lang.String process(java.lang.String query, AutoMedWrapper aw, Schema source, Schema[] targets, java.lang.String integrationSemantics, QueryProcessorConfiguration qpc)
          If the query language is other than IQL, then use this method to process the query.
 void showPerformance(QueryProcessorConfiguration qpc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected java.util.logging.Logger _logger

afterSubmit

protected long afterSubmit

afterQR

protected long afterQR

afterVU

protected long afterVU

afterLO

protected long afterLO

afterQAFP

protected long afterQAFP

afterEv

protected long afterEv

beforeTranslation

protected long beforeTranslation

afterTranslation

protected long afterTranslation

_cache

protected static java.util.Map _cache

_cacheOn

protected boolean _cacheOn
Constructor Detail

QueryProcessor

public QueryProcessor()
Create an instance of the Query Processor. More than one instance can be created without possibility of inteference with any other instance of the query processor.

Method Detail

process

public java.lang.String process(java.lang.String query,
                                AutoMedWrapper aw,
                                Schema source,
                                Schema[] targets,
                                java.lang.String integrationSemantics,
                                QueryProcessorConfiguration qpc)
                         throws QProcException
If the query language is other than IQL, then use this method to process the query. See documentation of the main process method for details of the parameters to pass.

Throws:
QProcException

process

public void process(ASG g,
                    Schema source,
                    Schema[] targets,
                    java.lang.String integrationSemantics,
                    QueryProcessorConfiguration qpc)
             throws QProcException
Main processing method for issuing a query. This method first reformulates the query based on the reformulation semantics (GAV/LAV/BAV) and then carries out logical/physical optimisations. Query is then annotated using the annotator or the fragment processor and then evaluated to get the results from the target schemas.

Parameters:
g - The input query passed as an ASG.
source - The global or the source schema on which the query is issued.
targets - Array of target or data source schemas. For SQL data sources, pass the AutoMed oriented schema.
integrationSemantics - 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:
  • Shorthand: The following four integration operators can be used as a shorthand notation to specify a generic integration semantics for all the target data sources, without specifying the names of the data sources. The GQP combines the results of all the target data sources using the same operator in the order the target data sources are specified in the input target data source array.
    • Choose semantics: values coming from one data source are returned (choose DS1 DS2 ); which data source is chosen depends on the ChooseOptimiser (Section 3.6) or, if the ChooseOptimiser is not used, the choose IQL function (Appendix A).
    • Append semantics: all values from all data sources are returned ((++) DS1 DS2 ).
    • Intersect semantics: a value is returned only if it is present in all data sources (intersect DS1 DS2 ).
    • Union semantics: a value is returned if it is present in any data source (distinct ((++) DS1 DS2)).
  • Verbose: In verbose form, a user must specify an expression containing the names of each of the target datasources and joined together using any the operators described above or any of the set operators, such as, -- (monus). Data source name must be prefixed by a $ symbol. For example, integration semantics can be as simple as DS1 ++ DS2 ++ DS3 or arbitrarily complex, e.g. (DS1 intersect DS2 ) ++ (DS1 -- DS2)
qpc - QueryProcessorConfiguration providing the environment settings for the query processing.
Throws:
QProcException - LAV query reformulation may fail due to limitations of the LAV reformulation technique. In such a case use the following code to check if the exception is because of LAV or not.
 if ((e.getCause() instanceof LAVQueryReformulationException)
                && (qpc.getReformulationSemantics() == QueryProcessorConfiguration.REFORMULATION_LAV_INV_RULES)) {
        System.out.println("###LAV Issue:");
 } else {
        System.out.println("###Some Other Issue:");
 }
 

showPerformance

public void showPerformance(QueryProcessorConfiguration qpc)

loggingInit

protected void loggingInit()

getCache

public java.util.Map getCache()