MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.contextConfig
Class Context

java.lang.Object
  extended by ch.ethz.mxquery.contextConfig.Context
All Implemented Interfaces:
XQDynamicContext, XQStaticContext

public final class Context
extends java.lang.Object
implements XQStaticContext, XQDynamicContext

This class represents a unified context implementation, covering XQuery static and dynamic contexts as well as MXQuery-specific additions Context nesting/scoping works as follows: 1) A singleton "global" context for all instances of MXQuery within an JVM 2) A "root" context for each compiled query/exposed module 3) nested contexts for lexical scopes The "global" context carries the - built-in functions - default settings for static context values - the well-known and default namespaces - the dictionary of all user-defined types A root context carries the - user-defined functions - the store set - the collections - the prolog settings of the static context


Field Summary
static java.lang.String ANONYM_VARIABLE_PREFIX
           
static java.lang.String ANONYM_VARIABLE_URI
           
static QName CONTEXT_ITEM
           
static java.lang.String DEFAULT_COLLECTION_URI
           
static int DTD_VALIDATION
           
 Location location
           
static int NO_VALIDATION
           
static int NONVALIDATED_INPUT_MODE_DOM
           
static int NONVALIDATED_INPUT_MODE_SAX
           
static int NONVALIDATED_INPUT_MODE_SAX_TIDY
           
static int NONVALIDATED_INPUT_MODE_STAX
           
static int NONVALIDATED_INPUT_MODE_XPP
          Choice of input parser
static java.lang.String PARSER_TYPE
           
static int SCHEMA_VALIDATION_LAX
           
static int SCHEMA_VALIDATION_STRICT
           
 
Fields inherited from interface ch.ethz.mxquery.contextConfig.XQStaticContext
CODEPOINT_COLLATION_URI, COPY_MODE_INHERIT, COPY_MODE_NO_INHERIT, COPY_MODE_NO_PRESERVE, COPY_MODE_PRESERVE, NS_ERR, NS_XML, NS_XMLNS, ORDER_GREATEST, ORDER_LEAST, ORDERED, PRESERVE, REVALIDATION_LAX, REVALIDATION_SKIP, REVALIDATION_STRICT, STRIP, UNORDERED, URI_ERR, URI_FN, URI_LOCAL, URI_XDT, URI_XML, URI_XMLNS, URI_XS, URI_XSI
 
Constructor Summary
Context()
          Creates a new root context with a separate store set
Context(Context parent)
          Creates a new context with the given parent
Context(Context parent, StoreSet stores)
          Create a new context with the given parent and the given store set
 
Method Summary
 java.lang.String addAnonymousNamespace(java.lang.String uri)
          This methods adds a new namespace to the context and returns the prefix (if the namespace already exists) or creates an anonymous namespace just for internal use
 void addFunction(Function function)
          Adds a function to the context
 void addFunction(Function function, boolean checkExistence, boolean external)
          Adds a function to the context
 void addModuleContext(XQStaticContext modCtx)
          Adds an context to the list of module contexts
 void addModuleLocation(java.lang.String moduleNS_URI, java.lang.String location)
          Add the locations URI where the contents of a module identified by the namespace moduleNS_URI can be found
 void addNamespace(Namespace ns)
          Add a namespace mapping.
 void addNamespace(java.lang.String prefix, java.lang.String uri)
          Add a prefix/namespace mapping.
 void addSchemaLocation(java.lang.String schemaURI, java.lang.String schemaLocation)
           
 boolean addTargetNamespace(java.lang.String targetNamespace)
          Adds a targetNamespace to the current context
 void bindVariableValue(QName qname, XDMIterator iter)
          Bind the value of this variable directly to XDM instance generated by the iterator
 boolean checkVariable(QName qname)
          Check if the variable is defined
 void clearModuleContexts()
           
 void clearModuleLocation()
          Clear this list of locations mapping between module identifiers and locations
 boolean containsTargetNamespace(java.lang.String targetNamespace)
           
 Context copy()
           
 void exposeModule()
           
 void flattenVariablesFrom(QName[] fsVars, Context innermostContext)
           
 java.util.Hashtable getAllNamespaces()
           
 java.util.Vector getAllNsURI()
           
 java.util.Hashtable getAllVariables()
           
 java.lang.String getBaseURI()
          Get the base URI.
 Set getCollations()
          Get the statically known collations
 java.lang.String getConstructionMode()
          Gets the construction mode of the Context
 VariableHolder getContextItem()
           
 boolean getCopyNamespacesInheritMode()
          Returns which Inherit setting of the copy namespace mode is set
 boolean getCopyNamespacesPreserveMode()
          Returns which Preserve setting of the copy namespace mode is set
 MXQueryDateTime getCurrentTime()
          Get the "current" time (the time that was current when XQDynamicContext.setCurrentTime(MXQueryDateTime) was called).
 MXQueryDayTimeDuration getCurrentTimeZone()
          Get the "current" time zone (at the time that was current when XQDynamicContext.setCurrentTime(MXQueryDateTime) was called).
 java.lang.String getDefaultCollation()
          Get the default collation
 java.lang.String getDefaultElementNamespace()
          Gets the defaultElementNamespace attribute of the Context object
 java.lang.String getDefaultElementPrefix()
          Returns the default function prefix, which can be an anonymous prefix
 java.lang.String getDefaultFunctionNamespace()
          Gets the defaultFunctionNamespace attribute of the Context object
 java.lang.String getDefaultFunctionPrefix()
          Returns the default function prefix, which can be an anonymous prefix
 java.lang.String getDefaultOrderEmptySequence()
          Returns the default order for empty sequences
