XQuery Function Documentation

Search and Browse

http://exist-db.org/xquery/system

java:org.exist.xquery.functions.system.SystemModule

A module for retrieving information about eXist and the system.

system:as-user

system:as-user($username as xs:string, $password as xs:string?, $code-block as item()*) as item()*

A pseudo-function to execute a limited block of code as a different user. The first argument is the name of the user, the second is the password. If the user can be authenticated, the function will execute the code block given in the third argument with the permissions of that user andreturns the result of the execution. Before the function completes, it switches the current user back to the old user.

Parameters:
$username The username of the user to run the code against
$password? The password of the user to run the code against
$code-block* The code block to run as the identified user
Returns:
item()* : the results of the code block executed

system:clear-trace

system:clear-trace() as item()

Clear the global trace log.

Returns:
item()

system:clear-xquery-cache

system:clear-xquery-cache() as empty-sequence()

Clear XQuery cache.

Returns:
empty-sequence()

system:count-instances-active

system:count-instances-active() as xs:integer

Returns the number of eXist instances that are active.

Returns:
xs:integer : the count

system:count-instances-available

system:count-instances-available() as xs:integer

Returns the number of eXist instances that are available.

Returns:
xs:integer : the count

system:count-instances-max

system:count-instances-max() as xs:integer

Returns the maximum number of eXist instances.

Returns:
xs:integer : the count

system:enable-tracing

system:enable-tracing($enable as xs:boolean) as item()

Enable function tracing on the database instance.

Parameters:
$enable The boolean flag to enable/disable function tracing
Returns:
item()

system:enable-tracing

system:enable-tracing($enable as xs:boolean, $tracelog as xs:boolean) as item()

Enable function tracing on the database instance.

Parameters:
$enable The enable boolean flag to enable/disable function tracing
$tracelog The tracelog boolean flag: if set to true, entering/exiting a function will be logged to the logger 'xquery.profiling'
Returns:
item()

system:export

system:export($dir as xs:string, $incremental as xs:boolean?, $zip as xs:boolean?) as node()

Export a backup of the database (admin user only).

Parameters:
$dir This is an absolute path to where the backup will be written. Must be writeable by the eXist process.
$incremental? Flag to do incremental export.
$zip? Flag to do export to zip file.
Returns:
node() : the export results

system:export-silently

system:export-silently($dir as xs:string, $incremental as xs:boolean?, $zip as xs:boolean?) as xs:boolean

Export a backup of the database (admin user only). Messagers from exporter reroute to logs.

Parameters:
$dir This is an absolute path to where the backup will be written. Must be writeable by the eXist process.
$incremental? Flag to do incremental export.
$zip? Flag to do export to zip file.
Returns:
xs:boolean : the export results

system:function-available

system:function-available($function-name as xs:QName, $arity as xs:integer) as xs:boolean

Returns whether a function is available.

Parameters:
$function-name The fully qualified name of the function
$arity The arity of the function
Returns:
xs:boolean : true() if the function exists, false() otherwise.

system:get-build

system:get-build() as xs:string

Returns the build of eXist running this query.

Returns:
xs:string : the build number

system:get-exist-home

system:get-exist-home() as xs:string

Returns the eXist home location.

Returns:
xs:string : the path to the eXist home

system:get-index-statistics

system:get-index-statistics() as node()?

Internal function

Returns:
node()? : the resource containing the index statistics

system:get-memory-free

system:get-memory-free() as xs:long

Returns the amount of free memory available to eXist.

Returns:
xs:long : the size of memory

system:get-memory-max

system:get-memory-max() as xs:long

Returns the maximum amount of memory eXist may use.

Returns:
xs:long : the size of memory

system:get-memory-total

system:get-memory-total() as xs:long

Returns the total amount of memory in use by eXist.

Returns:
xs:long : the size of memory

system:get-module-load-path

system:get-module-load-path() as xs:string

Returns the module load path from the current query context. The module load path corresponds to the location on the file system from where modules are loaded into an XQuery. This is usually the directory from which the main XQuery was compiled, or - when executing a stored XQuery - the collection in which the main query resides. The module load path is also used to resolve relative XInclude paths.

Returns:
xs:string : the load path

system:get-product-name

system:get-product-name() as xs:string

Returns the product name of the software running this query.

Returns:
xs:string : the product name

system:get-revision

system:get-revision() as xs:string

Returns the Git commit ID of the eXist instance running this query.

Returns:
xs:string : the Git commit ID.

