PathExpression Class Reference

Represents an XQuery path expression. More...

#include <pathexpression.h>

Inheritance diagram for PathExpression:

Inheritance graph
[legend]
Collaboration diagram for PathExpression:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PathExpression ()
 Constructor.
virtual ~PathExpression ()
void addPathStep (PathStepExpression *ps)
 Appends a new path step expression to the end of this path expression.
virtual void print (OutputStream &dos) const
vector< PathStepExpression * > * getPathSteps ()
 Returns all path step expressions of this path expression.
unsigned getPathSize ()
 Returns the (current) path expression size.
PathStepExpressiongetPathStepAt (unsigned i)
 Returns the path step expression of a path expression at a specific position.
PathStepExpressiongetTailPathStep ()
 Returns the last path step expression of a path expression.
PathStepExpressiongetPathStepAfterTextNodeTest ()
 Returns the path step expression after the first text() node test of a path expression.
unsigned getWeight ()
 Returns the weight as a whole of a path expression.
PathExpressionAdornmentgetAdornment ()
 Returns the path expression adornments.
bool isEmptyPath ()
 Returns if this path expression is empty.
bool isDosNodePath ()
 Returns if this path expression has a dos::node() PathStepExpression at his end.
bool isSyntacticallyEqualTo (PathExpression *path)
 Returns if this path expression is syntactically equal to the entered path expression.
bool isSemanticallyContainedIn (PathExpression *path)
 Returns if this path expression is semantically contained in the entered path expression.
bool hasInnerTextNodeTest ()
 Returns if the path expression has an inner text() node test PathStepExpression.
bool hasTerminatingTextNodeTest ()
 Returns if the path expression has an text() node test PathStepExpression at his end.
bool hasFollowingDescendantOrDosFrom (unsigned ps_idx)
 Returns if the path expression has a following /dos or /descendant axis from a specific position on.
bool hasPreviousDescendantOrDosUpTo (unsigned ps_idx)
 Returns if the path expression has a previous /dos or /descendant axis from a specific position on.
bool selectsNoNode ()
 Returns if the path expression selects/locates no nodes of an arbitrary XML tree.
