edu.wpi.cs.dsrg.xmldb.xat.testfiles
Class TestSXE

java.lang.Object
  |
  +--edu.wpi.cs.dsrg.xmldb.xat.testfiles.TestSXE

public class TestSXE
extends java.lang.Object

This Class is used to test the Rainbow Core.

Since:
1.0

Field Summary
static boolean cut
           
static boolean debug
           
static boolean decor
          The parameters from command line.
protected static java.util.Properties defaultProperties
          The Properties setting in running the main function.
static boolean exec
           
static boolean merge
           
protected static java.lang.String metadataTable
           
static boolean newProp
           
static boolean nooutput
           
protected static java.lang.String password
           
protected static java.lang.String PROPERTIES_FILE_NAME
           
static boolean rewrite
           
static boolean schema
           
static boolean sql
           
static boolean time
           
protected static long timeBegin
          The variables to record the usage of time.
protected static long timeCut
           
protected static long timeDecor
           
protected static long timeExec
           
protected static long timeGen
           
protected static long timeMerge
           
protected static long timeRewrite
           
protected static long timeSchema
           
protected static long timeSQL
           
protected static long timeTotal
           
protected static java.lang.String uri
           
protected static java.lang.String username
          The parameter used for database connection
 
Constructor Summary
TestSXE()
          The default TestSXE constructor.
 
Method Summary
 java.util.Properties getDefaultProperties()
          Get the default properties from propertity_file.
static java.lang.String getMetadataTable()
          Get the metadataTable.
static java.lang.String getPassword()
          Get password of JDBC connection.
static java.lang.String getUri()
          Get the JDBC connection string.
static java.lang.String getUsername()
          Get the username for JDBC connection.
static void main(java.lang.String[] args)
          This method is the main function for RainbowCore.
static void printTime(java.lang.String prefix)
          Output the time usage of each step in RainbowCore.
static void readParameters(java.lang.String[] args, int start)
          Get parameters from command line.
protected static java.lang.String readQuery(java.lang.String file)
          Reads in the contents of a file and converts it to a string object.
protected static void saveProperties(java.lang.String userSave, java.lang.String passwdSave, java.lang.String uriSave)
          Saves the user parameters to PROPERTIES_FILE_NAME
protected static void saveProperties(java.lang.String userSave, java.lang.String passwdSave, java.lang.String uriSave, java.lang.String metaSave)
          Saves the user parameters to PROPERTIES_FILE_NAME
static void setDefaultProperties()
          Set default properties into the PROPERTIES_FILE, which include username, password, uri and metadataTable.
static void setMetadataTable(java.lang.String meta)
          Set the metadataTable using given string.
static void setPassword(java.lang.String newPassword)
          Set the metadataTable using given string.
static void setUri(java.lang.String newUri)
          Set the metadataTable using given string.
static void setUsername(java.lang.String newUsername)
          Set the username using given string.
static XATTree treeCut(XATTree treeCut)
          Cut the unused operator within the tree.
static XATTree treeDecorrelation(XATTree treeDecor)
          Get rid of recursive operator in the tree, such as groupBy, For.
static XATTree treeExec(XATTree treeExec)
          Execute the tree.
static XATTree treeGeneration(java.lang.String query, XATTree genTree)
          Generate XAT for given query
static XATTree treeMerge(XATTree userTree, XATTree viewTree)
          Merge the two XATs.
static XATTree treeRewrite(XATTree treeRewrite)
          Rewrite the XAT for optimization.
static XATTree treeSchema(XATTree treeSchema)
          Do schema cleanup for given XAT.
static XATTree treeSQLGen(XATTree treeSQL)
          Generate SQL for "relational" algebra part within given XAT.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decor

public static boolean decor
The parameters from command line.
Since:
1.0

newProp

public static boolean newProp

merge

public static boolean merge

cut

public static boolean cut

rewrite

public static boolean rewrite

time

public static boolean time

schema

public static boolean schema

sql

public static boolean sql

exec

public static boolean exec

debug

public static boolean debug

nooutput

public static boolean nooutput

PROPERTIES_FILE_NAME

protected static final java.lang.String PROPERTIES_FILE_NAME

timeBegin

protected static long timeBegin
The variables to record the usage of time.
Since:
1.0

timeGen

protected static long timeGen

timeMerge

protected static long timeMerge

timeDecor

protected static long timeDecor

timeSchema

protected static long timeSchema

timeRewrite

protected static long timeRewrite

timeSQL

protected static long timeSQL

timeExec

protected static long timeExec

timeCut

protected static long timeCut

timeTotal

protected static long timeTotal

username

protected static java.lang.String username
The parameter used for database connection
Since:
1.0

password

protected static java.lang.String password

uri

protected static java.lang.String uri

defaultProperties

protected static java.util.Properties defaultProperties
The Properties setting in running the main function.
Since:
1.0

metadataTable

protected static java.lang.String metadataTable
Constructor Detail

TestSXE

public TestSXE()
The default TestSXE constructor.
Since:
1.0
Method Detail

getDefaultProperties

public java.util.Properties getDefaultProperties()
Get the default properties from propertity_file.
Returns:
java.util.Properties The default properity for main method.
Since:
1.0

getMetadataTable

public static java.lang.String getMetadataTable()
Get the metadataTable.
Returns:
String The matadata table.
Since:
1.0