static TypeDictionary getDictionary()
           
 int getFTCase()
          Set the Full Text Case Option
 java.lang.String getFTLanguage()
          Get the Full Text Language Option
 FTStopWordsMatchOption getFTStopWords()
          Get the full text stopwords option, i.e.
 FTThesaurusMatchOption getFTThesaurus()
          Set the full text thesaurus option, i.e.
 Function getFunction(QName qname, int arity)
          Get a function with a name and number of parameters
 java.util.Hashtable getFunctions(java.lang.String namespace)
          Get all functions with in particular namespace
static Context getGlobalContext()
          Access the global context explicitly
 int getInputValidationMode()
          Shall input be validated?
 java.lang.String getLocationOfSchema(java.lang.String schemaURI)
           
 java.util.Vector getModuleContexts()
           
 java.util.Vector getModuleLocation(java.lang.String moduleNS_URI)
          Retrieve the list of locations where the contents of the module are stored
 void getModuleLocations(Context ctx)
           
 java.lang.String getModuleURI()
          Gets the module URI if available or null.
 Namespace getNamespace(java.lang.String prefix)
          Gets the namespace URI associated with the given prefix
 java.lang.String getOrderingMode()
           
 Context getParent()
          Gets the parent Context of this Context.
 int getParserType()
          Return the parser type that is the default for XML parsing
 int getPosition()
          Get the Context Position: the position of the context item within the current context
 java.lang.String getPrefix(java.lang.String uri)
          get the (namespace-)prefix for a given URI.
 int getRevalidationMode()
          Return the revalidation mode for update expressions
 Context getRootContext()
          Access the root context explicitly
 boolean getsetBoundarySpaceHandling()
          Gets the whitespaceHandling attribute of the Context object
 StoreSet getStores()
          Returns the store set for XQueryUpdate.
 VariableHolder getVariable(QName qname)
          Get the reference to the variable and its binding
 VariableHolder getVariable(QName qname, boolean resolve)
          Get the reference to the variable and its binding
 java.lang.String getWebServiceEndpointName()
           
 java.lang.String getWebServiceName()
           
 Namespace getWebServiceNamespace()
          Returns the namespace of the to exposing web service functions
 int getWebServicePort()
          Returns the web service port
 java.util.Hashtable getWSFunctions(java.lang.String namespace)
           
 void incVariableUse(QName qname)
          Indicate that there are more users for this variable
static TypeDictionary initDictionary()
          Initializes the dictionary to be used in this context
 boolean isAnecstorContext(XQStaticContext ctx)
          Checks if the given Context is an ancestor of this context
 boolean isFTDiacriticsSensitive()
          Get the full text diacritics sensitive option
 boolean isFTStemming()
          Get the full text stemming option, i.e.
 boolean isFTWildcard()
          Get the full text wildcard option, i.e.
 boolean isModuleContext()
          Checks if the context belongs to a module The property it is a module is not inherited with the context.
 boolean isWebService()
          Returns if the context is declared as a web service.
 boolean isXPath10Compat()
          Get the XPath 1.0 Compatibility setting
 QName registerAnonymousVariable()
          Registers a new "anonymous" (=internal) variable
 void registerNewContextItem()
          Registers a new context item in this scope
 void registerVariable(QName qname, boolean isFFLWOR)
          Registers a new variable.
 void registerVariable(QName qname, boolean external, boolean isFFLWOR, XDMIterator seqTypeIter, boolean assignable)
          Registers a new variable.
 void registerVariable(QName qname, boolean external, boolean isFFLWOR, XDMIterator seqTypeIter, boolean resolve, boolean assignable)
          Registers a new variable.
 void registerVariable(QName qname, boolean isFFLWOR, XDMIterator seqTypeIter, boolean assignable)
          Registers a new variable.
 void removeNamespace(java.lang.String prefix)
          Remove a prefix/namespace from mapping.
 void setBaseURI(java.lang.String uri)
          Sets the base URI.
 void setBoundarySpaceHandling(boolean value)
          Sets the boundary Space Handling attribute of the Context object
 void setConstructionMode(java.lang.String value)
          Sets the construction mode of the Context
 void setContextItem(XDMIterator iter)
           
 void setCopyNamespacesMode(boolean preserve, boolean inherit)
          Set the copy namespaces modes for element construction, see 3.7.1.3 and 4.9 of the spec
 void setCurrentTime(MXQueryDateTime dateTime)
          Stores the current time in the context.
 void setCurrentTimeZone(java.util.TimeZone tz)
          Set the current time zone
 void setDefaultCollation(java.lang.String coll)
           
 void setDefaultElementNamespace(java.lang.String URI)
          Sets the defaultElementNamespace attribute of the Context object
 void setDefaultFunctionNamespace(java.lang.String URI)
          Sets the defaultFunctionNamespace attribute of the Context object
 void setDefaultOrderEmptySequence(java.lang.String value)
          Sets the default order for empty sequences.