system:get-running-jobs

system:get-running-jobs() as item()

Get a list of running jobs (dba role only).

Returns:
item() : the list of running jobs

system:get-running-xqueries

system:get-running-xqueries() as item()

Get a list of running XQueries (dba role only).

Returns:
item() : a node containing the list of running XQueries

system:get-scheduled-jobs

system:get-scheduled-jobs() as item()

Get a list of scheduled jobs (dba role only).

Returns:
item() : a node containing the list of scheduled jobs

system:get-uptime

system:get-uptime() as xs:dayTimeDuration

Returns the time since eXist-db was started. The value is stable over the lifetime of a query.

Returns:
xs:dayTimeDuration : the duration since eXist-db was started

system:get-version

system:get-version() as xs:string

Returns the version of eXist running this query.

Returns:
xs:string : the version string

system:import

system:import($dir-or-file as xs:string, $admin-pass as xs:string?, $new-admin-pass as xs:string?) as node()

Restore the database or a section of the database (admin user only).

Parameters:
$dir-or-file This is either a backup directory with the backup descriptor (__contents__.xml) or a backup ZIP file.
$admin-pass? The password for the admin user
$new-admin-pass? Set the admin password to this new password.
Returns:
node() : the import results

system:import-silently

system:import-silently($dir-or-file as xs:string, $admin-pass as xs:string?, $new-admin-pass as xs:string?) as node()

Restore the database or a section of the database (admin user only). Messagers from exporter reroute to logs.

Parameters:
$dir-or-file This is either a backup directory with the backup descriptor (__contents__.xml) or a backup ZIP file.
$admin-pass? The password for the admin user
$new-admin-pass? Set the admin password to this new password.
Returns:
node() : the import results

system:kill-running-xquery

system:kill-running-xquery($xquery-id as xs:integer) as item()

Kill a running XQuey (dba role only).

Parameters:
$xquery-id The XQuery ID obtained from get-running-xqueries()
Returns:
item()

system:kill-running-xquery

system:kill-running-xquery($xquery-id as xs:integer, $wait-time as xs:long) as item()

Kill a running XQuey (dba role only).

Parameters:
$xquery-id The XQuery ID obtained from get-running-xqueries()
$wait-time The wait time in milliseconds before terminating the XQuery
Returns:
item()

system:restore

system:restore($dir-or-file as xs:string, $admin-pass as xs:string?, $new-admin-pass as xs:string?) as node()

Restore the database or a section of the database (admin user only).

Parameters:
$dir-or-file This is either a backup directory with the backup descriptor (__contents__.xml) or a backup ZIP file.
$admin-pass? The password for the admin user
$new-admin-pass? Set the admin password to this new password.
Returns:
node() : the restore results

system:restore

system:restore($dir-or-file as xs:string, $admin-pass as xs:string?, $new-admin-pass as xs:string?, $overwrite as xs:boolean) as node()

Restore the database or a section of the database (admin user only).

Parameters:
$dir-or-file This is either a backup directory with the backup descriptor (__contents__.xml) or a backup ZIP file.
$admin-pass? The password for the admin user
$new-admin-pass? Set the admin password to this new password.
$overwrite Should newer versions of apps installed in the database be overwritten by those found in the backup? False by default.
Returns:
node() : the restore results

system:shutdown

system:shutdown() as item()

Shutdown eXist immediately. This method is only available to the DBA role.

Returns:
item()

system:shutdown

system:shutdown($delay as xs:long) as item()

Shutdown eXist. This method is only available to the DBA role.

Parameters:
$delay The delay in milliseconds before eXist starts to shutdown.
Returns:
item()

system:trace

system:trace() as node()

Returns function call statistics gathered by the trace log.

Returns:
node() : the call statistics gathered by the trace

system:tracing-enabled

system:tracing-enabled() as xs:boolean

Returns true if function tracing is currently enabled on the database instance.

Returns:
xs:boolean : true is tracing is enabled.

system:trigger-system-task

system:trigger-system-task($java-classname as xs:string, $task-parameters as node()?) as item()

Trigger a system task.

Parameters:
$java-classname The full name of the Java class to execute. It must implement org.exist.storage.SystemTask
$task-parameters? The XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
Returns:
item()

system:update-statistics

system:update-statistics() as empty-sequence()

This function is part of the unfinished index statistics module, which is not yet usable in a normal eXist setup. update-statistics rebuilds index statistics for the entire database.

Returns:
empty-sequence()