Package org.basex.query
Class QueryModule
java.lang.Object
org.basex.query.QueryModule
The XQuery import module statement can be used to import XQuery modules
as well as Java instances, which will be treated as modules. Any class with a public,
empty constructor can be imported as module.
If a class extends the QueryModule class, it inherits the queryContext
and staticContext variables, which provide access to all properties of the
current query. E.g., they provide access to the current context value or the declared namespaces of a query.
The default properties of functions can be overwritten via annotations:
- Java functions can only be executed by users with
ADMINpermissions. You may annotate a function withQueryModule.Requires(QueryModule.Permission) to also make it accessible to users with less privileges. - Java code is treated as "non-deterministic", as its behavior cannot
be predicted by the XQuery processor. You may annotate a function as
QueryModule.Deterministicif you know that it will have no side effects and will always yield the same result. - Java code is treated as "context-independent". If a function accesses
the specified
queryContext, it should be annotated asQueryModule.ContextDependent. - Java code is treated as "focus-independent". If a function accesses
the current context value, position or size, it should be annotated as
QueryModule.FocusDependent.
QueryResource is implemented, its QueryResource.close() method will be
called after the query has been evaluated. It should always be implemented if a module opens
connections, resources, etc. that eventually need to be closed.
Please visit our documentation to find more details on Packaging, Java Bindings and User Management. The XQuery 3.0 specification gives more insight into function properties.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceJava code is treated as "context-independent".static @interfaceJava code is treated as "non-deterministic", as its behavior cannot be predicted from the XQuery processor.static @interfaceJava code is treated as "focus-independent".static @interfaceSet additional locks to be fetched.static enumPermission required to call a function.static @interfaceJava functions can only be executed by users withADMINpermissions.static @interfaceIf a function is annotated asQueryModule.Updating, its function body will be treated as updating. -
Field Summary
FieldsModifier and TypeFieldDescriptionGlobal query context.Static context. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
queryContext
Global query context. -
staticContext
Static context.
-
-
Constructor Details
-
QueryModule
public QueryModule()
-