static void setDictionary(TypeDictionary dict)
          Set the type dictionary
 void setFTCase(int caseOpt)
          Set the Full Text Case Option
 void setFTDiacriticsSensitive(boolean sensitive)
          Set the full text diacritics sensitive option (i.e.
 void setFTLanguage(java.lang.String lan)
          Set the Full Text Language Option
 void setFTStemming(boolean stemming)
          Set the full text stemming option, i.e.
 void setFTStopwords(FTStopWordsMatchOption sw)
          Set the full text stopwords option, i.e.
 void setFTThesaurus(FTThesaurusMatchOption thes)
          Set the full text thesaurus option, i.e.
 void setFTWildcard(boolean wildcards)
          Set the full text wildcard option, i.e.
 void setInputValidationMode(int valMode)
          Set the Type of input validation
 void setModuleContext(boolean isModule)
          Sets if the context belongs to a module
 void setModuleURI(java.lang.String uri)
          Sets the module URI
 void setOrderingMode(java.lang.String value)
          Sets the Ordering mode, which has the value ordered or unordered, affects the ordering of the result sequence returned by certain path expressions, union, intersect, and except expressions, and FLWOR expressions that have no order by clause.] Details are provided in the descriptions of these expressions.
 void setParent(Context ctx)
          Set/replace the parent with the given context
 void setParserType(int pType)
           
 void setPosition(int position)
          Set the Context Position: the position of the context item within the current context
 void setRevalidationMode(int valMode)
          Set the revalidation mode for update expressions
 void setVariableValue(QName qname, XDMIterator iter)
          Set the value of this variable, implicitly creating/reusing stores if needed
 void setVariableValue(QName qname, XDMIterator iter, boolean check, boolean resolve)
          Set the value of this variable, implicitly creating/reusing stores if needed
 void setWebService(boolean isWebService)
           
 void setWebService(int port, Namespace namespace)
          Prepares the context for as a webservice
 void setWebServiceEndpointName(java.lang.String endpointName)
           
 void setWebServiceName(java.lang.String serviceName)
           
 void setWebServiceNamespace(Namespace namespace)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSER_TYPE

public static final java.lang.String PARSER_TYPE
See Also:
Constant Field Values

CONTEXT_ITEM

public static final QName CONTEXT_ITEM

ANONYM_VARIABLE_URI

public static final java.lang.String ANONYM_VARIABLE_URI
See Also:
Constant Field Values

ANONYM_VARIABLE_PREFIX

public static final java.lang.String ANONYM_VARIABLE_PREFIX
See Also:
Constant Field Values

DEFAULT_COLLECTION_URI

public static final java.lang.String DEFAULT_COLLECTION_URI
See Also:
Constant Field Values

NONVALIDATED_INPUT_MODE_XPP

public static final int NONVALIDATED_INPUT_MODE_XPP
Choice of input parser

See Also:
Constant Field Values

NONVALIDATED_INPUT_MODE_STAX

public static final int NONVALIDATED_INPUT_MODE_STAX
See Also:
Constant Field Values

NONVALIDATED_INPUT_MODE_SAX

public static final int NONVALIDATED_INPUT_MODE_SAX
See Also:
Constant Field Values

NONVALIDATED_INPUT_MODE_DOM

public static final int NONVALIDATED_INPUT_MODE_DOM
See Also:
Constant Field Values

NONVALIDATED_INPUT_MODE_SAX_TIDY

public static final int NONVALIDATED_INPUT_MODE_SAX_TIDY
See Also:
Constant Field Values

NO_VALIDATION

public static final int NO_VALIDATION
See Also:
Constant Field Values

DTD_VALIDATION

public static final int DTD_VALIDATION
See Also:
Constant Field Values

SCHEMA_VALIDATION_LAX

public static final int SCHEMA_VALIDATION_LAX
See Also:
Constant Field Values

SCHEMA_VALIDATION_STRICT

public static final int SCHEMA_VALIDATION_STRICT
See Also:
Constant Field Values

location

public Location location
Constructor Detail

Context

public Context()
Creates a new root context with a separate store set


Context

public Context(Context parent)
Creates a new context with the given parent

Parameters:
parent - the parent context

Context

public Context(Context parent,
               StoreSet stores)
Create a new context with the given parent and the given store set

Parameters:
parent - if not null, this will be the parent context of the newly created context, otherwise this context will be a root context
stores - If the newly created context is a root context, it will use this store set
Method Detail

initDictionary

public static TypeDictionary initDictionary()
Initializes the dictionary to be used in this context

Returns:
the Dictionary of Types to be used in this context

getDictionary

public static TypeDictionary getDictionary()
Returns:
the Dictionary of Types to be used in this context

setDictionary

public static void setDictionary(TypeDictionary dict)
Set the type dictionary

Parameters:
dict -

getPosition

public int getPosition()
Description copied from interface: XQDynamicContext
Get the Context Position: the position of the context item within the current context

Specified by:
getPosition in interface XQDynamicContext
Returns:
-1 if not set, > 0 otherwise

setPosition

public void setPosition(int position)
Description copied from interface: XQDynamicContext
Set the Context Position: the position of the context item within the current context

Specified by:
setPosition in interface XQDynamicContext
Parameters:
position - the position to set, must be > 0

getParserType

public int getParserType()
Return the parser type that is the default for XML parsing

Returns:
the Parser type as in NONVALIDATED_INPUT_MODE_SAX, NONVALIDATED_INPUT_MODE_STAX, NONVALIDATED_INPUT_MODE_DOM etc

setParserType

public void setParserType(int pType)

