NodeConstructExpression Class Reference

Represents an XQuery XML element with or without an expression inside. More...

#include <nodeconstructexpression.h>

Inheritance diagram for NodeConstructExpression:

Inheritance graph
[legend]
Collaboration diagram for NodeConstructExpression:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 NodeConstructExpression (const char *_tag, Expression *_exp)
 Constructor.
virtual ~NodeConstructExpression ()
virtual void scopeCheck (vector< unsigned > &def_vars, vector< unsigned > &introduced_vars, vector< unsigned > &violating_vars)
virtual void replaceVarId (unsigned old_id, unsigned new_id)
virtual void mergeSequences ()
virtual void extractFSAMap (FSAMap *fsamap, unsigned parent_var)
virtual void extractParVarMap (ParVarMap *parvarmap)
virtual void extractDependencies (vector< DependencySet * > *depset)
virtual ExpressionplaceSignOffs (vector< SignOffExpression * > &signoffs)
virtual void rewriteWhereExps ()
virtual void rewriteEmptyFuncts ()
virtual void rewriteVarstepCondExps ()
virtual void rewriteAggregateFuncts ()
virtual void rewriteVarsteps ()
virtual void print (OutputStream &dos) const
virtual void init (BufferNode *root)
virtual void eval (OutputStream &eos, Environment *env, unsigned modus)

Private Attributes

TAG tag
 The entered TAG (tagname).
Expressionexp
 The entered Expression.


Detailed Description

Represents an XQuery XML element with or without an expression inside.

Represents an XQuery XML element with or without an expression inside, which takes therefore a TAG as XML element and a Expression, e.g. <tag>fn:count($x)</tag> or <tag/>, as arguments.

Note:
In the case that there is no expression inside an XML element, this object is not initialized with NULL as Expression but instead an EmptyExpression is used!

Tagnames are internally represented by numbers!

Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 54 of file nodeconstructexpression.h.


Constructor & Destructor Documentation

NodeConstructExpression::NodeConstructExpression ( const char *  _tag,
Expression _exp 
)

Constructor.

Constructor - creating object for a string (tagname) and a Expression.

Parameters:
[in] _tag Pointer to a char object.
[in] _exp Pointer to a Expression object.

Definition at line 37 of file nodeconstructexpression.cpp.

NodeConstructExpression::~NodeConstructExpression (  )  [virtual]

Destructor.

Definition at line 45 of file nodeconstructexpression.cpp.

References exp.


Member Function Documentation

void NodeConstructExpression::eval ( OutputStream eos,
Environment env,
unsigned  modus 
) [virtual]

Evaluates the expression in the given environment.

Evaluates the expression in the given environment. The evaluation takes place in the environment that is passed to this method. In addition, the parameter modus is one of the following: EVAL_QUERY, EVAL_QUERY_SILENT or EVAL_SIGNOFF (see also the corresponding defines for more information). This method implements the XQuery semantics for the standard expression types, but also the GCX specific extensions like signOff-statements.

Parameters:
[in] eos Pointer to a OutputStream object.
[in] env Pointer to an Environment object.
[in] modus The query evaluation mode.
Exceptions:
RuntimeException If illegal evaluation mode.

Reimplemented from Expression.

Definition at line 139 of file nodeconstructexpression.cpp.

References Expression::eval(), EVAL_QUERY, EVAL_SIGNOFF, exp, TagMap::getTag(), Expression::getType(), tag, and Expression::tagmap.

void NodeConstructExpression::extractDependencies ( vector< DependencySet * > *  depset  )  [virtual]

Extracts the needed dependencies of a query.

Extracts the needed dependencies of a query, which are needed for constructing the ProjectionTree.

Parameters:
[in,out] depset Pointer to a vector containing Pointer to DependencySet objects.
Return values:
void 

Reimplemented from Expression.

Definition at line 72 of file nodeconstructexpression.cpp.

References exp, and Expression::extractDependencies().

void NodeConstructExpression::extractFSAMap ( FSAMap fsamap,
unsigned  parent_var 
) [virtual]

Extracts the needed first straight ancestor (FSA) variables map.

Extracts the needed first straight ancestor (FSA) variables map, which is needed for correct insertion of SignOffExpression.

Parameters:
[in,out] fsamap Pointer to a FSAMap object.
[in] parent_var Parent variable.
Return values:
void 

Reimplemented from Expression.

Definition at line 63 of file nodeconstructexpression.cpp.

References exp, and Expression::extractFSAMap().

void NodeConstructExpression::extractParVarMap ( ParVarMap parvarmap  )  [virtual]

Extracts the needed parent variable (ParVar) map.

Extracts the needed parent variable (ParVar) map, which is needed for constructing the VariableTree.

Parameters:
[in,out] parvarmap Pointer to a ParVarMap object.
Return values:
void 

Reimplemented from Expression.

Definition at line 68 of file nodeconstructexpression.cpp.

References exp, and Expression::extractParVarMap().

void NodeConstructExpression::init ( BufferNode root  )  [virtual]

Initializes the query for evaluation.

Initializes the query for evaluation. Up to now only all required BufferIterator objects are created to speed up query evaluation.

Parameters:
[in] root Pointer to a BufferNode object.
Return values:
void 

Reimplemented from Expression.

Definition at line 135 of file nodeconstructexpression.cpp.

