SourceForge.net Logo

XQQuery Class Reference

Encapsulates a query expression. More...

#include <XQQuery.hpp>

Inheritance diagram for XQQuery:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ~XQQuery ()
 Destructor.
Runtime Methods
DynamicContextcreateDynamicContext (xercesc::MemoryManager *memMgr=xercesc::XMLPlatformUtils::fgMemoryManager) const
 Creates a DynamicContext based on the static context used to parse this query.
Result execute (DynamicContext *context) const
 Executes the query using the given DynamicContext, returning a lazy iterator over the results.
void execute (EventHandler *events, DynamicContext *context) const
 Executes the query using the given DynamicContext, sending the output of the query to the given EventHandler.
void staticResolution (StaticContext *context=0)
 Perform static resolution on the query.
void staticTyping (StaticContext *context=0)
 Perform type calculation and related optimizations.
Query Information
const XMLCh * getQueryText () const
 Returns the expression that was parsed to create this XQQuery object.
std::string getQueryPlan () const
 Returns the query plan as XML. This is designed for debug and informative purposes only.
Getters and Setters
ASTNode * getQueryBody () const
 Get the query body as an ASTNode.
void setQueryBody (ASTNode *query)
 Set the query body to an ASTNode.
void addFunction (XQUserFunction *fnDef)
 Adds an XQUserFunction to the query.
const UserFunctionsgetFunctions () const
 Returns a vector of all XQUserFunction objects from the query.
void addVariable (XQGlobalVariable *varDef)
 Adds a XQGlobalVariable to the query.
const GlobalVariablesgetVariables () const
 Returns a vector of all XQGlobalVariable objects from the query.
const ImportedModulesgetImportedModules () const
 Returns a vector of all XQGlobalVariable objects from the query.
const XMLCh * getFile () const
 Returns the name of the file that this query was parsed from.
void setFile (const XMLCh *file)
 Sets the name of the file that this query was parsed from.
const DynamicContextgetStaticContext () const
Module Methods
void setIsLibraryModule (bool bIsModule=true)
 Sets whether this query is a module or not.
bool getIsLibraryModule () const
 Returns whether this query is a module or not.
void setModuleTargetNamespace (const XMLCh *uri)
 Sets the module target namespace for this query.
const XMLCh * getModuleTargetNamespace () const
 Gets the module taget namespace for this query.
void importModule (const XMLCh *szUri, VectorOfStrings *locations, StaticContext *context, const LocationInfo *location)
 Performs a module import from the given target namespace and locations.

Classes

class  QueryResult
 Top level lazy result iterator.

Detailed Description

Encapsulates a query expression.

XQQuery objects are thread safe, and can be executed from multiple threads at the same time - provided a DynamicContext is used per thread.

Instances of this class can be created by using the parsing methods on the XQilla object.

This class is dependant on the DynamicContext that was used to create it. This context must not be deleted before the XQQuery object. Normally this is acheived by the XQQuery adopting the DynamicContext and deleting it when it is deleted. However, this behaviour can be disabled by using the XQilla::NO_ADOPT_CONTEXT flag when creating the XQQuery.


Constructor & Destructor Documentation

XQQuery::~XQQuery (  ) 

Destructor.


Member Function Documentation

DynamicContext* XQQuery::createDynamicContext ( xercesc::MemoryManager memMgr = xercesc::XMLPlatformUtils::fgMemoryManager  )  const

Creates a DynamicContext based on the static context used to parse this query.

This DynamicContext will be suitable for using to call execute().

Parameters:
memMgr The memory manager used to create the DynamicContext.
Returns:
An implementation of DynamicContext

Result XQQuery::execute ( DynamicContext context  )  const

Executes the query using the given DynamicContext, returning a lazy iterator over the results.

Parameters:
context The DynamicContext to use to execute the query. This contains runtime values for variables, the value of the context item, and other relevent information.
Returns:
The Result object - a lazy iterator over the query results.
Exceptions:
XQException If a runtime error occurs

void XQQuery::execute ( EventHandler events,
DynamicContext context 
) const

Executes the query using the given DynamicContext, sending the output of the query to the given EventHandler.

Parameters:
context The DynamicContext to use to execute the query. This contains runtime values for variables, the value of the context item, and other relevent information.
Exceptions:
XQException If a runtime error occurs

void XQQuery::staticResolution ( StaticContext context = 0  ) 

Perform static resolution on the query.

This operation is not thread safe, and should only be performed once.

Static reolution resolves prefixes to namespace URIs, variable names to variables, function names to functions, and performs some basic query optimisation.

Normally this is done as part of parsing the query expression. However, if the XQilla::NO_STATIC_RESOLUTION flag was specified when the query was parsed, this method will have to be called to perform this step manually.

Parameters:
context If specified, the StaticContext to use to statically resolve this object. By default, the context used to parse the query is used. This should not need to be changed under normal usage.
Exceptions:
XQException If a static resolution time error occurs

void XQQuery::staticTyping ( StaticContext context = 0  ) 

Perform type calculation and related optimizations.

This operation is safe to call multiple times.

Normally this step is done as part of static resolution.

Parameters:
context If specified, the StaticContext to use to statically resolve this object. By default, the context used to parse the query is used. This should not need to be changed under normal usage.
Exceptions:
XQException If a static resolution time error occurs

const XMLCh* XQQuery::getQueryText (  )  const

Returns the expression that was parsed to create this XQQuery object.

std::string XQQuery::getQueryPlan (  )  const

Returns the query plan as XML. This is designed for debug and informative purposes only.

ASTNode* XQQuery::getQueryBody (  )  const

Get the query body as an ASTNode.

void XQQuery::setQueryBody ( ASTNode *  query  ) 

Set the query body to an ASTNode.

void XQQuery::addFunction ( XQUserFunction *  fnDef  ) 

Adds an XQUserFunction to the query.

const UserFunctions& XQQuery::getFunctions (  )  const [inline]

Returns a vector of all XQUserFunction objects from the query.

void XQQuery::addVariable ( XQGlobalVariable *  varDef  ) 

Adds a XQGlobalVariable to the query.

const GlobalVariables& XQQuery::getVariables (  )  const [inline]

Returns a vector of all XQGlobalVariable objects from the query.

const ImportedModules& XQQuery::getImportedModules (  )  const [inline]

Returns a vector of all XQGlobalVariable objects from the query.

const XMLCh* XQQuery::getFile (  )  const

Returns the name of the file that this query was parsed from.

void XQQuery::setFile ( const XMLCh *  file  ) 

Sets the name of the file that this query was parsed from.

const DynamicContext* XQQuery::getStaticContext (  )  const [inline]

void XQQuery::setIsLibraryModule ( bool  bIsModule = true  ) 

Sets whether this query is a module or not.

bool XQQuery::getIsLibraryModule (  )  const

Returns whether this query is a module or not.

void XQQuery::setModuleTargetNamespace ( const XMLCh *  uri  ) 

Sets the module target namespace for this query.

const XMLCh* XQQuery::getModuleTargetNamespace (  )  const

Gets the module taget namespace for this query.

void XQQuery::importModule ( const XMLCh *  szUri,
VectorOfStrings locations,
StaticContext context,
const LocationInfo location 
)

Performs a module import from the given target namespace and locations.


The documentation for this class was generated from the following file:
Generated on Mon Apr 28 16:41:10 2008 for XQilla Simple API by  doxygen 1.5.1