addTargetNamespace

public boolean addTargetNamespace(java.lang.String targetNamespace)
Adds a targetNamespace to the current context

Parameters:
targetNamespace -
Returns:
true false if targetNamespace is already defined

containsTargetNamespace

public boolean containsTargetNamespace(java.lang.String targetNamespace)

registerVariable

public void registerVariable(QName qname,
                             boolean isFFLWOR)
                      throws MXQueryException
Description copied from interface: XQStaticContext
Registers a new variable. If the variable already exists, an error is thrown.

Specified by:
registerVariable in interface XQStaticContext
Throws:
MXQueryException

registerVariable

public void registerVariable(QName qname,
                             boolean isFFLWOR,
                             XDMIterator seqTypeIter,
                             boolean assignable)
                      throws MXQueryException
Description copied from interface: XQStaticContext
Registers a new variable. If the variable already exists, an error is thrown.

Specified by:
registerVariable in interface XQStaticContext
Throws:
MXQueryException

registerNewContextItem

public void registerNewContextItem()
                            throws MXQueryException
Description copied from interface: XQStaticContext
Registers a new context item in this scope

Specified by:
registerNewContextItem in interface XQStaticContext
Throws:
MXQueryException

registerVariable

public void registerVariable(QName qname,
                             boolean external,
                             boolean isFFLWOR,
                             XDMIterator seqTypeIter,
                             boolean assignable)
                      throws MXQueryException
Description copied from interface: XQStaticContext
Registers a new variable. If the variable already exists, an error is thrown.

Specified by:
registerVariable in interface XQStaticContext
Throws:
MXQueryException

registerVariable

public void registerVariable(QName qname,
                             boolean external,
                             boolean isFFLWOR,
                             XDMIterator seqTypeIter,
                             boolean resolve,
                             boolean assignable)
                      throws MXQueryException
Description copied from interface: XQStaticContext
Registers a new variable. If the variable already exists, an error is thrown.

Specified by:
registerVariable in interface XQStaticContext
Throws:
MXQueryException

registerAnonymousVariable

public QName registerAnonymousVariable()
Description copied from interface: XQStaticContext
Registers a new "anonymous" (=internal) variable

Specified by:
registerAnonymousVariable in interface XQStaticContext
Returns:
the QName of the registered variable

setVariableValue

public void setVariableValue(QName qname,
                             XDMIterator iter,
                             boolean check,
                             boolean resolve)
                      throws MXQueryException
Description copied from interface: XQDynamicContext
Set the value of this variable, implicitly creating/reusing stores if needed

Specified by:
setVariableValue in interface XQDynamicContext
Parameters:
qname - the variable name
iter - the iterator containing the XDM to set
check - if true, the non-existence of name causes an error, otherwise the variable is created
resolve - resolve/qualify name
Throws:
MXQueryException

setVariableValue

public void setVariableValue(QName qname,
                             XDMIterator iter)
                      throws MXQueryException
Description copied from interface: XQDynamicContext
Set the value of this variable, implicitly creating/reusing stores if needed

Specified by:
setVariableValue in interface XQDynamicContext
Parameters:
qname - the variable name
iter - the iterator containing the XDM to set
Throws:
MXQueryException

bindVariableValue

public void bindVariableValue(QName qname,
                              XDMIterator iter)
                       throws MXQueryException
Description copied from interface: XQDynamicContext
Bind the value of this variable directly to XDM instance generated by the iterator

Specified by:
bindVariableValue in interface XQDynamicContext
Parameters:
qname - the variable name
iter - the iterator containing the XDM to bind
Throws:
MXQueryException

getVariable

public VariableHolder getVariable(QName qname)
                           throws MXQueryException
Description copied from interface: XQDynamicContext
Get the reference to the variable and its binding

Specified by:
getVariable in interface XQDynamicContext
Parameters:
qname - the name of the variable
Returns:
a VariableHolder containing information about the variable and its binding
Throws:
MXQueryException

getVariable

public VariableHolder getVariable(QName qname,
                                  boolean resolve)
                           throws MXQueryException
Description copied from interface: XQDynamicContext
Get the reference to the variable and its binding

Specified by:
getVariable in interface XQDynamicContext
Parameters:
qname - the name of the variable
resolve - resolve the QName
Returns:
a VariableHolder containing information about the variable and its binding
Throws:
MXQueryException

checkVariable

public boolean checkVariable(QName qname)
                      throws MXQueryException
Description copied from interface: XQStaticContext
Check if the variable is defined

Specified by:
checkVariable in interface XQStaticContext
Parameters:
qname - the name of the variable
Returns:
true if the variable exists, false otherwise
Throws:
MXQueryException

incVariableUse

public void incVariableUse(QName qname)
                    throws MXQueryException
Description copied from interface: XQDynamicContext
Indicate that there are more users for this variable

Specified by:
incVariableUse in interface XQDynamicContext
Parameters:
qname - Variable name
Throws:
MXQueryException

getStores

public StoreSet getStores()
Description copied from interface: XQDynamicContext
Returns the store set for XQueryUpdate. At the moment only one storeset without nesting is allows

Specified by:
getStores in interface XQDynamicContext

setOrderingMode

public void setOrderingMode(java.lang.String value)
                     throws MXQueryException