References exp, and Expression::init().

void NodeConstructExpression::mergeSequences (  )  [virtual]

Merges belonging together XQuery sequences into a single sequence.

Merges belonging together XQuery sequences into a single sequence, which is done because of better/nicer output look.

Return values:
void 

Reimplemented from Expression.

Definition at line 59 of file nodeconstructexpression.cpp.

References exp, and Expression::mergeSequences().

Expression * NodeConstructExpression::placeSignOffs ( vector< SignOffExpression * > &  signoffs  )  [virtual]

Places all signOff-statements in the corresponding query.

Places all signOff-statements in the corresponding query, which are needed for active garbage collection by removing Role from the BufferNode.

Parameters:
[in] signoffs Pointer to a vector containing Pointer to SignOffExpression objects.
Return values:
Expression* Pointer to a Expression object (following expression in the corresponding query).

Reimplemented from Expression.

Definition at line 77 of file nodeconstructexpression.cpp.

References exp, and Expression::placeSignOffs().

void NodeConstructExpression::print ( OutputStream dos  )  const [virtual]

Prints the expression.

Prints the expression.

Parameters:
[in] dos Pointer to a OutputStream object.
Return values:
void 

Implements Expression.

Definition at line 116 of file nodeconstructexpression.cpp.

References decrementIndents(), exp, TagMap::getTag(), Expression::getType(), incrementIndents(), NEWLINE, tag, Expression::tagmap, and writeIndents().

void NodeConstructExpression::replaceVarId ( unsigned  old_id,
unsigned  new_id 
) [virtual]

Replaces all matching variable IDs by a new one.

Replaces all matching variable IDs by a new one, which is needed in case of calling method rewriteVarsteps().

Parameters:
[in] old_id Old variable ID.
[in] new_id New variable ID, which should be introduced instead.
Return values:
void 

Reimplemented from Expression.

Definition at line 55 of file nodeconstructexpression.cpp.

References exp, and Expression::replaceVarId().

void NodeConstructExpression::rewriteAggregateFuncts (  )  [virtual]

Rewrites all arguments of all aggregate functions into an equivalent for-clause (with return-clause).

Rewrites all arguments of all aggregate functions into an equivalent for-clause (with return-clause).

Return values:
void 

Reimplemented from Expression.

Definition at line 97 of file nodeconstructexpression.cpp.

References exp, and Expression::rewriteAggregateFuncts().

void NodeConstructExpression::rewriteEmptyFuncts (  )  [virtual]

Rewrites all fn:empty XQuery functions into equivalent fn:not(fn:exists) XQuery functions.

Rewrites all fn:empty XQuery functions into equivalent fn:not(fn:exists) XQuery functions.

Return values:
void 

Reimplemented from Expression.

Definition at line 89 of file nodeconstructexpression.cpp.

References exp, and Expression::rewriteEmptyFuncts().

void NodeConstructExpression::rewriteVarstepCondExps (  )  [virtual]

Rewrites all if($x) if-conditions into equivalent if(fn:not(fn:empty($x))) XQuery expressions.

Rewrites all if($x) if-conditions into equivalent if(fn:not(fn:empty($x))) XQuery expressions.

Return values:
void 

Reimplemented from Expression.

Definition at line 93 of file nodeconstructexpression.cpp.

References exp, and Expression::rewriteVarstepCondExps().

void NodeConstructExpression::rewriteVarsteps (  )  [virtual]

Rewrites all varstep expressions, which produces output into an equivalent for-clause (with return-clause).

Rewrites all varstep expressions, which produces output into an equivalent for-clause (with return-clause). This method belongs to the 'earlier execution of signoff-statements' optimization.

Return values:
void 

Reimplemented from Expression.

Definition at line 101 of file nodeconstructexpression.cpp.

References VarExpression::clone(), exp, VarName::getInstance(), Expression::getType(), and Expression::rewriteVarsteps().

void NodeConstructExpression::rewriteWhereExps (  )  [virtual]

Rewrites all where-clauses in the query into equivalent if-expressions.

Rewrites all where-clauses in the query into equivalent if-expressions, i.e. rewrites all WhereExpression into equivalent IfExpression.

Return values:
void 

Reimplemented from Expression.

Definition at line 85 of file nodeconstructexpression.cpp.

References exp, and Expression::rewriteWhereExps().

void NodeConstructExpression::scopeCheck ( vector< unsigned > &  def_vars,
vector< unsigned > &  introduced_vars,
vector< unsigned > &  violating_vars 
) [virtual]

Returns if all used variables were previously (through a for-clause) defined or if a variable leaves their defined scope.

Returns if all used variables were previously (through a for-clause) defined or if a variable leaves their defined scope.

Parameters:
[in] def_vars Vector containing all previously defined variables.
[in] introduced_vars Vector containing all up to this expression defined variables.
[in] violating_vars Vector containing all variables which violates the scope condition.
Return values:
void 

Reimplemented from Expression.

Definition at line 49 of file nodeconstructexpression.cpp.

References exp, and Expression::scopeCheck().


Member Data Documentation

The entered TAG (tagname).

The entered TAG (tagname), which is the first argument of the constructor and internally represented by a number.

Definition at line 152 of file nodeconstructexpression.h.

Referenced by eval(), and print().


Generated on Sun May 24 20:20:26 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9