Package com.saxonica.ee.optim
Class StaticQueryContextEE
- java.lang.Object
-
- net.sf.saxon.query.StaticQueryContext
-
- com.saxonica.expr.StaticQueryContextPE
-
- com.saxonica.ee.optim.StaticQueryContextEE
-
public class StaticQueryContextEE extends StaticQueryContextPE
A version of StaticQueryContext for Saxon-EE, that extends the capability by allowing compilation of library modules.
-
-
Constructor Summary
Constructors Constructor Description StaticQueryContextEE(EnterpriseConfiguration config, boolean initialize)
StaticQueryContextEE(Configuration config)
Create a StaticQueryContext using a given Configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compileLibrary(java.io.InputStream source, java.lang.String encoding)
Prepare an XQuery library module for subsequent evaluation.void
compileLibrary(java.io.Reader source)
Prepare an XQuery library module for subsequent evaluation.void
compileLibrary(java.lang.String query)
Compile an XQuery library module for subsequent evaluation.void
copyFrom(StaticQueryContext c)
Copy details from another StaticQueryContextjava.lang.Iterable<QueryLibrary>
getCompiledLibraries()
QueryLibrary
getCompiledLibrary(NamespaceUri namespace)
Get a previously compiled library moduleboolean
isSchemaAware()
Ask whether this query is schema-awareboolean
isStreaming()
Ask whether the streaming option has been set, that is, whether subsequent calls on compile() will compile queries to be capable of executing in streaming mode.void
setSchemaAware(boolean aware)
Say whether this query is schema-awarevoid
setStreaming(boolean option)
Say whether the query should be compiled and evaluated to use streaming.-
Methods inherited from class com.saxonica.expr.StaticQueryContextPE
getExtensionFunctionLibrary, setExtensionFunctionLibrary
-
Methods inherited from class net.sf.saxon.query.StaticQueryContext
clearDeclaredGlobalVariables, clearNamespaces, compileQuery, compileQuery, compileQuery, declareDefaultCollation, declareGlobalVariable, declareNamespace, getBaseURI, getCodeInjector, getConfiguration, getConstructionMode, getDefaultCollationName, getDefaultElementNamespace, getDefaultFunctionNamespace, getErrorListener, getErrorReporter, getLanguageVersion, getModuleLocation, getModuleURIResolver, getNamePool, getNamespaceForPrefix, getOptimizerOptions, getRequiredContextItemType, getSystemId, getUnprefixedElementMatchingPolicy, getUserDeclaredNamespaces, isCompileWithTracing, isEmptyLeast, isInheritNamespaces, isPreserveBoundarySpace, isPreserveNamespaces, isUpdating, isUpdatingEnabled, iterateDeclaredGlobalVariables, iterateDeclaredPrefixes, makeExecutable, reset, setBaseURI, setCodeInjector, setCompileWithTracing, setConfiguration, setConstructionMode, setDefaultElementNamespace, setDefaultFunctionNamespace, setEmptyLeast, setErrorListener, setErrorReporter, setInheritNamespaces, setLanguageVersion, setModuleLocation, setModuleURIResolver, setOptimizerOptions, setPreserveBoundarySpace, setPreserveNamespaces, setRequiredContextItemType, setUnprefixedElementMatchingPolicy, setUpdatingEnabled
-
-
-
-
Constructor Detail
-
StaticQueryContextEE
public StaticQueryContextEE(Configuration config)
Create a StaticQueryContext using a given Configuration. This creates a StaticQueryContext for a main module (that is, a module that is not a library module). The StaticQueryContext is initialized from defaults held in the Configuration.- Parameters:
config
- the Saxon Configuration- Since:
- 9.2
-
StaticQueryContextEE
public StaticQueryContextEE(EnterpriseConfiguration config, boolean initialize)
-
-
Method Detail
-
copyFrom
public void copyFrom(StaticQueryContext c)
Description copied from class:StaticQueryContext
Copy details from another StaticQueryContext- Overrides:
copyFrom
in classStaticQueryContext
- Parameters:
c
- the other StaticQueryContext
-
setSchemaAware
public void setSchemaAware(boolean aware)
Say whether this query is schema-aware- Overrides:
setSchemaAware
in classStaticQueryContext
- Parameters:
aware
- true if this query is schema-aware- Since:
- 9.2.1.2
-
isSchemaAware
public boolean isSchemaAware()
Ask whether this query is schema-aware- Overrides:
isSchemaAware
in classStaticQueryContext
- Returns:
- true if this query is schema-aware
- Since:
- 9.2.1.2
-
setStreaming
public void setStreaming(boolean option)
Say whether the query should be compiled and evaluated to use streaming. This affects subsequent calls on the compile() methods. This option requires Saxon-EE.- Overrides:
setStreaming
in classStaticQueryContext
- Parameters:
option
- if true, the compiler will attempt to compile a query to be capable of executing in streaming mode. If the query cannot be streamed, a compile-time exception is reported. In streaming mode, the source document is supplied as a stream, and no tree is built in memory. The default is false. Setting the value to true has the side-effect of setting the required context item type to "document node"; this is to ensure that expressions such as //BOOK are streamable.- Since:
- 9.6
-
isStreaming
public boolean isStreaming()
Ask whether the streaming option has been set, that is, whether subsequent calls on compile() will compile queries to be capable of executing in streaming mode.- Overrides:
isStreaming
in classStaticQueryContext
- Returns:
- true if the streaming option has been set.
- Since:
- 9.6
-
compileLibrary
public void compileLibrary(java.lang.String query) throws XPathException
Compile an XQuery library module for subsequent evaluation. The source text of the query is supplied as a String. The base URI of the query is taken from the static context, and defaults to the current working directory.Note that this interface makes the caller responsible for decoding the query and presenting it as a string of characters. This means it is likely that any encoding specified in the query prolog will be ignored.
- Overrides:
compileLibrary
in classStaticQueryContext
- Parameters:
query
- The XQuery library module to be compiled, supplied as a string.- Throws:
XPathException
- if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared, or contains other static errors.- Since:
- 9.2 (changed in 9.3 to return void)
-
compileLibrary
public void compileLibrary(java.io.Reader source) throws XPathException, java.io.IOException
Prepare an XQuery library module for subsequent evaluation. The Query is supplied in the form of a Reader. The base URI of the query is taken from the static context, and defaults to the current working directory. The effect of the method is that subsequent query compilations using this static context can import the module URI without specifying a location hint; the import then takes effect without requiring the module to be compiled each time it is imported.Note that this interface makes the Reader responsible for decoding the query and presenting it as a stream of characters. This means it is likely that any encoding specified in the query prolog will be ignored. Also, some implementations of Reader cannot handle a byte order mark.
- Overrides:
compileLibrary
in classStaticQueryContext
- Parameters:
source
- A Reader giving access to the text of the XQuery query to be compiled.- Throws:
XPathException
- if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared, or any other static error is reported.java.io.IOException
- if a failure occurs reading the supplied input.- Since:
- 9.2 (changed in 9.3 to return void)
-
compileLibrary
public void compileLibrary(java.io.InputStream source, java.lang.String encoding) throws XPathException, java.io.IOException
Prepare an XQuery library module for subsequent evaluation. The Query is supplied in the form of a InputStream, with an optional encoding. If the encoding is not specified, the query parser attempts to obtain the encoding by inspecting the input stream: it looks specifically for a byte order mark, and for the encoding option in the version declaration of an XQuery prolog. The effect of the method is that subsequent query compilations using this static context can import the module URI without specifying a location hint; the import then takes effect without requiring the module to be compiled each time it is imported. The encoding defaults to UTF-8. The base URI of the query is taken from the static context, and defaults to the current working directory.- Overrides:
compileLibrary
in classStaticQueryContext
- Parameters:
source
- An InputStream giving access to the text of the XQuery query to be compiled, as a stream of octetsencoding
- The encoding used to translate characters to octets in the query source. The parameter may be null: in this case the query parser attempts to infer the encoding by inspecting the source, and if that fails, it assumes UTF-8 encoding- Throws:
XPathException
- if the syntax of the expression is wrong, or if it references namespaces, variables, or functions that have not been declared, or any other static error is reported.java.io.IOException
- if a failure occurs reading the supplied input.- Since:
- 9.2 (changed in 9.3 to return void)
-
getCompiledLibrary
public QueryLibrary getCompiledLibrary(NamespaceUri namespace)
Get a previously compiled library module- Overrides:
getCompiledLibrary
in classStaticQueryContext
- Parameters:
namespace
- the module namespace- Returns:
- the QueryLibrary if a module with this namespace has been compiled as a library module; otherwise null.
- Since:
- 9.3
-
getCompiledLibraries
public java.lang.Iterable<QueryLibrary> getCompiledLibraries()
- Overrides:
getCompiledLibraries
in classStaticQueryContext
-
-