Description copied from interface: XQStaticContext
Sets the Ordering mode, which has the value ordered or unordered, affects the ordering of the result sequence returned by certain path expressions, union, intersect, and except expressions, and FLWOR expressions that have no order by clause.] Details are provided in the descriptions of these expressions.

Specified by:
setOrderingMode in interface XQStaticContext
Throws:
MXQueryException

getOrderingMode

public java.lang.String getOrderingMode()
Specified by:
getOrderingMode in interface XQStaticContext

setDefaultOrderEmptySequence

public void setDefaultOrderEmptySequence(java.lang.String value)
                                  throws MXQueryException
Description copied from interface: XQStaticContext
Sets the default order for empty sequences. This component controls the processing of empty sequences and NaN values as ordering keys in an order by clause in a FLWOR expression, as described in 3.8.3 Order By and Return Clauses. Its value may be greatest or least.

Specified by:
setDefaultOrderEmptySequence in interface XQStaticContext
Throws:
MXQueryException

getDefaultOrderEmptySequence

public java.lang.String getDefaultOrderEmptySequence()
Description copied from interface: XQStaticContext
Returns the default order for empty sequences

Specified by:
getDefaultOrderEmptySequence in interface XQStaticContext
Returns:
ORDER_GREATEST or ORDER_LEAST

setCopyNamespacesMode

public void setCopyNamespacesMode(boolean preserve,
                                  boolean inherit)
Description copied from interface: XQStaticContext
Set the copy namespaces modes for element construction, see 3.7.1.3 and 4.9 of the spec

Specified by:
setCopyNamespacesMode in interface XQStaticContext
Parameters:
preserve - keep the namespaces of the original element
inherit - inherit namespaces of the enclosing constructed element

getCopyNamespacesInheritMode

public boolean getCopyNamespacesInheritMode()
Description copied from interface: XQStaticContext
Returns which Inherit setting of the copy namespace mode is set

Specified by:
getCopyNamespacesInheritMode in interface XQStaticContext
Returns:
false if NO INHERIT set, otherwise true

getCopyNamespacesPreserveMode

public boolean getCopyNamespacesPreserveMode()
Description copied from interface: XQStaticContext
Returns which Preserve setting of the copy namespace mode is set

Specified by:
getCopyNamespacesPreserveMode in interface XQStaticContext
Returns:
false if NO PRESERVER set, otherwise true

setWebService

public void setWebService(int port,
                          Namespace namespace)
Prepares the context for as a webservice

Parameters:
port -
namespace -

setWebService

public void setWebService(boolean isWebService)

setWebServiceNamespace

public void setWebServiceNamespace(Namespace namespace)

setWebServiceName

public void setWebServiceName(java.lang.String serviceName)

setWebServiceEndpointName

public void setWebServiceEndpointName(java.lang.String endpointName)

isWebService

public boolean isWebService()
Returns if the context is declared as a web service.

Returns:
true if this context is used by a module that is exported as a web service

getWebServicePort

public int getWebServicePort()
                      throws MXQueryException
Returns the web service port

Returns:
an integer describing the web service port
Throws:
MXQueryException

getWebServiceNamespace

public Namespace getWebServiceNamespace()
                                 throws MXQueryException
Returns the namespace of the to exposing web service functions

Returns:
the namespace of this web service
Throws:
MXQueryException

getWebServiceName

public java.lang.String getWebServiceName()

getWebServiceEndpointName

public java.lang.String getWebServiceEndpointName()

getAllNamespaces

public java.util.Hashtable getAllNamespaces()
Specified by:
getAllNamespaces in interface XQStaticContext
Returns:
All the visible namespace prefix-URI mappings.

getAllVariables

public java.util.Hashtable getAllVariables()
Specified by:
getAllVariables in interface XQStaticContext
Returns:
All the visible name-variable mappings.

getBaseURI

public java.lang.String getBaseURI()
Description copied from interface: XQStaticContext
Get the base URI.

Specified by:
getBaseURI in interface XQStaticContext
Returns:
Returns said URI.

setModuleContext

public void setModuleContext(boolean isModule)
Sets if the context belongs to a module

Parameters:
isModule -

exposeModule

public void exposeModule()

isModuleContext

public boolean isModuleContext()
Checks if the context belongs to a module The property it is a module is not inherited with the context.

Returns:
true, if this the root Context of a module

addModuleContext

public void addModuleContext(XQStaticContext modCtx)
Adds an context to the list of module contexts

Parameters:
modCtx -

clearModuleContexts

public void clearModuleContexts()

getModuleContexts

public java.util.Vector getModuleContexts()

setModuleURI

public void setModuleURI(java.lang.String uri)
Sets the module URI


getModuleURI

public java.lang.String getModuleURI()
Gets the module URI if available or null. Module URI's are not inherited with the context.

Returns:
the URI for this module

getConstructionMode

public java.lang.String getConstructionMode()
Description copied from interface: XQStaticContext
Gets the construction mode of the Context

Specified by:
getConstructionMode in interface XQStaticContext
Returns:
The construction mode value

getCurrentTime

public MXQueryDateTime getCurrentTime()
                               throws MXQueryException
Description copied from interface: XQDynamicContext
Get the "current" time (the time that was current when XQDynamicContext.setCurrentTime(MXQueryDateTime) was called).

Specified by:
getCurrentTime in interface XQDynamicContext
Throws:
MXQueryException

getCurrentTimeZone

public MXQueryDayTimeDuration getCurrentTimeZone()
                                          throws MXQueryException