getPassword

public static java.lang.String getPassword()
Get password of JDBC connection.
Returns:
String The user password.
Since:
1.0

getUri

public static java.lang.String getUri()
Get the JDBC connection string.
Returns:
java.lang.String The JDBC connection string to database.
Since:
1.0

getUsername

public static java.lang.String getUsername()
Get the username for JDBC connection.
Returns:
java.lang.String The user name for build the JDBC connection to database.
Since:
1.0

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
This method is the main function for RainbowCore. The suggested usage is as follows: eg: two RainbowCore\widm\0user.qlt RainbowCore\widm\view.qlt gen decor rewrite merge schema exec debug sql eg: one RainbowCore\widm\0user.qlt gen decor rewrite schema exec debug sql The meaning of flags is as follows: - The first flag should be a string, "one" or "two". This will show how many queries there are. Read in either one or two queries, generate trees, then do the following with the remaining FLAGS - decor: decorrelate the query - merge: if there are two trees merge them - rewrite: pushdown the computation - schema: clean up the schema - sql: generate sql - exec: execute the tree - newProp: create new default property values - debug: debug the entire system - time: shows time statements for each step
Since:
1.0

printTime

public static void printTime(java.lang.String prefix)
Output the time usage of each step in RainbowCore.
Parameters:
perfix - The perfix for helping output.
Since:
1.0

readParameters

public static void readParameters(java.lang.String[] args,
                                  int start)
Get parameters from command line.
Parameters:
args - java.lang.String[] The array containing all the parameters.
start - The number of the first paramters.
Since:
1.0

readQuery

protected static java.lang.String readQuery(java.lang.String file)
                                     throws java.lang.Exception
Reads in the contents of a file and converts it to a string object.
Parameters:
file - The name of file opening.
Returns:
String The content of the file.
Since:
1.0

saveProperties

protected static void saveProperties(java.lang.String userSave,
                                     java.lang.String passwdSave,
                                     java.lang.String uriSave)
Saves the user parameters to PROPERTIES_FILE_NAME
Parameters:
userSave - The username.
passwdSave - The password.
uriSave - The JDBC connecting string to database.
Since:
1.0

saveProperties

protected static void saveProperties(java.lang.String userSave,
                                     java.lang.String passwdSave,
                                     java.lang.String uriSave,
                                     java.lang.String metaSave)
Saves the user parameters to PROPERTIES_FILE_NAME
Parameters:
userSave - The username.
passwdSave - The password.
uriSave - The JDBC connecting string to database.
Since:
1.0

setDefaultProperties

public static void setDefaultProperties()
Set default properties into the PROPERTIES_FILE, which include username, password, uri and metadataTable.
Since:
1.0

setMetadataTable

public static void setMetadataTable(java.lang.String meta)
Set the metadataTable using given string.
Parameters:
meta - The meta string.
Since:
1.0

setPassword

public static void setPassword(java.lang.String newPassword)
Set the metadataTable using given string.
Parameters:
newPassword - The new password.
Since:
1.0

setUri

public static void setUri(java.lang.String newUri)
Set the metadataTable using given string.
Parameters:
newUri - The JDBC connection string.
Since:
1.0

setUsername

public static void setUsername(java.lang.String newUsername)
Set the username using given string.
Parameters:
newUsername - The new user name.
Since:
1.0

treeCut

public static XATTree treeCut(XATTree treeCut)
Cut the unused operator within the tree.
Parameters:
debugCut - The tree need to be optimized.
Returns:
XATTree The optimized tree after cutting.
Since:
1.0

treeDecorrelation

public static XATTree treeDecorrelation(XATTree treeDecor)
Get rid of recursive operator in the tree, such as groupBy, For.
Parameters:
treeDecor - The tree need to be optimized.
Returns:
XATTree The optimized tree after decorrelation.
Since:
1.0

treeExec

public static XATTree treeExec(XATTree treeExec)
Execute the tree.
Parameters:
debugExec - The tree needs to be executed.
Returns:
XATTree The tree after execution.
Since:
1.0

treeGeneration

public static XATTree treeGeneration(java.lang.String query,
                                     XATTree genTree)
Generate XAT for given query
Parameters:
genTree - The generated XAT tree.
query - The XQuery for tree generation.
Returns:
XATTree The generated XAT tree.
Since:
1.0

treeMerge

public static XATTree treeMerge(XATTree userTree,
                                XATTree viewTree)
Merge the two XATs.
Parameters:
userTree - The generated user XAT tree.
query - The generated view XATTree.
Returns:
XATTree The merged XAT tree.
Since:
1.0

treeRewrite

public static XATTree treeRewrite(XATTree treeRewrite)
Rewrite the XAT for optimization.
Parameters:
treeRewrite - The tree need to be optimized.
Returns:
XATTree The optimized XAT tree.
Since:
1.0

treeSchema

public static XATTree treeSchema(XATTree treeSchema)
Do schema cleanup for given XAT.
Parameters:
treeSchema - Cleanup the XATTree.
Returns:
XATTree The optimized XATTree.
Since:
1.0

treeSQLGen

public static XATTree treeSQLGen(XATTree treeSQL)
Generate SQL for "relational" algebra part within given XAT.
Parameters:
treeSQL - The XATTree used for SQL generation.
Returns:
XATTree The tree after the SQL generation step.
Since:
1.0