Class XQueryExpressionEE

    • Method Detail

      • isUpdateQuery

        public boolean isUpdateQuery()
        Ask whether this is an update query
        Overrides:
        isUpdateQuery in class XQueryExpression
        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.
      • setAllowDocumentProjection

        public void setAllowDocumentProjection​(boolean allowed)
        Indicate that document projection is or is not allowed
        Overrides:
        setAllowDocumentProjection in class XQueryExpression
        Parameters:
        allowed - true if projection is allowed
      • isDocumentProjectionAllowed

        public boolean isDocumentProjectionAllowed()
        Ask whether document projection is allowed
        Overrides:
        isDocumentProjectionAllowed in class XQueryExpression
        Returns:
        true if document projection is allowed
      • getPathMap

        public PathMap getPathMap()
        Get the path map for the query expression
        Returns:
        the path map (which is constructed if this has not already been done)
      • runUpdate

        public java.util.Set<MutableNodeInfo> runUpdate​(DynamicQueryContext dynamicEnv)
                                                 throws XPathException
        Run an updating query
        Overrides:
        runUpdate in class XQueryExpression
        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

        public void runUpdate​(DynamicQueryContext dynamicEnv,
                              UpdateAgent agent)
                       throws XPathException
        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:
        runUpdate in class XQueryExpression
        Parameters:
        dynamicEnv - the dynamic context for query execution
        agent - 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,
                                javax.xml.transform.Source source,
                                javax.xml.transform.Result result,
                                java.util.Properties outputProperties)
                         throws XPathException
        Run the query in streaming mode, assuming it has been compiled for streaming
        Overrides:
        runStreamed in class XQueryExpression
        Parameters:
        dynamicEnv - the dynamic execution context
        source - the input document, as a SAXSource or StreamSource
        result - the destination for the query results
        outputProperties - serialization options for the query result
        Throws:
        XPathException - if streamed evaluation of the query fails
      • explainPathMap

        public void explainPathMap()
        Output the path map of the query for diagnostics
        Overrides:
        explainPathMap in class XQueryExpression