Description copied from interface: XQDynamicContext
Get the "current" time zone (at the time that was current when XQDynamicContext.setCurrentTime(MXQueryDateTime) was called).

Specified by:
getCurrentTimeZone in interface XQDynamicContext
Throws:
MXQueryException

getDefaultElementNamespace

public java.lang.String getDefaultElementNamespace()
Description copied from interface: XQStaticContext
Gets the defaultElementNamespace attribute of the Context object

Specified by:
getDefaultElementNamespace in interface XQStaticContext
Returns:
The defaultElementNamespace value

getDefaultElementPrefix

public java.lang.String getDefaultElementPrefix()
Description copied from interface: XQStaticContext
Returns the default function prefix, which can be an anonymous prefix

Specified by:
getDefaultElementPrefix in interface XQStaticContext
Returns:
a string expressing the default element prefix

getDefaultFunctionNamespace

public java.lang.String getDefaultFunctionNamespace()
Description copied from interface: XQStaticContext
Gets the defaultFunctionNamespace attribute of the Context object

Specified by:
getDefaultFunctionNamespace in interface XQStaticContext
Returns:
The defaultFunctionNamespace value

getDefaultFunctionPrefix

public java.lang.String getDefaultFunctionPrefix()
Description copied from interface: XQStaticContext
Returns the default function prefix, which can be an anonymous prefix

Specified by:
getDefaultFunctionPrefix in interface XQStaticContext
Returns:
a String representing the default function namespace prefix

getNamespace

public Namespace getNamespace(java.lang.String prefix)
Description copied from interface: XQStaticContext
Gets the namespace URI associated with the given prefix

Specified by:
getNamespace in interface XQStaticContext
Parameters:
prefix - The given prefix
Returns:
The associated namespace URI

getPrefix

public java.lang.String getPrefix(java.lang.String uri)
Description copied from interface: XQStaticContext
get the (namespace-)prefix for a given URI. This acutally iterates through the context entries. This iteration is acceptable, because this method is very rarely used.

Specified by:
getPrefix in interface XQStaticContext
Parameters:
uri - The URI to look for.
Returns:
the Namespace object for this prefix

getParent

public Context getParent()
Gets the parent Context of this Context.

Returns:
Returns said Context or null if none.

setParent

public void setParent(Context ctx)
Set/replace the parent with the given context

Parameters:
ctx - new parent context

isAnecstorContext

public boolean isAnecstorContext(XQStaticContext ctx)
Checks if the given Context is an ancestor of this context

Parameters:
ctx - that is a possible ancestor
Returns:
true if ctx is ancestor, false if not

getRootContext

public Context getRootContext()
Access the root context explicitly

Returns:
the root context of the query/module

addNamespace

public void addNamespace(Namespace ns)
                  throws MXQueryException
Description copied from interface: XQStaticContext
Add a namespace mapping.

Specified by:
addNamespace in interface XQStaticContext
Parameters:
ns - a namespace object containing prefix and uri
Throws:
MXQueryException

addNamespace

public void addNamespace(java.lang.String prefix,
                         java.lang.String uri)
                  throws MXQueryException
Description copied from interface: XQStaticContext
Add a prefix/namespace mapping.

Specified by:
addNamespace in interface XQStaticContext
Parameters:
prefix - The prefix.
uri - The URI of the namespace.
Throws:
MXQueryException

getAllNsURI

public java.util.Vector getAllNsURI()
Specified by:
getAllNsURI in interface XQStaticContext

removeNamespace

public void removeNamespace(java.lang.String prefix)
Description copied from interface: XQStaticContext
Remove a prefix/namespace from mapping.

Specified by:
removeNamespace in interface XQStaticContext
Parameters:
prefix - The prefix of the namespace to be removed

addAnonymousNamespace

public java.lang.String addAnonymousNamespace(java.lang.String uri)
                                       throws MXQueryException
This methods adds a new namespace to the context and returns the prefix (if the namespace already exists) or creates an anonymous namespace just for internal use

Specified by:
addAnonymousNamespace in interface XQStaticContext
Parameters:
uri -
Returns:
the prefix of the anonymous namespace
Throws:
MXQueryException

setBaseURI

public void setBaseURI(java.lang.String uri)
Description copied from interface: XQStaticContext
Sets the base URI.

Specified by:
setBaseURI in interface XQStaticContext
Parameters:
uri - The URI to set.

setConstructionMode

public void setConstructionMode(java.lang.String value)
Description copied from interface: XQStaticContext
Sets the construction mode of the Context

Specified by:
setConstructionMode in interface XQStaticContext
Parameters:
value - The construction mode value

setCurrentTime

public void setCurrentTime(MXQueryDateTime dateTime)
Description copied from interface: XQDynamicContext
Stores the current time in the context. This should be used once at the start of the execution of a query. It is stored here to ensure that all calls to getCurrentTime return the same value.

Specified by:
setCurrentTime in interface XQDynamicContext
Parameters:
dateTime - the time to set as current time - if null, the current system time is used

setCurrentTimeZone

public void setCurrentTimeZone(java.util.TimeZone tz)
Description copied from interface: XQDynamicContext
Set the current time zone

Specified by:
setCurrentTimeZone in interface XQDynamicContext
Parameters:
tz - a Time Zone

setDefaultElementNamespace

