uk.ac.bbk.dcs.automed.qproc.iql
Class IQLUtility

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

public class IQLUtility
extends java.lang.Object

Provides a number of static methods that simplify IQL expressions.

Author:
Lucas Zamboulis

Field Summary
protected static java.util.logging.Logger logger
           
 
Constructor Summary
IQLUtility()
           
 
Method Summary
static float getCompDistributionMetric(Cell root)
           
static Cell getDefaultQuery(int rangeSemantics)
           
static java.util.Collection getSchemes(Cell root, java.util.Collection col)
           
static boolean processFlatmapRange(Cell c)
           Performs in a top-down manner the following simplification:
static boolean processRangeArgs(Cell c)
           
static boolean processRangeInGen(Cell c)
           Performs in a top-down manner the following simplification:
static boolean processRangeRange(Cell c)
           Performs in a bottom-up manner the following simplifications:
static boolean simplifyBasedOnEquijoins(Cell root)
          Traverses query and replaces certain comprehensions with [].
static boolean simplifyBasedOnQualifiers(Cell c)
           Performs in a bottom-up manner the following simplifications:
static void simplifyRange(Cell c)
           
static boolean simplifyUnionIntersect(Cell c)
          Simplifies the input query so that union Void Void returns Void and intersect Any Any returns Any
 
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
Constructor Detail

IQLUtility

public IQLUtility()
Method Detail

simplifyRange

public static void simplifyRange(Cell c)

processRangeArgs

public static boolean processRangeArgs(Cell c)

processRangeRange

public static boolean processRangeRange(Cell c)

Performs in a bottom-up manner the following simplifications:

Parameters:
c - the root of the expression to be simplified
Returns:
true if a simplification occurred

processFlatmapRange

public static boolean processFlatmapRange(Cell c)

Performs in a top-down manner the following simplification:

Parameters:
c - the root of the expression to be simplified
Returns:
true if a simplification occurred

processRangeInGen

public static boolean processRangeInGen(Cell c)

Performs in a top-down manner the following simplification:

Parameters:
c - the root of the expression to be simplified
Returns:
true if a simplification occurred

simplifyBasedOnQualifiers

public static boolean simplifyBasedOnQualifiers(Cell c)

Performs in a bottom-up manner the following simplifications:

Parameters:
c - the root of the expression to be simplified
Returns:
true if a simplification occurred

simplifyBasedOnEquijoins

public static boolean simplifyBasedOnEquijoins(Cell root)
                                        throws IQLException
Traverses query and replaces certain comprehensions with []. These comprehensions contain a join Traverse top-to-bottom - more efficient if top comprehension becomes [] right away.

Parameters:
root - root of the comprehension
Returns:
true if a simplification occurred
Throws:
IQLException

getCompDistributionMetric

public static float getCompDistributionMetric(Cell root)
Parameters:
root - the root of an IQL query
Returns:
the ratio a/b, where b is the number of schemes in the IQL query and a is the number of schemes in the query that the uk.ac.bbk.dcs.automed.qproc.optimise.ComprehensionDistributor would create - does NOT consider filters containing comprehensions (returns -1 if IQL query has no generators in the first place)

getSchemes

public static java.util.Collection getSchemes(Cell root,
                                              java.util.Collection col)

simplifyUnionIntersect

public static boolean simplifyUnionIntersect(Cell c)
Simplifies the input query so that union Void Void returns Void and intersect Any Any returns Any

Parameters:
c - the root of the input query

getDefaultQuery

public static Cell getDefaultQuery(int rangeSemantics)