Class XQueryExpressionEE
- All Implemented Interfaces:
SourceLocator,ExpressionOwner,Locatable,Location,Traceable,TraceableComponent,Locator
-
Field Summary
Fields inherited from class net.sf.saxon.query.XQueryExpression
executable, expression, mainModule, pullEvaluator, pushEvaluator, stackFrameMap -
Constructor Summary
ConstructorsConstructorDescriptionXQueryExpressionEE(Expression exp, QueryModule mainModule, boolean streaming) -
Method Summary
Modifier and TypeMethodDescriptionbooleanAsk whether this is an update queryGet a controller that can be used to execute functions in this compiled query.protected voidprocessQuery(Outputter dest, XPathContext context) voidrunStreamed(DynamicQueryContext dynamicEnv, Source source, Result result, Properties outputProperties) Run the query in streaming mode, assuming it has been compiled for streamingrunUpdate(DynamicQueryContext dynamicEnv) Run an updating queryvoidrunUpdate(DynamicQueryContext dynamicEnv, UpdateAgent agent) Run an updating query, writing back eligible updated node to persistent storage.Methods inherited from class net.sf.saxon.query.XQueryExpression
closeStreamIfNecessary, evaluate, evaluateSingle, explain, explainPathMap, getBody, getChildExpression, getColumnNumber, getConfiguration, getExecutable, getExpression, getExpressionIterator, getExternalVariableNames, getHostLanguage, getLineNumber, getLocation, getMainModule, getObjectName, getPackageData, getPublicId, getStackFrameMap, getSystemId, getTracingTag, initialContext, iterator, run, saveLocation, setBody, setChildExpression, usesContextItem, validateOutputPropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
Constructor Details
-
XQueryExpressionEE
public XQueryExpressionEE(Expression exp, QueryModule mainModule, boolean streaming) throws XPathException - Throws:
XPathException
-
-
Method Details
-
processQuery
- Overrides:
processQueryin classXQueryExpression- Throws:
XPathException
-
isUpdateQuery
public boolean isUpdateQuery()Ask whether this is an update query- Overrides:
isUpdateQueryin classXQueryExpression- Returns:
- true if the body of the query is an updating expression (as defined by the XQuery Update specification). Note that a query can use Update syntax (notably the copy-modify syntax) without being an updating expression.
-
newController
Get a controller that can be used to execute functions in this compiled query. Functions in the query module can be found usingQueryModule.getUserDefinedFunction(net.sf.saxon.om.NamespaceUri, java.lang.String, int). They can then be called directly from the Java application usingUserFunction.call(net.sf.saxon.expr.XPathContext, net.sf.saxon.om.Sequence[])The same Controller can be used for a series of function calls. Note that the Controller should only be used in a single thread.- Overrides:
newControllerin classXQueryExpression- Parameters:
env- the dynamic context for evaluation- Returns:
- a newly constructed Controller
- Throws:
XPathException- if evaluation fails with a dynamic error
-
runUpdate
Run an updating query- Overrides:
runUpdatein classXQueryExpression- Parameters:
dynamicEnv- the dynamic context for query execution- Returns:
- a set of nodes representing the roots of trees that have been modified as a result
of executing the update. Note that this method will never modify persistent data on disk; it returns
the root nodes of the affected documents (which will often be document nodes whose document-uri can
be ascertained), and it is the caller's responsibility to decide what to do with them.
On completion of this method it is generally unsafe to rely on the contents or relationships of NodeInfo objects that were obtained before the updating query was run. Such objects may or may not reflect the results of the update operations. This is especially true in the case of nodes that are part of a subtree that has been deleted (detached from its parent). Instead, the new updated tree should be accessed by navigation from the root nodes returned by this method.
- Throws:
XPathException- if evaluation of the update query fails, or it this is not an updating query
-
runUpdate
Run an updating query, writing back eligible updated node to persistent storage.A node is eligible to be written back to disk if it is present in the document pool, which generally means that it was originally read using the doc() or collection() function.
On completion of this method it is generally unsafe to rely on the contents or relationships of NodeInfo objects that were obtained before the updating query was run. Such objects may or may not reflect the results of the update operations. This is especially true in the case of nodes that are part of a subtree that has been deleted (detached from its parent). Instead, the new updated tree should be accessed by navigation from the root nodes returned by this method.
If one or more eligible updated nodes cannot be written back to disk, perhaps because the URI identifies a non-updatable location, then an exception is thrown. In this case it is undefined
- Overrides:
runUpdatein classXQueryExpression- Parameters:
dynamicEnv- the dynamic context for query executionagent- a callback class that is called to process each document updated by the query- Throws:
XPathException- if evaluation of the update query fails, or it this is not an updating query
-
runStreamed
public void runStreamed(DynamicQueryContext dynamicEnv, Source source, Result result, Properties outputProperties) throws XPathException Run the query in streaming mode, assuming it has been compiled for streaming- Overrides:
runStreamedin classXQueryExpression- Parameters:
dynamicEnv- the dynamic execution contextsource- the input document, as a SAXSource or StreamSourceresult- the destination for the query resultsoutputProperties- serialization options for the query result- Throws:
XPathException- if streamed evaluation of the query fails
-