public void setDefaultElementNamespace(java.lang.String URI)
                                throws MXQueryException
Description copied from interface: XQStaticContext
Sets the defaultElementNamespace attribute of the Context object

Specified by:
setDefaultElementNamespace in interface XQStaticContext
Parameters:
URI - The new defaultElementNamespace value
Throws:
MXQueryException

setDefaultFunctionNamespace

public void setDefaultFunctionNamespace(java.lang.String URI)
                                 throws MXQueryException
Description copied from interface: XQStaticContext
Sets the defaultFunctionNamespace attribute of the Context object

Specified by:
setDefaultFunctionNamespace in interface XQStaticContext
Parameters:
URI - The new defaultFunctionNamespace value
Throws:
MXQueryException

setBoundarySpaceHandling

public void setBoundarySpaceHandling(boolean value)
Description copied from interface: XQStaticContext
Sets the boundary Space Handling attribute of the Context object

Specified by:
setBoundarySpaceHandling in interface XQStaticContext
Parameters:
value - true - preserve false not preserve

addFunction

public void addFunction(Function function,
                        boolean checkExistence,
                        boolean external)
                 throws MXQueryException
Description copied from interface: XQStaticContext
Adds a function to the context

Specified by:
addFunction in interface XQStaticContext
Throws:
MXQueryException

addFunction

public void addFunction(Function function)
                 throws MXQueryException
Description copied from interface: XQStaticContext
Adds a function to the context

Specified by:
addFunction in interface XQStaticContext
Throws:
MXQueryException

getFunctions

public java.util.Hashtable getFunctions(java.lang.String namespace)
Description copied from interface: XQStaticContext
Get all functions with in particular namespace

Specified by:
getFunctions in interface XQStaticContext
Parameters:
namespace - the namespace in which the functions must be
Returns:
a Hashtable containing (FunctionSignate->Function) entries

getWSFunctions

public java.util.Hashtable getWSFunctions(java.lang.String namespace)
Specified by:
getWSFunctions in interface XQStaticContext

getFunction

public Function getFunction(QName qname,
                            int arity)
                     throws MXQueryException
Description copied from interface: XQStaticContext
Get a function with a name and number of parameters

Specified by:
getFunction in interface XQStaticContext
Parameters:
qname - the name of the function
arity - the number of parameters
Returns:
A function Object containing both the exact signature and means to get the implementation
Throws:
MXQueryException

addModuleLocation

public void addModuleLocation(java.lang.String moduleNS_URI,
                              java.lang.String location)
Add the locations URI where the contents of a module identified by the namespace moduleNS_URI can be found

Specified by:
addModuleLocation in interface XQStaticContext
Parameters:
moduleNS_URI - Namespace of module
location - Location where to retrieve the module contents

getModuleLocation

public java.util.Vector getModuleLocation(java.lang.String moduleNS_URI)
Description copied from interface: XQStaticContext
Retrieve the list of locations where the contents of the module are stored

Specified by:
getModuleLocation in interface XQStaticContext
Parameters:
moduleNS_URI - Namespace of the module
Returns:
the locations/URIs associated with this module

getModuleLocations

public void getModuleLocations(Context ctx)

clearModuleLocation

public void clearModuleLocation()
Description copied from interface: XQStaticContext
Clear this list of locations mapping between module identifiers and locations

Specified by:
clearModuleLocation in interface XQStaticContext

addSchemaLocation

public void addSchemaLocation(java.lang.String schemaURI,
                              java.lang.String schemaLocation)
Specified by:
addSchemaLocation in interface XQStaticContext

getLocationOfSchema

public java.lang.String getLocationOfSchema(java.lang.String schemaURI)
Specified by:
getLocationOfSchema in interface XQStaticContext

getsetBoundarySpaceHandling

public boolean getsetBoundarySpaceHandling()
Description copied from interface: XQStaticContext
Gets the whitespaceHandling attribute of the Context object

Specified by:
getsetBoundarySpaceHandling in interface XQStaticContext
Returns:
The whitespaceHandling value

getInputValidationMode

public int getInputValidationMode()
Shall input be validated?

Returns:
the validation mode

setInputValidationMode

public void setInputValidationMode(int valMode)
Set the Type of input validation

Parameters:
valMode - the validation mode

getCollations

public Set getCollations()
Description copied from interface: XQStaticContext
Get the statically known collations

Specified by:
getCollations in interface XQStaticContext
Returns:
The set of Collations known to the engine

getDefaultCollation

public java.lang.String getDefaultCollation()
Description copied from interface: XQStaticContext
Get the default collation

Specified by:
getDefaultCollation in interface XQStaticContext
Returns:
A String/URI describing the default collation

setDefaultCollation

public void setDefaultCollation(java.lang.String coll)
                         throws MXQueryException
Specified by:
setDefaultCollation in interface XQStaticContext
Throws:
MXQueryException

getContextItem

public VariableHolder getContextItem()
                              throws MXQueryException
Specified by:
getContextItem in interface XQDynamicContext
Throws:
MXQueryException

setContextItem

public void setContextItem(XDMIterator iter)
                    throws MXQueryException
Specified by:
setContextItem in interface XQDynamicContext
Throws:
MXQueryException

copy

public Context copy()
             throws MXQueryException
Throws:
MXQueryException

flattenVariablesFrom

public void flattenVariablesFrom(QName[] fsVars,
                                 Context innermostContext)
                          throws MXQueryException