bool containsStarDescendantSequence (unsigned pos)
 Returns if the path expression contains a sequence of wildcard /* node tests from a specific position on.
bool mightHasChildDescendantConflict (PathExpression *path)
 Checks if there is a child-descendant conflict that forces the path step to be kept anyway, i.e. such that no projection can be applied.
void replacePathStepAt (unsigned idx, PathStepExpression *ps)
 Replaces a path step expression at a specific position of a path expression by a new path step expression.
PathExpressionclone ()
 Returns a new, independent copy of a path expression or of this object respectively.
PathExpressioncloneWithoutFinalDosNodeAndAttributes ()
 Returns a new, independent copy of a path expression or of this object respectively without an ending /dos PathStepExpression or any PathStepAttribute.

Private Attributes

vector< PathStepExpression * > pathsteps
PathExpressionAdornmentadornment


Detailed Description

Represents an XQuery path expression.

Represents an XQuery path expression, which takes a number of path step expressions as argument.

Author:
Michael Schmidt

Gunnar Jehl

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

Definition at line 54 of file pathexpression.h.


Constructor & Destructor Documentation

PathExpression::PathExpression (  ) 

Constructor.

Constructor - creating object for stepwise addition of path step expressions.

Definition at line 37 of file pathexpression.cpp.

Referenced by clone(), and cloneWithoutFinalDosNodeAndAttributes().

PathExpression::~PathExpression (  )  [virtual]

Destructor.

Definition at line 41 of file pathexpression.cpp.

References adornment, and pathsteps.


Member Function Documentation

void PathExpression::addPathStep ( PathStepExpression ps  )  [inline]

Appends a new path step expression to the end of this path expression.

Appends a new path step expression to the end of this path expression.

Parameters:
[in] ps Pointer to a PathStepExpression object.
Return values:
void 

Definition at line 73 of file pathexpression.h.

References pathsteps.

Referenced by clone(), cloneWithoutFinalDosNodeAndAttributes(), PathEnvironment::getPathBetween(), ProjectionTreeNode::getRootPath(), DependencySet::insertTuple(), PathEnvironment::PathEnvironment(), PathExpressionAdornment::PathExpressionAdornment(), DependencyTuple::registerToPassiveProjectionTree(), and Role::Role().

PathExpression * PathExpression::clone (  ) 

Returns a new, independent copy of a path expression or of this object respectively.

Returns a new, independent copy of a path expression or of this object respectively.

Return values:
PathExpression* Copy of a path expression or of this object respectively.

Definition at line 466 of file pathexpression.cpp.

References addPathStep(), PathExpression(), and pathsteps.

Referenced by VarStepExpression::clone(), Role::getSignOffExpression(), DependencySet::insertTuple(), DependencyTuple::registerToPassiveProjectionTree(), and Role::Role().

PathExpression * PathExpression::cloneWithoutFinalDosNodeAndAttributes (  ) 

Returns a new, independent copy of a path expression or of this object respectively without an ending /dos PathStepExpression or any PathStepAttribute.

Returns a new, independent copy of a path expression or of this object respectively without an ending /dos PathStepExpression or any PathStepAttribute.

Return values:
PathExpression* Copy of a path expression or of this object respectively without an ending /dos PathStepExpression or any PathStepAttribute.

Definition at line 476 of file pathexpression.cpp.

References addPathStep(), PathExpression(), and pathsteps.

Referenced by VarStepExpression::cloneWithoutFinalDosNodeAndAttributes().

bool PathExpression::containsStarDescendantSequence ( unsigned  pos  ) 

Returns if the path expression contains a sequence of wildcard /* node tests from a specific position on.

Returns if the path expression contains a sequence of wildcard /* node tests from a specific position on.

Parameters:
[in] pos Position at which the path step expression should be checked.
Return values:
bool true if the path expression contains a sequence of wildcard /* node tests from a specific position on, false otherwise.

Definition at line 394 of file pathexpression.cpp.

References pathsteps.

Referenced by PathExpressionAdornment::PathExpressionAdornment().

PathExpressionAdornment * PathExpression::getAdornment (  ) 

Returns the path expression adornments.

Returns the path expression adornments.

Return values:
PathExpressionAdornment* Pointer to a PathExpressionAdornment object.

Definition at line 90 of file pathexpression.cpp.

References adornment.

Referenced by isSemanticallyContainedIn().

unsigned PathExpression::getPathSize (  )  [inline]

PathStepExpression * PathExpression::getPathStepAfterTextNodeTest (  ) 

Returns the path step expression after the first text() node test of a path expression.

Returns the path step expression after the first text() node test of a path expression.

Return values:
PathStepExpression* Pointer to a PathStepExpression object.

Definition at line 62 of file pathexpression.cpp.

References pathsteps.

Referenced by BufferIterator::BufferIterator(), BufferIterator::init(), and BufferIterator::reset().

PathStepExpression * PathExpression::getPathStepAt ( unsigned  i  )  [inline]

Returns the path step expression of a path expression at a specific position.

Returns the path step expression of a path expression at a specific position.

Parameters:
[in] i Position at which the path step expression should be obtained.
Return values:
PathStepExpression* Pointer to a PathStepExpression object.

Definition at line 104 of file pathexpression.h.

References pathsteps.

Referenced by BufferIterator::BufferIterator(), BufferIterator::debugPrint(), PathEnvironment::getPathBetween(), ProjectionTreeLabel::getPathStep(), ProjectionTreeNode::getRootPath(), BufferIterator::init(), BufferIterator::isMatchingNodeTestAndPredicates(), BufferIterator::isSatisfyingPath(), isSemanticallyContainedIn(), mightHasChildDescendantConflict(), PathExpressionAdornment::PathExpressionAdornment(), PassiveProjectionTreeNode::registerPath(), DependencyTuple::registerToPassiveProjectionTree(), and BufferIterator::reset().

vector< PathStepExpression * > * PathExpression::getPathSteps (  )  [inline]

Returns all path step expressions of this path expression.

Returns all path step expressions of this path expression, i.e. returns the member variable.

Return values:
vector<PathStepExpression*>* Pointer to a vector containing PathStepExpression objects.

Definition at line 85 of file pathexpression.h.

References pathsteps.

Referenced by BufferIterator::debugPrint(), PathEnvironment::getPathBetween(), isSyntacticallyEqualTo(), PathExpressionAdornment::PathExpressionAdornment(), and Role::Role().

PathStepExpression * PathExpression::getTailPathStep (  ) 

Returns the last path step expression of a path expression.

Returns the last path step expression of a path expression.

Return values:
PathStepExpression* Pointer to a PathStepExpression object.

Definition at line 54 of file pathexpression.cpp.

References pathsteps.

Referenced by DependencySet::insertTuple(), Role::isDosRole(), DependencyTuple::isDosTuple(), Role::isPosRole(), DependencyTuple::isPosTuple(), PathExpressionAdornment::PathExpressionAdornment(), and ProjectionTreeNode::removeRedundantRoles().

unsigned PathExpression::getWeight (  ) 

Returns the weight as a whole of a path expression.

Returns the weight as a whole of a path expression.

Return values:
unsigned Weight as a whole of a path expression.

Definition at line 76 of file pathexpression.cpp.

References pathsteps.

bool PathExpression::hasFollowingDescendantOrDosFrom ( unsigned  ps_idx  ) 

Returns if the path expression has a following /dos or /descendant axis from a specific position on.

Returns if the path expression has a following /dos or /descendant axis from a specific position on.

Parameters:
[in] ps_idx Position at which the path step expression should be checked.
Return values:
bool true if the path expression has a following /dos or /descendant axis from a specific position on, false otherwise.

Definition at line 357 of file pathexpression.cpp.

References pathsteps.

bool PathExpression::hasInnerTextNodeTest (  ) 

Returns if the path expression has an inner text() node test PathStepExpression.

Returns if the path expression has an inner text() node test PathStepExpression.

Return values:
bool true if the path expression has an inner text() node test PathStepExpression, false otherwise.

Definition at line 341 of file pathexpression.cpp.

References pathsteps.

Referenced by BufferIterator::BufferIterator(), BufferIterator::init(), ProjectionTreeNode::removeUnneededNodes(), and BufferIterator::reset().

bool PathExpression::hasPreviousDescendantOrDosUpTo ( unsigned  ps_idx  ) 

Returns if the path expression has a previous /dos or /descendant axis from a specific position on.

Returns if the path expression has a previous /dos or /descendant axis from a specific position on.

Parameters:
[in] ps_idx Position at which the path step expression should be checked.
Return values:
bool true if the path expression has a previous /dos or /descendant axis from a specific position on, false otherwise.

Definition at line 368 of file pathexpression.cpp.

References pathsteps.

Referenced by BufferIterator::BufferIterator().

bool PathExpression::hasTerminatingTextNodeTest (  ) 

Returns if the path expression has an text() node test PathStepExpression at his end.

Returns if the path expression has an text() node test PathStepExpression at his end.

Return values:
bool true if the path expression has an text() node test PathStepExpression at his end, false otherwise.

Definition at line 351 of file pathexpression.cpp.

References pathsteps.

bool PathExpression::isDosNodePath (  ) 

Returns if this path expression has a dos::node() PathStepExpression at his end.

Returns if this path expression has a dos::node() PathStepExpression at his end.

Return values:
bool true f this path expression has a dos::node() PathStepExpression at his end, false otherwise.

Definition at line 98 of file pathexpression.cpp.

References pathsteps.

bool PathExpression::isEmptyPath (  )  [inline]

bool PathExpression::isSemanticallyContainedIn ( PathExpression path  ) 

Returns if this path expression is semantically contained in the entered path expression.

Returns if this path expression is semantically contained in the entered path expression.

Note:
The current implementations does not consider PathStepAttribute and therefore invoking this method on any path expression would maybe lead to wrong results!
Parameters:
[in] path Pointer to a PathExpression object (path expression to be compared).
Return values:
bool true if this path expression is semantically contained in the entered path expression, false otherwise.

Definition at line 123 of file pathexpression.cpp.

References PathExpressionAdornment::getAdornedPath(), getAdornment(), PathStepExpression::getAxisType(), PathStepTagExpression::getNodeTest(), PathExpressionAdornment::getPathAdornments(), getPathSize(), getPathStepAt(), PathExpressionAdornment::getRewrittenPath(), PathExpressionAdornment::isChildNodePath(), PathExpressionAdornment::isChildTextPath(), PathExpressionAdornment::isDescendantNodePath(), PathExpressionAdornment::isDescendantTextPath(), PathExpressionAdornment::isDosNodePath(), PathStepExpression::isStarNodeTest(), and PathStepExpression::isTagNodeTest().

Referenced by DependencyTuple::isSemanticallyContainedIn().

bool PathExpression::isSyntacticallyEqualTo ( PathExpression path  ) 

Returns if this path expression is syntactically equal to the entered path expression.

Returns if this path expression is syntactically equal to the entered path expression.

Parameters:
[in] path Pointer to a PathExpression object (path expression to be compared).
Return values:
bool true if this path expression is syntactically equal to the entered path expression, false otherwise.

Definition at line 107 of file pathexpression.cpp.

References getPathSize(), getPathSteps(), and pathsteps.

Referenced by DependencyTuple::isSyntacticallyEqualTo().

bool PathExpression::mightHasChildDescendantConflict ( PathExpression path  ) 

Checks if there is a child-descendant conflict that forces the path step to be kept anyway, i.e. such that no projection can be applied.

A simple example for such a child-descendant conflict are two path expressions /a/d and //d. Here, such a conflict arises: when we read the document starting sequence <a><c> for instance, we are not allowed to project the <c>-tag away, although it is not matched by any of the projection paths. The reason is simple: consider the document <a><c><d/></c></a> and the query <q>{ <one>{ /a/d }</one>, <two>{ //d }</two> }</q>. It is easy to see that this query gives different results when evaluated on documents <a><c><d/></c></a> and <a><d/></a>. We denote this situation as child-descendant conflict, and in such cases the <c>-tag cannot be projected away, as witnessed by the above example. We refer the interested reader to the paper for more details.

Parameters:
[in] path Pointer to a PathExpression object.
Return values:
bool true if the current path has a child-descendant conflict with the passed path, false otherwise.

Definition at line 406 of file pathexpression.cpp.

References PathStepExpression::getAxisType(), PathStepTagExpression::getNodeTest(), getPathSize(), getPathStepAt(), PathStepExpression::isDosNodeStep(), PathStepExpression::isTagNodeTest(), and PathStepExpression::isTextNodeTest().

Referenced by DependencyTuple::isSemanticallyContainedIn().

void PathExpression::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 48 of file pathexpression.cpp.

References pathsteps.

void PathExpression::replacePathStepAt ( unsigned  idx,
PathStepExpression ps 
)

Replaces a path step expression at a specific position of a path expression by a new path step expression.

Replaces a path step expression at a specific position of a path expression by a new path step expression.

Parameters:
[in] idx Position at which replacement should take place.
[in] ps Pointer to a PathStepExpression object.
Return values:
void 

Definition at line 458 of file pathexpression.cpp.

References pathsteps.

Referenced by PathExpressionAdornment::PathExpressionAdornment().

bool PathExpression::selectsNoNode (  ) 

Returns if the path expression selects/locates no nodes of an arbitrary XML tree.

Returns if the path expression selects/locates no nodes of an arbitrary XML tree.

Return values:
bool true if the path expression selects/locates no nodes of an arbitrary XML tree, false otherwise.

Definition at line 383 of file pathexpression.cpp.

References pathsteps.

Referenced by PathExpressionAdornment::PathExpressionAdornment().


Member Data Documentation

The adornments associated with this path expression.

Definition at line 287 of file pathexpression.h.

Referenced by getAdornment(), and ~PathExpression().


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