|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wpi.cs.dsrg.xmldb.xat.common.visitorpattern.InheritableVisitor | +--edu.wpi.cs.dsrg.xmldb.xat.component.xattreegeneration.ParserTraverse
This class visits the objects of the Kweelt parser and puts the query in the correct algebra node.
To understand this code, one should know how the Kweelt parser works and what our algebra is. It would also be helpful to know what a visitor pattern is because that is what we use to traverse through the query.
There are different types of the return value from the visit() function. For visit(QuiltQuery) returns a Vector of XATTrees. For visit(*Op*) returns a Vector of Expression + XATTree. For visit(LocationStep) returns a Vector of Step + XATTree. For visit(Value*) returns a Primitive Type (*). For visit(*) returns a XATTree.
xacute.quilt
,
edu.wpi.cs.dsrg.xmldb.xat.common.visitorpatternField Summary | |
protected OperatorBuilder |
builder
Used to create operators. |
Constructor Summary | |
ParserTraverse()
Class Default Constructor |
|
ParserTraverse(boolean debugMain)
Class constructor specifying debug mode |
Method Summary | |
java.lang.Object |
dispatch()
To visit a null object. |
java.lang.Object |
dispatch(java.lang.Object obj)
To visit any object. |
java.lang.Object |
dispatch(java.lang.Object ob1,
java.lang.Object ob2)
|
XATTree |
expressionVectorToXAT(java.util.Vector expVector)
Convert an Expression Vector into an XAT Tree. |
XATTree |
getTree()
Returns the xat. |
XATTree |
getTree(java.lang.String functionName)
Returned the XAT for the user defined functions. |
XATTree |
handleWhereClause(xacute.quilt.FLWRExpression flwr,
XATTree returnClause,
java.lang.String returnCol)
Generate the XAT Tree for Where Clause |
boolean |
isDebug()
Get the value of the propertity 'DEBUG_ParserTraverse'. |
protected XATTree |
mergeTreeWithSources(XATTree top,
XATTree bottom)
Merge two trees together and aware of source operators. |
void |
setDebug(boolean debug)
Set to show debugging message. |
java.lang.Object |
visit(xacute.quilt.BinOpAND andOp)
Create XAT Tree for Binary AND Expression. |
java.lang.Object |
visit(xacute.quilt.BinOpArith arith)
Create XAT Tree for Binary Arithmatic Expression. |
java.lang.Object |
visit(xacute.quilt.BinOpCOMP comp)
This method is visited when WHERE is encountered in a query It will creates a select node. |
java.lang.Object |
visit(xacute.quilt.BinOpOR orOp)
Create XAT Tree for Binary OR Expression. |
java.lang.Object |
visit(xacute.quilt.BinOpUnion union)
For the union, two operators will be created. |
java.lang.Object |
visit(xacute.quilt.CurrentNode curN)
Create XAT Tree for Current Node. |
java.lang.Object |
visit(xacute.quilt.DeleteUpdate del)
Create XAT Tree for Delete Update Operator. |
java.lang.Object |
visit(xacute.quilt.ElementConstruct ec)
Visited when a RETURN clause is encountered |
java.lang.Object |
visit(xacute.quilt.FilterExpression filterExpr)
Process the Filter Expression. |
java.lang.Object |
visit(xacute.quilt.FLWRExpression flwr)
Called if a FLWR (For-Let-Where-Return) expression is encountered (OR when a FOR is found in the query) |
java.lang.Object |
visit(xacute.quilt.FLWUExpression flwu)
Difference from the FLWR, it doesn't have the Aggregate Operator. |
java.lang.Object |
visit(xacute.quilt.ForBinding b)
Order of generated forbinding: NavUnnest->(Distinct)->Subtree Contains the data for the FOR bindings |
java.lang.Object |
visit(xacute.quilt.FunCall funPrim)
The superclass of all the function calls |
java.lang.Object |
visit(xacute.quilt.FunDef fundef)
Visit defined functions using visit(FunCall) |
java.lang.Object |
visit(xacute.quilt.FunUserDefined funUD)
Visit user defined functions |
java.lang.Object |
visit(xacute.quilt.IfThenElse ite)
Create XAT Tree for IF THEN ELSE structure. |
java.lang.Object |
visit(xacute.quilt.InsertUpdate ins)
Called when an Insert Update is encountered |
java.lang.Object |
visit(xacute.quilt.LetBinding let)
The let binding will add a rename operator to show the binding. |
java.lang.Object |
visit(xacute.quilt.LocationStep lstep)
Determines the type of XPath (child, descendant-or-self) Contains an axis variable Calls the NodeTest object The result is either a NameTest or NodeType object visit call |
java.lang.Object |
visit(xacute.quilt.Nav nav)
A new Navigate node is created. |
java.lang.Object |
visit(xacute.quilt.QuiltQuery q)
This is the first pattern that is visited The QuiltQuery object contains the entire query The visitor pattern visits the body of the QuiltQuery object, which is the entire Quilt query For each function definitions it will create a new XAT tree. |
java.lang.Object |
visit(xacute.quilt.RenameUpdate re)
Called when a Rename Update is encountered |
java.lang.Object |
visit(xacute.quilt.ReplaceUpdate rep)
Called when a Replace Update is encountered |
java.lang.Object |
visit(xacute.quilt.SequenceExpression seq)
Visit sequence expression will just link all the expressions together. |
java.lang.Object |
visit(xacute.quilt.SortClause sort)
Called when a sortyby command is called in a query |
java.lang.Object |
visit(xacute.quilt.TagNameable tag)
The tag name data is found in the TagNameable object A tag node is created for the taggerTree (Tag node data structure) |
java.lang.Object |
visit(xacute.quilt.UnOpMinus minusOp)
It will return a Vector of 1) expression and 2) subtree of required operators. |
java.lang.Object |
visit(xacute.quilt.UnOpNot notOp)
It will return a Vector of 1) expression and 2) subtree of required operators. |
java.lang.Object |
visit(xacute.quilt.ValueBool valBool)
Visit a Boolean value |
java.lang.Object |
visit(xacute.quilt.ValueNum valNum)
Visit a Boolean value |
java.lang.Object |
visit(xacute.quilt.ValueString val)
Returns the ValueString object as a string Used for source nodes and select nodes. |
java.lang.Object |
visit(xacute.quilt.Var var)
Visits a binding variable Contains the entry point for a navigation node |
Methods inherited from class edu.wpi.cs.dsrg.xmldb.xat.common.visitorpattern.InheritableVisitor |
getAncestors,
getMethod,
visit,
visit |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected OperatorBuilder builder
Constructor Detail |
public ParserTraverse()
public ParserTraverse(boolean debugMain)
Method Detail |
public java.lang.Object dispatch()
public java.lang.Object dispatch(java.lang.Object obj)
public java.lang.Object dispatch(java.lang.Object ob1, java.lang.Object ob2)
public XATTree expressionVectorToXAT(java.util.Vector expVector)
expVector
- Vector to be converted.public XATTree getTree()
public XATTree getTree(java.lang.String functionName)
functionName
- function to get the XAT tree.public XATTree handleWhereClause(xacute.quilt.FLWRExpression flwr, XATTree returnClause, java.lang.String returnCol)
flwr
- XQurey's FLWR ExpressionreturnClause
- XAT Tree already generated for Return ClausereturnCol
- Returned column namepublic boolean isDebug()
protected XATTree mergeTreeWithSources(XATTree top, XATTree bottom)
If there is a source operator, then the lower part are copied many times with product operator.
top
- edu.wpi.cs.dsrg.xmldb.xat.common.treestructure.XATTreebottom
- edu.wpi.cs.dsrg.xmldb.xat.common.treestructure.XATTreepublic void setDebug(boolean debug)
debug
- booleanpublic java.lang.Object visit(xacute.quilt.BinOpAND andOp)
andOp
- xacute.quilt.BinOpANDBinOpAND
public java.lang.Object visit(xacute.quilt.BinOpArith arith)
arith
- xacute.quilt.BinOpArithBinOpArith
public java.lang.Object visit(xacute.quilt.BinOpCOMP comp)
comp
- xacute.quilt.BinOpCOMPBinOpCOMP
public java.lang.Object visit(xacute.quilt.BinOpOR orOp)
orOp
- xacute.quilt.BinOpORBinOpOR
public java.lang.Object visit(xacute.quilt.BinOpUnion union)
union
- xacute.quilt.BinOpUnionBinOpUnion
public java.lang.Object visit(xacute.quilt.CurrentNode curN)
curN
- xacute.quilt.CurrentNodeVarStepImp
public java.lang.Object visit(xacute.quilt.DeleteUpdate del)
del
- DeleteUpdateDeleteUpdate
public java.lang.Object visit(xacute.quilt.ElementConstruct ec)
ec
- the element construct expression to be visited.ElementConstruct
public java.lang.Object visit(xacute.quilt.FilterExpression filterExpr)
filterExpr
- xacute.quilt.FilterExpressionFilterExpression
public java.lang.Object visit(xacute.quilt.FLWRExpression flwr)
The tree should be like: Aggregate -> (Sort) -> For bindings -> (Where) -> Return Clause -> (Let bindings) | result | | returnClause |
flwr
- FLWR expression.public java.lang.Object visit(xacute.quilt.FLWUExpression flwu)
flwu
- FLWU expression.public java.lang.Object visit(xacute.quilt.ForBinding b)
b
- ForBindingpublic java.lang.Object visit(xacute.quilt.FunCall funPrim)
funPrim
- xacute.quilt.FunCallpublic java.lang.Object visit(xacute.quilt.FunDef fundef)
fundef
- xacute.quilt.FunDefpublic java.lang.Object visit(xacute.quilt.FunUserDefined funUD)
param
- xacute.quilt.FunUserDefinedpublic java.lang.Object visit(xacute.quilt.IfThenElse ite)
ite
- xacute.quilt.IfThenElsepublic java.lang.Object visit(xacute.quilt.InsertUpdate ins)
InsertUpdate
- inspublic java.lang.Object visit(xacute.quilt.LetBinding let)
let
- xacute.quilt.LetBindingpublic java.lang.Object visit(xacute.quilt.LocationStep lstep)
The LocationStep will be converted into one Navigate operator with optional multiple select operators.
The axies have: AXISSPECIFIERS = {"ancestor", "ancestor-or-self", "attribute", "child", "descendant", "descendant-or-self", "following", "following-sibling", "namespace", "parent", "preceding", "preceding-sibling", "self"};
lstep
- LocationSteppublic java.lang.Object visit(xacute.quilt.Nav nav)
NavCollection Operator is created instead of NavigationImp.
In the ForBinding, we will add a NavigateImp (unnesting) to iterate the answers.
If the LocationStep has a filter, then a rename (dummy) is created at the root, so that, we know which column is the focus.
For the locationstep, it will return a vector. Also, for the E, it returns a XATTree or a String for the Var.
nav
- Navpublic java.lang.Object visit(xacute.quilt.QuiltQuery q) throws FactoryException
q
- QuiltQuerypublic java.lang.Object visit(xacute.quilt.RenameUpdate re)
RenameUpdate
- republic java.lang.Object visit(xacute.quilt.ReplaceUpdate rep)
ReplaceUpdate
- reppublic java.lang.Object visit(xacute.quilt.SequenceExpression seq)
seq
- xacute.quilt.SequenceExpressionpublic java.lang.Object visit(xacute.quilt.SortClause sort)
sort
- SortClausepublic java.lang.Object visit(xacute.quilt.TagNameable tag)
tag
- TagNameablepublic java.lang.Object visit(xacute.quilt.UnOpMinus minusOp)
andOp
- xacute.quilt.UniOpMinuspublic java.lang.Object visit(xacute.quilt.UnOpNot notOp)
andOp
- xacute.quilt.UniOpNotpublic java.lang.Object visit(xacute.quilt.ValueBool valBool)
valBool
- xacute.quilt.ValueBoolpublic java.lang.Object visit(xacute.quilt.ValueNum valNum)
valNum
- xacute.quilt.ValueNumpublic java.lang.Object visit(xacute.quilt.ValueString val)
val
- xacute.quilt.ValueStringpublic java.lang.Object visit(xacute.quilt.Var var)
var
- Var
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |