Instances of the class StaticContext contain the information that is available at the time the query is compiled. More...
Public Member Functions | |
void | addColation (const std::string &aURI) |
Adds a collation URI. | |
bool | addNamespace (const std::string &aPrefix, const std::string &aURI) |
Add a pair (prefix, URI) to the statically known namespaces that are available during query compilation. | |
bool | containsFunction (const std::string &aFnNameUri, const std::string &aFnNameLocal, int arity) const |
Check if a function with the given name and arity are registered in the context. | |
StaticContext | createChildContext () const |
Create a child static context, i.e. | |
void | declareOption (const Item &aQName, const std::string &aOptionVal) |
Declare an option (same as using declare option in XQuery) | |
void | destroy () |
Destroy this object from memory. | |
void | disableFunction (const Item &aQName, int arity) |
std::string | getBaseURI () const |
Get the base URI. | |
ZorbaConstants::BoundarySpaceMode | getBoundarySpacePolicy () |
Get the boundary space policy. | |
TypeIdentifier | getCollectionType (const std::string &aCollectionUri) |
Get the type of a statically known collection. | |
ZorbaConstants::ConstructionMode | getConstructionMode () |
Get the construction mode. | |
TypeIdentifier | getContextItemStaticType () |
Fetch the type of the context item. | |
ZorbaConstants::InheritMode | getCopyNamespacesModeInherit () |
Get the copy namespace mode for Preserve. | |
ZorbaConstants::PreserveMode | getCopyNamespacesModePreserve () |
Get the copy namespace mode for Preserve. | |
std::string | getDefaultCollation () const |
Get the URI of the default collation. | |
std::string | getDefaultElementAndTypeNamespace () const |
Get the default element and type namespace URI. | |
std::string | getDefaultFunctionNamespace () const |
Get the default function namespace. | |
ZorbaConstants::OrderEmptyMode | getDefaultOrderForEmptySequences () |
Get the default order for the empty sequence. | |
TypeIdentifier | getDocumentType (const std::string &aDocUri) |
Get the type of a statically known document. | |
void | getExternalVariables (Iterator &vars) const |
Returns the QName of all external variables within the static context. | |
std::vector< std::pair < std::string, std::string > > | getNamespaceBindings () |
Get the list of all namespace bindings (prefix, uri) declared in this and its parent static contexts. | |
std::string | getNamespaceURIByPrefix (const std::string &aPrefix) const |
Get the namespace URI for a given prefix. | |
bool | getOption (const Item &aQName, std::string &aOptionValue) const |
Get an option that was declared using the declare option syntax. | |
ZorbaConstants::OrderingMode | getOrderingMode () |
Get the ordering mode. | |
ZorbaConstants::RevalidationMode | getRevalidationMode () |
Get the revalidation mode. | |
StaticCollectionManager | getStaticCollectionManager () |
Returns a CollectionManager responsible for all collections which are statically declared in this static context. | |
ZorbaConstants::XPath1_0CompatibleMode | getXPath1_0CompatibMode () |
Get the XPath 1.0 compatibility mode. | |
void | loadProlog (const std::string &aProlog, const CompilerHints &hints) |
Loads the declarations and definitions of a given XQuery prolog into this static context. | |
void | resetTraceStream () |
Resets the output stream that is used by the fn:trace function to std::cerr. | |
bool | setBaseURI (const std::string &aBaseURI) |
Set the base URI. | |
bool | setBoundarySpacePolicy (ZorbaConstants::BoundarySpaceMode aMode) |
Set the boundary space policy. | |
bool | setConstructionMode (ZorbaConstants::ConstructionMode aMode) |
Set the construction mode. | |
void | setContextItemStaticType (const TypeIdentifier &aType) |
Set the type of the context item. | |
bool | setCopyNamespacesMode (ZorbaConstants::PreserveMode aPreserve, ZorbaConstants::InheritMode aInherit) |
Set the copy namespace mode. | |
void | setDefaultCollation (const std::string &aURI) |
Set the URI of the default collation. | |
bool | setDefaultElementAndTypeNamespace (const std::string &aURI) |
Set the default element and type namespace (see http://www.w3.org/TR/xquery/#static_context) | |
bool | setDefaultFunctionNamespace (const std::string &aURI) |
Set the default functionnamespace (see http://www.w3.org/TR/xquery/#static_context) | |
bool | setDefaultOrderForEmptySequences (ZorbaConstants::OrderEmptyMode aMode) |
Set the default order for the empty sequence. | |
void | setLIBPath (std::vector< std::string > &aLIBPath) |
Set the library lookup path (list of filesystem directories) for this static context. | |
void | setModulePath (std::vector< std::string > &aModulePath) |
Set the URI and library lookup paths (lists of filesystem directories) for this static context. | |
bool | setOrderingMode (ZorbaConstants::OrderingMode aMode) |
Set the ordering mode. | |
void | setRevalidationMode (ZorbaConstants::RevalidationMode aMode) |
Set the revalidation mode. | |
void | setURIPath (std::vector< std::string > &aURIPath) |
Set the URI lookup path (list of filesystem directories) for this static context. | |
bool | setXPath1_0CompatibMode (ZorbaConstants::XPath1_0CompatibleMode aMode) |
Set the XPath 1.0 compatibility mode. | |
StaticContext (const StaticContext &aStaticContext) | |
StaticContext (zorba::StaticContext_t aStaticContext) |
Friends | |
class | XQuery |
class | Zorba |
Instances of the class StaticContext contain the information that is available at the time the query is compiled.
This class contains the information that is defined in the XQuery specification (see http://www.w3.org/TR/xquery/#static_context).
A StaticContext can be created by calling Zorba::createStaticContext and then be passed to the Zorba::compileQuery or XQuery::compile functions. If no static context has been passed to any of these functions, a default static context is used. It can be accessed by calling XQuery::getStaticContext on a compiled XQuery object.
Definition at line 79 of file StaticContext.h.
StaticContext::StaticContext | ( | const StaticContext & | aStaticContext | ) |
StaticContext::StaticContext | ( | zorba::StaticContext_t | aStaticContext | ) |
void StaticContext::addColation | ( | const std::string & | aURI | ) |
Adds a collation URI.
The URI specifies the locale and collation strength of the collation that is added. A valid collation URI must begin with http://www.zorba-xquery.com/collations/. This prefix is followed by a collation strength (i.e. PRIMARY, SECONDARY, TERTIARY, QUATTERNARY, or IDENTICAL) followed by a '/'. After the strength a lower-case two- or three-letter ISO-639 language code must follow. The URI may end with an upper-case two-letter ISO-3166. For example, http://www.zorba-xquery.com/collations/PRIMARY/en/US specifies an english language with US begin the country..
Internally, ICU is used for comparing strings. For detailed description see http://www.icu-project.org/apiref/icu4c/classCollator.html and http://www.icu-project.org/apiref/icu4c/classLocale.html
aURI | the URI of the collation. |
ZorbaException | if an error occured (e.g. the URI was not a valid collation URI). |
bool StaticContext::addNamespace | ( | const std::string & | aPrefix, |
const std::string & | aURI | ||
) |
Add a pair (prefix, URI) to the statically known namespaces that are available during query compilation.
See http://www.w3.org/TR/xquery/#static_context.
aPrefix | the prefix String. |
aURI | the URI String. |
ZorbaException | if an error occures. |
bool StaticContext::containsFunction | ( | const std::string & | aFnNameUri, |
const std::string & | aFnNameLocal, | ||
int | arity | ||
) | const |
Check if a function with the given name and arity are registered in the context.
StaticContext StaticContext::createChildContext | ( | ) | const |
Create a child static context, i.e.
a context with the same information, of the given static context.
A child static context carries the same context as it's parent but can override any information.
void StaticContext::declareOption | ( | const Item & | aQName, |
const std::string & | aOptionVal | ||
) |
Declare an option (same as using declare option in XQuery)
aQName | The QName of the option to declare. |
aOptionVal | The value of the option to declare. |
void StaticContext::destroy | ( | ) |
Destroy this object from memory.
void StaticContext::disableFunction | ( | const Item & | aQName, |
int | arity | ||
) |
std::string StaticContext::getBaseURI | ( | ) | const |
Get the base URI.
ZorbaConstants::BoundarySpaceMode StaticContext::getBoundarySpacePolicy | ( | ) |
Get the boundary space policy.
(see http://www.w3.org/TR/xquery/#static_context)
TypeIdentifier StaticContext::getCollectionType | ( | const std::string & | aCollectionUri | ) |
Get the type of a statically known collection.
ZorbaConstants::ConstructionMode StaticContext::getConstructionMode | ( | ) |
Get the construction mode.
(see http://www.w3.org/TR/xquery/#static_context)
TypeIdentifier StaticContext::getContextItemStaticType | ( | ) |
Fetch the type of the context item.
ZorbaConstants::InheritMode StaticContext::getCopyNamespacesModeInherit | ( | ) |
Get the copy namespace mode for Preserve.
(see http://www.w3.org/TR/xquery/#static_context)
ZorbaConstants::PreserveMode StaticContext::getCopyNamespacesModePreserve | ( | ) |
Get the copy namespace mode for Preserve.
(see http://www.w3.org/TR/xquery/#static_context)
std::string StaticContext::getDefaultCollation | ( | ) | const |
Get the URI of the default collation.
std::string StaticContext::getDefaultElementAndTypeNamespace | ( | ) | const |
Get the default element and type namespace URI.
ZorbaException | if an error occured. |
std::string StaticContext::getDefaultFunctionNamespace | ( | ) | const |
Get the default function namespace.
ZorbaException | if an error occured. |
ZorbaConstants::OrderEmptyMode StaticContext::getDefaultOrderForEmptySequences | ( | ) |
Get the default order for the empty sequence.
(see http://www.w3.org/TR/xquery/#static_context)
TypeIdentifier StaticContext::getDocumentType | ( | const std::string & | aDocUri | ) |
Get the type of a statically known document.
void StaticContext::getExternalVariables | ( | Iterator & | vars | ) | const |
Returns the QName of all external variables within the static context.
vars | iterator to store the results. |
ZorbaException | if an error occured. |
std::vector< std::pair< std::string, std::string > > StaticContext::getNamespaceBindings | ( | ) |
Get the list of all namespace bindings (prefix, uri) declared in this and its parent static contexts.
std::string StaticContext::getNamespaceURIByPrefix | ( | const std::string & | aPrefix | ) | const |
Get the namespace URI for a given prefix.
aPrefix | the prefix for which to retrieve the namespace URI. |
ZorbaException | if an error occured (e.g. no URI could be found for the given prefix). |
bool StaticContext::getOption | ( | const Item & | aQName, |
std::string & | aOptionValue | ||
) | const |
Get an option that was declared using the declare option syntax.
aQName | The QName of the option to get. |
aOptionValue | The value of the option if found. |
ZorbaConstants::OrderingMode StaticContext::getOrderingMode | ( | ) |
Get the ordering mode.
(see http://www.w3.org/TR/xquery/#static_context)
ZorbaConstants::RevalidationMode StaticContext::getRevalidationMode | ( | ) |
Get the revalidation mode.
StaticCollectionManager StaticContext::getStaticCollectionManager | ( | ) |
Returns a CollectionManager responsible for all collections which are statically declared in this static context.
The collection manager provides a set of functions for managing collections and their contents.
ZorbaConstants::XPath1_0CompatibleMode StaticContext::getXPath1_0CompatibMode | ( | ) |
Get the XPath 1.0 compatibility mode.
(see http://www.w3.org/TR/xquery/#static_context)
void StaticContext::loadProlog | ( | const std::string & | aProlog, |
const CompilerHints & | hints | ||
) |
Loads the declarations and definitions of a given XQuery prolog into this static context.
This function compiles the prolog passed as first parameter and loads all declarations and definitions into this static context.
The static context extended by this prolog can then be used for creating a compiling a new query.
A StaticException is raised if the prolog could not be compiled or if the prolog does not contain valid declarations (e.g. duplicate declarations).
void StaticContext::resetTraceStream | ( | ) |
Resets the output stream that is used by the fn:trace function to std::cerr.
bool StaticContext::setBaseURI | ( | const std::string & | aBaseURI | ) |
Set the base URI.
(see http://www.w3.org/TR/xquery/#static_context)
aBaseURI | the base URI as String. |
bool StaticContext::setBoundarySpacePolicy | ( | ZorbaConstants::BoundarySpaceMode | aMode | ) |
Set the boundary space policy.
(see http://www.w3.org/TR/xquery/#static_context)
aMode | the boundary space policy. |
bool StaticContext::setConstructionMode | ( | ZorbaConstants::ConstructionMode | aMode | ) |
Set the construction mode.
(see http://www.w3.org/TR/xquery/#static_context)
aMode | the construction mode. |
void StaticContext::setContextItemStaticType | ( | const TypeIdentifier & | aType | ) |
Set the type of the context item.
bool StaticContext::setCopyNamespacesMode | ( | ZorbaConstants::PreserveMode | aPreserve, |
ZorbaConstants::InheritMode | aInherit | ||
) |
Set the copy namespace mode.
(see http://www.w3.org/TR/xquery/#static_context)
aPreserve | the preserve mode. |
aInherit | the inherit mode. |
void StaticContext::setDefaultCollation | ( | const std::string & | aURI | ) |
Set the URI of the default collation.
(see http://www.w3.org/TR/xquery/#static_context)
aURI | URI of the default collation. |
ZorbaException | if an error occured (e.g., the URI does not identify a collation among the statically known collations. |
bool StaticContext::setDefaultElementAndTypeNamespace | ( | const std::string & | aURI | ) |
Set the default element and type namespace (see http://www.w3.org/TR/xquery/#static_context)
aURI | of the default element and type namespace URI. |
ZorbaException | if an error occured. |
bool StaticContext::setDefaultFunctionNamespace | ( | const std::string & | aURI | ) |
Set the default functionnamespace (see http://www.w3.org/TR/xquery/#static_context)
aURI | of the default function namespace. |
ZorbaException | if an error occured. |
bool StaticContext::setDefaultOrderForEmptySequences | ( | ZorbaConstants::OrderEmptyMode | aMode | ) |
Set the default order for the empty sequence.
(see http://www.w3.org/TR/xquery/#static_context)
aMode | the default order for the empty sequence. |
void StaticContext::setLIBPath | ( | std::vector< std::string > & | aLIBPath | ) |
Set the library lookup path (list of filesystem directories) for this static context.
Queries which import modules that have external function implementations will look for the implementation of those functions (shared libraries) in these directories.
void StaticContext::setModulePath | ( | std::vector< std::string > & | aModulePath | ) |
Set the URI and library lookup paths (lists of filesystem directories) for this static context.
Note that calling this method will override any values previously passed to StaticContext::setURIPath() and StaticContext::setLibPath().
Convenience method which adds the listed directories to both the URI path and Library path for this static context.
bool StaticContext::setOrderingMode | ( | ZorbaConstants::OrderingMode | aMode | ) |
Set the ordering mode.
(see http://www.w3.org/TR/xquery/#static_context)
aMode | the ordering mode. |
void StaticContext::setRevalidationMode | ( | ZorbaConstants::RevalidationMode | aMode | ) |
Set the revalidation mode.
aMode | the revalidation mode. |
void StaticContext::setURIPath | ( | std::vector< std::string > & | aURIPath | ) |
Set the URI lookup path (list of filesystem directories) for this static context.
Queries which resolve URIs (for instance, importing modules or schemas) will look in these directories.
bool StaticContext::setXPath1_0CompatibMode | ( | ZorbaConstants::XPath1_0CompatibleMode | aMode | ) |
Set the XPath 1.0 compatibility mode.
(see http://www.w3.org/TR/xquery/#static_context)
aMode | the XPath 1.0 compatibility mode. |
|
friend |
Definition at line 82 of file StaticContext.h.
|
friend |
Definition at line 81 of file StaticContext.h.