Throws:
MXQueryException

getRevalidationMode

public int getRevalidationMode()
Description copied from interface: XQStaticContext
Return the revalidation mode for update expressions

Specified by:
getRevalidationMode in interface XQStaticContext
Returns:
one of REVALIDATION_LAX, REVALIDATION_STRICT, REVALIDATION_SKIP

setRevalidationMode

public void setRevalidationMode(int valMode)
                         throws MXQueryException
Description copied from interface: XQStaticContext
Set the revalidation mode for update expressions

Specified by:
setRevalidationMode in interface XQStaticContext
Parameters:
valMode - one of REVALIDATION_LAX, REVALIDATION_STRICT, REVALIDATION_SKIP
Throws:
MXQueryException - If an invalid or unsupported revalidation mode was specified

setFTLanguage

public void setFTLanguage(java.lang.String lan)
Description copied from interface: XQStaticContext
Set the Full Text Language Option

Specified by:
setFTLanguage in interface XQStaticContext

getFTLanguage

public java.lang.String getFTLanguage()
Description copied from interface: XQStaticContext
Get the Full Text Language Option

Specified by:
getFTLanguage in interface XQStaticContext
Returns:
the language identifier (e.g. "en") for the language option

setFTCase

public void setFTCase(int caseOpt)
Description copied from interface: XQStaticContext
Set the Full Text Case Option

Specified by:
setFTCase in interface XQStaticContext
Parameters:
caseOpt - one of FTCaseMatchOption.CASE_INSENSITIVE, CASE_SENSITIVE, CASE_LOWERCASE, CASE_UPPERCASE

getFTCase

public int getFTCase()
Description copied from interface: XQStaticContext
Set the Full Text Case Option

Specified by:
getFTCase in interface XQStaticContext
Returns:
one of FTCaseMatchOption.CASE_INSENSITIVE, CASE_SENSITIVE, CASE_LOWERCASE, CASE_UPPERCASE

setFTDiacriticsSensitive

public void setFTDiacriticsSensitive(boolean sensitive)
Description copied from interface: XQStaticContext
Set the full text diacritics sensitive option (i.e. if diacritics should be considered or not)

Specified by:
setFTDiacriticsSensitive in interface XQStaticContext

isFTDiacriticsSensitive

public boolean isFTDiacriticsSensitive()
Description copied from interface: XQStaticContext
Get the full text diacritics sensitive option

Specified by:
isFTDiacriticsSensitive in interface XQStaticContext
Returns:
true diacritics sensitive, false not sensitive

setFTStemming

public void setFTStemming(boolean stemming)
Description copied from interface: XQStaticContext
Set the full text stemming option, i.e. if stemming should be used in the matching

Specified by:
setFTStemming in interface XQStaticContext
Parameters:
stemming - true stemming should be used, no stemming should not be used

isFTStemming

public boolean isFTStemming()
Description copied from interface: XQStaticContext
Get the full text stemming option, i.e. if stemming should be used in the matching

Specified by:
isFTStemming in interface XQStaticContext
Returns:
true stemming should be used, no stemming should not be used

setFTWildcard

public void setFTWildcard(boolean wildcards)
Description copied from interface: XQStaticContext
Set the full text wildcard option, i.e. if wildcards should be used in the matching

Specified by:
setFTWildcard in interface XQStaticContext
Parameters:
wildcards - true wildcards should be used, no wildscards should not be used

isFTWildcard

public boolean isFTWildcard()
Description copied from interface: XQStaticContext
Get the full text wildcard option, i.e. if wildcards should be used in the matching

Specified by:
isFTWildcard in interface XQStaticContext
Returns:
true wildcards should be used, no wildscards should not be used

setFTStopwords

public void setFTStopwords(FTStopWordsMatchOption sw)
Description copied from interface: XQStaticContext
Set the full text stopwords option, i.e. which stopwords should be used in the matching

Specified by:
setFTStopwords in interface XQStaticContext
Parameters:
sw - A FTStopWordsMatchOption object describing the stopwords

getFTStopWords

public FTStopWordsMatchOption getFTStopWords()
Description copied from interface: XQStaticContext
Get the full text stopwords option, i.e. which stopwords should be used in the matching

Specified by:
getFTStopWords in interface XQStaticContext
Returns:
A FTStopWordsMatchOption object describing the stopwords

setFTThesaurus

public void setFTThesaurus(FTThesaurusMatchOption thes)
Description copied from interface: XQStaticContext
Set the full text thesaurus option, i.e. which thesauri should be used in the matching

Specified by:
setFTThesaurus in interface XQStaticContext
Parameters:
thes - A FTThesaurusMatchOption object describing the thesauri

getFTThesaurus

public FTThesaurusMatchOption getFTThesaurus()
Description copied from interface: XQStaticContext
Set the full text thesaurus option, i.e. which thesauri should be used in the matching

Specified by:
getFTThesaurus in interface XQStaticContext
Returns:
A FTThesaurusMatchOption object describing the thesauri

isXPath10Compat

public boolean isXPath10Compat()
Description copied from interface: XQStaticContext
Get the XPath 1.0 Compatibility setting

Specified by:
isXPath10Compat in interface XQStaticContext
Returns:
the XPath 1.0 compatibility setting - always false

getGlobalContext

public static Context getGlobalContext()
Access the global context explicitly

Returns:
the global context singleton

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich