This page was generated
January  28,  2016
4:03  AM
XQuery & XSLT Built-In & Modules Function Reference

Built-In: Extension - MarkLogic Server Functions

The MarkLogic Server extension functions are XQuery extensions that return MarkLogic Server-specific information, such as the version of MarkLogic Server, the IDs of the hosts in the cluster, and so on.

Function Summary
xdmp:access Returns whether a given action on the specified document URI would succeed.
xdmp:architecture Returns the hardware architecture upon which MarkLogic Server is running.
xdmp:binary-is-external Test whether or not a binary node represents an external binary.
xdmp:binary-is-large Check whether a binary node is a large binary.
xdmp:binary-is-small Check whether a binary node is a small binary.
xdmp:binary-size Returns the size of the data, in bytes, represented by a binary node.
xdmp:bootstrap-hosts Returns a sequence of the IDs of all the bootstrap hosts in the cluster.
xdmp:cluster Returns the ID of the cluster named in the parameter.
xdmp:cluster-name Returns the name of the cluster with the specified ID.
xdmp:collation-canonical-uri Returns the canonical URI for the given URI, if it represents a valid collation.
xdmp:configuration-timestamp Returns timestamp of last configuration changed .
xdmp:database Returns the ID of the database named in the parameter.
xdmp:database-forests Returns a sequence of forest IDs in the specified database.
xdmp:database-global-nonblocking-timestamp Returns the most recent commit timestamp for which a query on the database including its foreign database will not block waiting for transactions to commit or journal frames to arrive from a foreign master.
xdmp:database-is-replica Tests if a database is a replica of a foreign database.
xdmp:database-name Return the name of the database with the given ID.
xdmp:database-nonblocking-timestamp Returns the most recent commit timestamp for which a query on the database will not block waiting for transactions to commit or journal frames to arrive from a foreign master.
xdmp:database-path-namespaces Returns the list of path namespaces for the given database id.
xdmp:databases Returns a sequence of the IDs of all the databases in the system.
xdmp:document-forest Returns the forest ID of the forest in which a document (or a lock or a property) with the specified URI is stored.
xdmp:document-get Returns the document in the file specified by $location.
xdmp:document-timestamp Returns timestamp of the most recent visible update to a document, lock, or property.
xdmp:elapsed-time Returns the elapsed time since the start of processing of this query.
xdmp:external-binary Returns an external binary node.
xdmp:external-binary-path Return the path to the external file associated with an external binary document.
xdmp:foreign-clusters Returns the IDs of the foreign clusters.
xdmp:forest Returns the ID of the forest specified as the parameter.
xdmp:forest-databases Returns the database ID corresponding to the database to which the specified forest belongs.
xdmp:forest-host Return the host of the forest with the given id.
xdmp:forest-name Return the name of the forest with the given id.
xdmp:forest-updates-allowed Return updates allowed state of the forest with the given ID.
xdmp:forests Returns a sequence of the IDs of all the forests in the system.
xdmp:get [DEPRECATED: use xdmp:document-get instead] Returns the document in the XML file specified by $path.
xdmp:get-orphaned-binaries Returns a sequence of the IDs of all orphaned large binaries in a given forest.
xdmp:group Returns the ID of the group specified in the parameter.
xdmp:group-hosts Returns the IDs of all hosts belonging to the group with the given ID.
xdmp:group-name Returns the name of the group with the given ID.
xdmp:group-servers Returns the IDs of all App Servers belonging to the group with the given ID.
xdmp:groups Returns a sequence of the IDs of all the groups in the system.
xdmp:host Returns the ID of the host named in the parameter.
xdmp:host-forests Returns a sequence of forest IDs in the specified host.
xdmp:host-group Returns the ID of the group that the specified host belongs to.
xdmp:host-name Returns the name of the specified host.
xdmp:hosts Returns a sequence of the IDs of all the hosts in the cluster.
xdmp:log Logs a debug message to the log file <install_dir>/Logs/ErrorLog.txt.
xdmp:log-level Retrieves the current server log level.
xdmp:modules-database Returns the database ID of the modules database.
xdmp:modules-root Returns the current root path for modules.
xdmp:platform Returns the operating-system platform upon which MarkLogic Server is running ("solaris", "winnt", "linux", or "macosx").
xdmp:pretty-print Returns a well-formatted XQuery module.
xdmp:product-edition Returns the current MarkLogic product edition.
xdmp:product-environment Returns the current MarkLogic product environment.
xdmp:query-meters Returns the current value of the resource meters for this query sequence.
xdmp:query-trace Enables or disables tracing of this query.
xdmp:remove-orphaned-binary Remove an orphaned large binary .
xdmp:request Returns the unique key of the current request.
xdmp:rethrow Within the catch section of a try-catch expression, re-throw the currently caught error.
xdmp:schema-database Returns the database ID of the schema database associated with the current database.
xdmp:security-database Returns the database ID of the security database associated with the current database.
xdmp:server Return the ID(s) of the App Servers, XDBC Servers, ODBC Servers, or Task Servers with the given name.
xdmp:server-collation Return the default collation of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:server-database Return the database ID of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:server-default-xquery-version Return the default xquery version of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:server-group Return the ID of the group for an App Server, XDBC Server, ODBC Server, or Task Server.
xdmp:server-modules-database Return the modules database ID of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:server-name Return the name of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:server-port Return the port of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:server-root Return the root of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:server-ssl-certificate-template Return the SSL certificate template ID of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.
xdmp:servers Returns a sequence of the IDs of all the App Servers in the system.
xdmp:subbinary Returns a binary node made up of a subset of the given binary node.
xdmp:trace Signal a trace event.
xdmp:triggers-database Returns the database ID of the triggers database associated with the current database.
xdmp:uri-content-type Returns the content type of the given URI as matched in the mimetypes configuration.
xdmp:uri-format Returns the format of the given URI as matched in the mimetypes configuration.
xdmp:validate Returns an element containing a summary of validation errors in a node.
xdmp:version Returns the current MarkLogic Server version.
Function Detail
xdmp:access(
$uri as xs:string,
$action as xs:string
)  as   xs:boolean
Summary:

Returns whether a given action on the specified document URI would succeed.

Parameters:
$uri : The document URI.
$action : The type of access: "create", "insert", "update", or "execute".

Example:
  xdmp:access(
         "http://example.com/foo.xml",
         "create")
   => true()

xdmp:architecture(  ) as  xs:string
Summary:

Returns the hardware architecture upon which MarkLogic Server is running. If xdmp:platform() returns "linux", it will return "x86_64" or "i686. If xdmp:platform() returns "solaris", it will return "amd64" or "sparcv9". If xdmp:platform() returns "winnt", it will return "amd64" or "i686". If xdmp:platform() returns "macosx", it will return "x86_64".

Example:
  xdmp:architecture()
   => "amd64"

xdmp:binary-is-external(
$source as binary()
)  as   xs:boolean
Summary:

Test whether or not a binary node represents an external binary.

Parameters:
$source : The binary mode to be tested.

Usage Notes:

An external binary node is one created using xdmp:external-binary. For more details, see "Working With Binary Documents" in the Application Developer's Guide.


Example:
  let $n := xdmp:external-binary("/testdata1/logo.gif", 1, 2456))
  return xdmp:binary-is-external($n)

  => true

xdmp:binary-is-large(
$source as binary()
)  as   xs:boolean
Summary:

Check whether a binary node is a large binary.

Parameters:
$source : The binary node to test.

Usage Notes:

A large binary is one whose size is above the large size threshold. See admin:database-set-large-size-threshold. This function returns false for small and external binary nodes. For details, see "Working With Binary Documents" in the Application Developer's Guide.


Example:
  xdmp:binary-is-large(doc("/logo.gif")/binary())
  => false

xdmp:binary-is-small(
$source as binary()
)  as   xs:boolean
Summary:

Check whether a binary node is a small binary.

Parameters:
$source : A binary node

Usage Notes:

A small binary is one whose size is below the large size threshold. See admin:database-set-large-size-threshold. For details, see "Working With Binary Documents" in the Application Developer's Guide.


Example:
  xdmp:binary-is-small(doc("/logo.gif")/binary())

  => true if the binary content is below the large size threshold.

xdmp:binary-size(
[$source as binary()?]
)  as   xs:unsignedLong?
Summary:

Returns the size of the data, in bytes, represented by a binary node.

Parameters:
$source (optional): A binary node whose data size will be returned.

Example:
  xdmp:binary-size(fn:doc("example.mpeg")/binary())
  => the size (in bytes) of "example.mpeg"

xdmp:bootstrap-hosts(  ) as  xs:unsignedLong*
Summary:

Returns a sequence of the IDs of all the bootstrap hosts in the cluster.

Example:
xdmp:bootstrap-hosts()
=> 2760886727871312968
   1551965607977434000
Example:
xdmp.bootstrapHosts()
=> 2760886727871312968
   1551965607977434000

xdmp:cluster(
[$name as xs:string]
)  as   xs:unsignedLong
Summary:

Returns the ID of the cluster named in the parameter. Returns the ID of the current cluster if no parameter is specified.

Parameters:
$name (optional): The name of the cluster. The default value is the name of the current cluster.

Example:
  xdmp:cluster()
  => 15495681647217162987

xdmp:cluster-name(
[$id as xs:unsignedLong]
)  as   xs:string
Summary:

Returns the name of the cluster with the specified ID. Returns the name of the current cluster if no ID is specified.

Parameters:
$id (optional): The ID of the cluster. The default value is the ID of the current cluster.

Example:
  xdmp:cluster-name()
  => "San Francisco"

xdmp:collation-canonical-uri(
$collation-uri as xs:string
)  as   xs:string
Summary:

Returns the canonical URI for the given URI, if it represents a valid collation. A canonical URI is the unique string MarkLogic Server uses to identify a given collation. The canonical URI string places any attributes that occur in the URI in a predefined order, and it removes any attributes that are redundant due to locale defaults.

Parameters:
$collation-uri : A collation URI.

Usage Notes:

If the specified collation URI is not a valid URI, an exception is thrown.

Example:
xdmp:collation-canonical-uri("http://marklogic.com/collation/en/S3")
=> http://marklogic.com/collation/en

xdmp:configuration-timestamp(
[$name as xs:string]
)  as   xs:unsignedLong?
Summary:

Returns timestamp of last configuration changed

Parameters:
$name (optional): The name of configuration file. The default value is empty string.

Example:
  xdmp:configuration-timestamp("databases.xml")
  => 15495681647217162987

xdmp:database(
[$name as xs:string]
)  as   xs:unsignedLong
Summary:

Returns the ID of the database named in the parameter. Returns the ID of the current database if no parameter is specified.

Parameters:
$name (optional): The name of the database. The default value is the name of the current database.

Example:
  xdmp:database("myDB")
  => 74495681647284736476

xdmp:database-forests(
$database-id as xs:unsignedLong,
[$include-replicas as xs:boolean?]
)  as   xs:unsignedLong*
Summary:

Returns a sequence of forest IDs in the specified database.

Parameters:
$database-id : A database ID.
$include-replicas (optional): True if replica forest ids should also be included.

Example:
  xdmp:database-forests(xdmp:database("Documents"))
  => (8456374036761185098, 10615125154705099114)

xdmp:database-global-nonblocking-timestamp(
$database-id as xs:unsignedLong
)  as   xs:unsignedLong
Summary:

Returns the most recent commit timestamp for which a query on the database including its foreign database will not block waiting for transactions to commit or journal frames to arrive from a foreign master.

Parameters:
$database-id : A database ID.

Example:
xdmp:database-global-nonblocking-timestamp(8456374036761185098)
=> 13155925136769870

xdmp:database-is-replica(
$database-id as xs:unsignedLong
)  as   xs:boolean
Summary:

Tests if a database is a replica of a foreign database.

Parameters:
$database-id : A database ID.

Example:
xdmp:database-is-replica(8456374036761185098)
=> true

xdmp:database-name(
$database-id as xs:unsignedLong
)  as   xs:string
Summary:

Return the name of the database with the given ID.

Parameters:
$database-id : A database ID.

Example:
xdmp:database-name(8456374036761185098)
=> "Documents"

xdmp:database-nonblocking-timestamp(
$database-id as xs:unsignedLong
)  as   xs:unsignedLong
Summary:

Returns the most recent commit timestamp for which a query on the database will not block waiting for transactions to commit or journal frames to arrive from a foreign master.

Parameters:
$database-id : A database ID.

Example:
xdmp:database-nonblocking-timestamp(8456374036761185098)
=> 13155925136769870

xdmp:database-path-namespaces(
$dbid as xs:ulong
)  as   element()
Summary:

Returns the list of path namespaces for the given database id.

Parameters:
$dbid : The id for the database to get the path namespaces for. Empty for the current database.

Example:

xquery version "1.0-ml";

xdmp:database-path-namespaces(xdmp:database("Documents"))

=> List of path-namespaces defined on Documents

<?xml version="1.0" encoding="UTF-8"?>
<path-namespaces xmlns="http://marklogic.com/xdmp/database">
  <path-namespace>
    <prefix>wm</prefix>
    <namespace-uri>http://www.mediawiki.org/xml/export-0.4/</namespace-uri>
  </path-namespace>
  <path-namespace>
    <prefix>aaa</prefix>
    <namespace-uri>http://www.aaa.org/</namespace-uri>
  </path-namespace>
</path-namespaces>


xdmp:databases(  ) as  xs:unsignedLong*
Summary:

Returns a sequence of the IDs of all the databases in the system.

Example:
  xdmp:databases()
   => (14389140626518478220,
          8456374036761185098,
          10615125154705099114)

xdmp:document-forest(
$uri as xs:string,
[$forest-ids as xs:unsignedLong*]
)  as   xs:integer?
Summary:

Returns the forest ID of the forest in which a document (or a lock or a property) with the specified URI is stored. Otherwise, returns the empty sequence.

Parameters:
$uri : The URI of the document, lock, or property.
$forest-ids (optional): Restricts the ID(s) of the forest(s) in which this function may return.

Example:
  xdmp:document-forest("example.xml")
  => 12972338785465832200

xdmp:document-get(
$location as xs:string,
[$options as node()?]
)  as   node()?
Summary:

Returns the document in the file specified by $location.

Parameters:
$location : The location of the input document. If the scheme of the location is HTTP (that is, if the string starts with "http://"), then the document is requested over HTTP. If the scheme is file (that is, if the string starts with "file://"), then the document is requested over file protocol from the local filesystem. Otherwise, the document is fetched from the local filesystem. On the filesystem, the path can be fully qualifed or relative. Relative pathnames are resolved from the directory in which MarkLogic Server is installed.
$options (optional): The options node for getting this document. The default value is (). The node for the xdmp:document-get options must be in the xdmp:document-get namespace. This parameter can also include option elements in the xdmp:http namespace for the HTTP parameters.

The xdmp:document-get options include:

<default-namespace>

The namespace to use if there is no namespace at the root node of the document. The default value is "".

<repair>

A value of full specifies that malformed XML content be repaired. A value of none specifies that malformed XML content is rejected. If no repair option is explicitly specified, the default is implicitly specified by the XQuery version of the caller. In XQuery 1.0 and 1.0-ml the default is none. In XQuery 0.9-ml the default is full. This option has no effect on binary or text documents.

<format>

A value of text specifies to get the document as a text document, regardless of the URI specified. A value of binary specifies to get the document as a binary document, regardless of the URI specified. A value of xml specifies to get the document as an XML document, regardless of the URI specified.

<default-language>

The language to specify in an xml:lang attribute on the root element node if the root element node does not already have an xml:lang attribute. If default-language is not specified, then nothing is added to the root element node.

<encoding>

Specifies the encoding to use when reading the document into MarkLogic Server. Supported values include UTF-8, ISO-8859-1, as well as many other popular encodings. See the Search Developer's Guide for a list of character set encodings by language. All encodings will be translated into UTF-8 from the specified encoding. The string specifed for the encoding option will be matched to an encoding name according to the Unicode Charset Alias Matching rules (http://www.unicode.org/reports/tr22/#Charset_Alias_Matching). An automatic encoding detector will be used if the value auto is specified. If no encoding can be detected, the encoding defaults to UTF-8. If no encoding option is specified, the encoding defaults to the encoding specified in the http header (if using with one of the http functions, for example, xdmp:http-get), otherwise it defaults to UTF-8; any encoding http headers are ignored if there is any value specified for the encoding option.

Required Privilege:

http://marklogic.com/xdmp/privileges/xdmp-document-get

Usage Notes:

If no format is specified in $options, and the document is from an HTTP server, the format is specified by the document content type from the HTTP response. If no format is specified in $options, and the document is from the filesystem, the format is specified by the document content type from the filename extension. The mimetype extensions and corresponding content types are set in the Admin Interface.

If no repair option is specified, the default is specified by the XQuery version of the caller. In XQuery version 1.0 and 1.0-ml the default is <repair>none</repair>. In XQuery version 0.9-ml the default is <repair>full</repair>.

When the document is from an HTTP server, xdmp:document-get will always return the response from the HTTP server, even if it is an error response such as 404 or 500. If you want to be able to examine the response header in your application, use the xdmp:http-get instead, which returns both the response header and the response.


Example:
  xdmp:document-get("myDocument.xml")
  => the xml contained in myDocument.xml,
        for example, <myDocument/>
Example:
  xdmp:document-get("myDocument.html",
       <options xmlns="xdmp:document-get">
           <repair>full</repair>
       </options>)
  => myDocument.html as an XML document that has gone
     through any needed tag repair
Example:
  xdmp:document-get("http://myCompany.com/file.xml",
       <options xmlns="xdmp:document-get"
                xmlns:http="xdmp:http">
           <format>xml</format>
           <http:authentication>
              <http:username>user</http:username>
              <http:password>pass</http:password>
           </http:authentication>
       </options>)
  => gets an XML document named file.xml, sending the
     authentication credentials user/pass to the
     http://myCompany.com server


xdmp:document-timestamp(
$uri as xs:string
)  as   xs:integer?
Summary:

Returns timestamp of the most recent visible update to a document, lock, or property. Returns the empty sequence if no document, lock, or property exists.

Parameters:
$uri : The URI of the document, lock, or property.

Usage Notes:

If the current request is part of a multi-statement transaction and the most recent visible update was in an earlier statement in the transaction, the timestamp for the update has not yet been established, so an empty sequence is returned.

Example:
  xdmp:document-timestamp("example.xml")
  => 13384772182196660

xdmp:elapsed-time(  ) as  xs:dayTimeDuration
Summary:

Returns the elapsed time since the start of processing of this query. Gives the same information as the elapsed-time element of the xdmp:query-meters output, but has less overhead than calling xdmp:query-meters.

Usage Notes:

Certain operations are run concurrently with the timing operations, and if those operations are not actually used in the query, they might not be included in the timings. This occurs for operations like xdmp:estimate, xdmp:exists, and lexicon calls (for example, cts:element-values). If you want to see the total timings that include calls that are not used, you can form some other expression with the results of the calls. For example, if you have an expression that calls xdmp:estimate in a let expression, you can add 0 to the output, which causes it to be included in the timings (something like xdmp:estimate($query) + 0).


Example:

xquery version "1.0-ml";

fn:count(collection()),
xdmp:elapsed-time()

=> The count of the number of documents in the database followed by
   the elapsed-time of the query:

   153
   PT0.04S


xdmp:external-binary(
$path as xs:string,
[$starting-location as xs:double],
[$length as xs:double]
)  as   binary()
Summary:

Returns an external binary node.

Parameters:
$path : Filesystem path to the external binary file.
$starting-location (optional): The new binary node starts at the byte position indicated by starting-location. The first byte is at location 1. The default value is 1.
$length (optional): The length in bytes of the content in the new binary node. Omitting the length has performance implications; see usage notes.

Required Privilege:

http://marklogic.com/xdmp/privileges/xdmp-external-binary


Usage Notes:

If no length is provided, the length is calculated from the starting position and the filesystem length of the external file. If the file does not exist when the length is calculated, XDMP-MISSINGFILE is thrown.

If a length is provided, the length is trusted. That is, no attempt is made to confirm the existence or read the length of the external file. Therefore, including the length in the call (if known) results in the best performance during document creation.


Example:
  xdmp:external-binary("/testdata1/logo.gif", 1, 2456))

  => A binary node representing the external file at
     /testdata1/logo.gif, beginning at offset 1, with
     a length of 2456 bytes.

xdmp:external-binary-path(
$source as binary()
)  as   xs:string?
Summary:

Return the path to the external file associated with an external binary document.

Parameters:
$source : The external binary node for which to retrieve the external file path.

Usage Notes:

If the source binary node does not represent an external binary binary document, XDMP-ARG is thrown. That is, the source binary node must have been created by xdmp:external-binary. Use xdmp:binary-is-external to test whether or not a node represents an external binary.


Example:
  xdmp:external-binary-path(doc("/movies/external-movie-1.mp4")/binary())

  => /space/binaries/movies/movie-1.mp4

xdmp:foreign-clusters(  ) as  xs:unsignedLong*
Summary:

Returns the IDs of the foreign clusters.

Example:
  xdmp:cluster()
  => 15495681647217162987

xdmp:forest(
$name as xs:string
)  as   xs:unsignedLong
Summary:

Returns the ID of the forest specified as the parameter.

Parameters:
$name : The name of the forest.

Example:
  xdmp:forest("myForest")
  => 15495681647217162987

xdmp:forest-databases(
$forest as xs:unsignedLong
)  as   xs:unsignedLong
Summary:

Returns the database ID corresponding to the database to which the specified forest belongs.

Parameters:
$forest : A forest ID.

Example:
  xdmp:forest-databases(xdmp:forest("Documents"))
  => 2032458498523149048

xdmp:forest-host(
$id as xs:unsignedLong
)  as   xs:unsignedLong
Summary:

Return the host of the forest with the given id.

Parameters:
$id : A forest ID.

Example:
xdmp:forest-host(xdmp:forest("Documents"))
=> 628308917998312873

xdmp:forest-name(
$id as xs:unsignedLong
)  as   xs:string
Summary:

Return the name of the forest with the given id.

Parameters:
$id : A forest ID.

Example:
xdmp:forest-name(8456374036761185098)
=> "Documents"

xdmp:forest-updates-allowed(
$forest-id as xs:unsignedLong
)  as   xs:string
Summary:

Return updates allowed state of the forest with the given ID.

Parameters:
$forest-id : A forest ID.

Example:
xdmp:forest-updates-allowed(8456374036761185098)
=> "all"

xdmp:forests(  ) as  xs:unsignedLong*
Summary:

Returns a sequence of the IDs of all the forests in the system.

Example:
  xdmp:forests()
   => 18263538320779601865
2760886727871312968
1551965607977434000
2714941248661564752

xdmp:get(
$path as xs:string,
[$default-namespace as xs:string?],
[$options as xs:string*]
)  as   node()?
Summary:

[DEPRECATED: use xdmp:document-get instead] Returns the document in the XML file specified by $path.

This function is deprecated and will be removed from a future release. Use xdmp:document-get instead.


Parameters:
$path : The path to the input file. The path can be fully qualifed or relative. Relative pathnames are resolved from the directory in which MarkLogic Server is installed.
$default-namespace (optional): Default namespace for nodes in the first parameter. If $default-namespace is specified and the root node of the loaded document does not explicitly specify a namespace, $default-namespace will be applied to the root node. The default value for $default-namespace is "".
$options (optional): The options for getting this document. The default value is ().

Options include:

"repair-full"
Specifies that malformed XML content be repaired. This option has no effect on binary or text documents.
"repair-none"
Specifies that malformed XML content be rejected. This option has no effect on binary or text documents.
"format-text"
Specifies to get the document as a text document, regardless of the URI specified.
"format-binary"
Specifies to get the document as a binary document, regardless of the URI specified.
"format-xml"
Specifies to get the document as an XML document, regardless of the URI specified.
"lang=en"
Specifies that the document is in english.

Usage Notes:

If no format is specified in $options, it is specified by the document content type specified by the extension of the document URI. The mimetype extensions and corresponding content types are set in the Admin Interface.

If neither "repair-full" nor "repair-none" is present, the default is specified by the XQuery version of the caller. In XQuery version 1.0 and 1.0-ml the default is "repair-none". In XQuery version 0.9-ml the default is "repair-full".


Example:
  xdmp:get("foo.xml")
  => <foo/>
Example:
  xdmp:get("foo.html", "", ("repair-full", "format-xml"))
  => foo.html as an XML document that has gone through any
        needed tag repair

xdmp:get-orphaned-binaries(
$id as xs:unsignedLong
)  as   xs:unsignedLong*
Summary:

Returns a sequence of the IDs of all orphaned large binaries in a given forest.

Parameters:
$id : A forest ID.

Required Privilege:

http://marklogic.com/xdmp/privileges/xdmp-get-orphaned-binaries


Example:
  xdmp:get-orphaned-binaries(8456374036761185098)
    => 1236374036761185456
1236378936761185098
1256374036761185951

xdmp:group(
[$name as xs:string]
)  as   xs:unsignedLong
Summary:

Returns the ID of the group specified in the parameter. Returns the ID of the current group if no parameter is specified.

Parameters:
$name (optional): The name of the group. The default value is the name of the group the current host belongs to.

Example:
  xdmp:group("Default")
  => 134722342511344334243

xdmp:group-hosts(
[$name as xs:unsignedLong]
)  as   xs:unsignedLong*
Summary:

Returns the IDs of all hosts belonging to the group with the given ID. If no parameter is specified, it uses the group of the current host.

Parameters:
$name (optional): The ID of the group. The default value is the id of the group the current host belongs to.

Example:
  xdmp:group-hosts(134722342511344334243)
  => 18263538320779601865
2760886727871312968

xdmp:group-name(
[$name as xs:unsignedLong]
)  as   xs:string
Summary:

Returns the name of the group with the given ID. Returns the name of the current group if no parameter is specified.

Parameters:
$name (optional): The id of the group. The default value is the id of the group the current host belongs to.

Example:
  xdmp:group-name(134722342511344334243)
  => "Default"

xdmp:group-servers(
[$name as xs:unsignedLong]
)  as   xs:unsignedLong*
Summary:

Returns the IDs of all App Servers belonging to the group with the given ID. If no parameter is specified, it uses the group of the current host.

Parameters:
$name (optional): The ID of the group. The default value is the ID of the group to which the current host belongs.

Example:
  xdmp:group-servers(xdmp:group("Default"))
   => 18263538320779601865
       2760886727871312968
       2714941248661564752

xdmp:groups(  ) as  xs:unsignedLong*
Summary:

Returns a sequence of the IDs of all the groups in the system.

Example:
  xdmp:groups()
   => 12363538320723601865
2350822345151312968
7891965607973455300
2314941134541564752

xdmp:host(
[$name as xs:string]
)  as   xs:unsignedLong
Summary:

Returns the ID of the host named in the parameter. Returns the ID of the current host if no parameter is specified.

Parameters:
$name (optional): The name of the host. The default value is the name of the current host.

Example:
  xdmp:host("foo.example.com")
  => 15495681647217162987

xdmp:host-forests(
$ID as xs:unsignedLong
)  as   xs:unsignedLong*
Summary:

Returns a sequence of forest IDs in the specified host.

Parameters:
$ID : A host ID.

Example:
xdmp:host-forests(xdmp:group-hosts(xdmp:group("Default")))
  => (8456374036761185098, 10615125154705099114)

xdmp:host-group(
[$ID as xs:unsignedLong]
)  as   xs:unsignedLong
Summary:

Returns the ID of the group that the specified host belongs to.

Parameters:
$ID (optional): A host ID.

Example:
xdmp:host-group(15495681647217162987)
=> 9876543211234
Example:
xdmp.hostGroup(15495681647217162987);
=> "9876543211234"

xdmp:host-name(
$ID as xs:unsignedLong
)  as   xs:string
Summary:

Returns the name of the specified host.

Parameters:
$ID : A host ID.

Example:
  xdmp:host-name(15495681647217162987)
  => foo.example.com

xdmp:hosts(  ) as  xs:unsignedLong*
Summary:

Returns a sequence of the IDs of all the hosts in the cluster.

Example:
  xdmp:hosts()
   => 18263538320779601865
2760886727871312968
1551965607977434000
2714941248661564752

xdmp:log(
$msg as item()*,
[$level as xs:string?]
)  as   empty-sequence()
Summary:

Logs a debug message to the log file <install_dir>/Logs/ErrorLog.txt.

Parameters:
$msg : Message for logging.
$level (optional): One of: emergency, alert, critical, error, warning, notice, info, config, debug, fine, finer, or finest. The default level is "info".

Example:
  xdmp:log("AAAA")
  => ()

xdmp:log-level(  ) as  xs:string
Summary:

Retrieves the current server log level.

Example:
  xdmp:log-level()
  => finest

xdmp:modules-database(  ) as  xs:unsignedLong
Summary:

Returns the database ID of the modules database. Returns 0 if the current App Server uses the file system for its modules.

Example:
  xdmp:modules-database()
  => 8447094497219470018

xdmp:modules-root(  ) as  xs:string
Summary:

Returns the current root path for modules.

Example:
  xdmp:modules-root()
   => Docs

xdmp:platform(  ) as  xs:string
Summary:

Returns the operating-system platform upon which MarkLogic Server is running ("solaris", "winnt", "linux", or "macosx").

Example:
  xdmp:platform()
   => "winnt"

xdmp:pretty-print(
$xquery as xs:string
)  as   xs:string
Summary:

Returns a well-formatted XQuery module.

Parameters:
$xquery : An XQuery module to be reformatted.

Example:
  xdmp:pretty-print("for $x in 1 to 10 return $x")
   => "for $x in 1 to 10
       return $x"

xdmp:product-edition(  ) as  xs:string
Summary:

Returns the current MarkLogic product edition.

Example:
  xdmp:product-edition()
   => "Essential Enterprise"

xdmp:product-environment(  ) as  xs:string
Summary:

Returns the current MarkLogic product environment.

Example:
  xdmp:product-environment()
   => "production"

xdmp:query-meters(  ) as  element()
Summary:

Returns the current value of the resource meters for this query sequence.

Usage Notes:

The resource meters returned include:

elapsed-time
The time elapsed since the start of the processing of this query, in the form of a duration.
requests
The number of requests.
list-cache-hits
The number of successful list cache lookups. The list cache holds search termlists used to accelerate path expressions and text searches.
list-cache-misses
The number of unsuccessful list cache lookups. Each unsuccessful list cache lookup was followed by a disk access to load the search termlist into the cache.
in-memory-list-hits
The number of successful list lookups in in-memory stands.
expanded-tree-cache-hits
The number of successful expanded tree cache lookups. The expanded tree cache cache holds XML document data in the expanded representation used by the XQuery evaluator.
expanded-tree-cache-misses
The number of unsuccessful expanded tree cache lookups. Each unsuccessful expanded tree lookup was followed by a compressed tree cache lookup to load the expanded tree into the cache.
compressed-tree-cache-hits
The number of successful compressed tree cache lookups. The compressed tree cache holds XML document data in the compressed representation stored on disk.
compressed-tree-cache-misses
The number of unsuccessful compressed tree cache lookups. Each unsuccessful compressed tree cache lookup was followed by a disk access to load the compressed tree into the cache.
in-memory-compressed-tree-hits
The number of successful compressed tree lookups in in-memory stands.
value-cache-hits
The number of successful value cache lookups. The value cache is a transient cache that exists only for the duration of one query. It holds typed values, and is used to accelerate the frequent conversion of nodes to typed values.
value-cache-misses
The number of unsuccessful value cache lookups. Each unsuccessful value cache lookup was followed by a conversion of an XML node to a typed value.
regexp-cache-hits
The number of successful regular expression cache lookups. The regular expression cache is a transient cache that exists only for the duration of one query. It holds compiled regular expressions, and is used to accelerate the frequent use of regular expressions during the evaluation of a query.
regexp-cache-misses
The number of unsuccessful regular expression cache lookups. Each unsuccessful regular expression cache lookup was followed by a compilation of a regular expression from source text.
link-cache-hits
The number of successful link cache lookups. The link cache is a transient cache that exists only for the duration of one query. It holds pointers to expanded trees, and is used to accelerate the frequent dereferencing of link nodes.
link-cache-misses
The number of unsuccessful link cache lookups. Each unsuccessful link cache lookup was followed by a search for the link target tree.
filter-hits
The number of successful search filter matches.
filter-misses
The number of unsuccessful search filter matches.
fragments-added
The number of XML fragments added to the database by an update.
fragments-deleted
The number of XML fragments deleted from the database by an update.
fs-program-cache-hits
The number of module cache hits from the entire program made from modules on the file system.
fs-program-cache-misses
The number of module cache misses from the entire program made from modules on the file system.
db-program-cache-hits
The number of module cache hits from the entire program made from modules in a database (may contain library modules from the special Modules directory).
db-program-cache-misses
The number of module cache misses from the entire program made from modules in a database (may contain library modules from the special Modules directory).
env-program-cache-hits
The number of module cache hits from the entire program made from ad hoc XSLT stylesheet nodes.
env-program-cache-misses
The number of module cache misses from the entire program made from ad hoc XSLT stylesheet nodes.
fs-main-module-sequence-cache-hits
The number of main module cache hits from main modules on the file system.
fs-main-module-sequence-cache-misses
The number of main module cache misses from main modules on the file system.
db-main-module-sequence-cache-hits
The number of main module cache hits from main modules in a database.
db-main-module-sequence-cache-misses
The number of main module cache misses from main modules in a database.
fs-library-module-cache-hits
The number of library module cache hits from library modules on the file system.
fs-library-module-cache-misses
The number of library module cache misses from library modules on the file system.
db-library-module-cache-hits
The number of library module cache hits from library modules from the modules database.
db-library-module-cache-misses
The number of library module cache misses from library modules from the modules database.

Some meters are broken down by fragment root and document URI:

fragments
A sequence of fragment elements, each containing:
root
The fragment root name.
expanded-tree-cache-hits
A count of successful expanded tree cache lookups for this fragment root.
expanded-tree-cache-misses
A count of unsuccessful expanded tree cache lookups for this fragment root.
documents
A sequence of document elements, each containing:
uri
The document URI.
expanded-tree-cache-hits
A count of successful expanded tree cache lookups for this document URI.
expanded-tree-cache-misses
A count of unsuccessful expanded tree cache lookups for this document URI.

There are also meters that measure the query activity per host. There is a qm:hosts element with one qm:host child per host that participates in the query. Each qm:host element contains meters showing the round-trip-time and round-trip-count for communications between the evaluator host and the host referenced in the xdmp:query-meters output. The qm:hosts element is empty for a single-node cluster.

Certain operations are run concurrently with the timing operations, and if those operations are not actually used in the query, they might not be included in the timings. This occurs for operations like xdmp:estimate, xdmp:exists, and lexicon calls (for example, cts:element-values). If you want to see the total timings that include calls that are not used, you can form some other expression with the results of the calls. For example, if you have an expression that calls xdmp:estimate in a let expression, you can add 0 to the output, which causes it to be included in the timings (something like xdmp:estimate($query) + 0).


Example:
  xdmp:query-meters();
  =>
  <qm:query-meters
   xsi:schemaLocation="http://marklogic.com/xdmp/query-meters
       query-meters.xsd"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:qm="http://marklogic.com/xdmp/query-meters">
    <qm:elapsed-time>PT0.22S</qm:elapsed-time>
    <qm:requests>1</qm:requests>
    <qm:list-cache-hits>0</qm:list-cache-hits>
    <qm:list-cache-misses>0</qm:list-cache-misses>
    <qm:in-memory-list-hits>0</qm:in-memory-list-hits>
    <qm:expanded-tree-cache-hits>0
       </qm:expanded-tree-cache-hits>
    <qm:expanded-tree-cache-misses>0
       </qm:expanded-tree-cache-misses>
    <qm:compressed-tree-cache-hits>0
       </qm:compressed-tree-cache-hits>
    <qm:compressed-tree-cache-misses>0
       </qm:compressed-tree-cache-misses>
    <qm:in-memory-compressed-tree-hits>0
       </qm:in-memory-compressed-tree-hits>
    <qm:value-cache-hits>0</qm:value-cache-hits>
    <qm:value-cache-misses>0</qm:value-cache-misses>
    <qm:regexp-cache-hits>0</qm:regexp-cache-hits>
    <qm:regexp-cache-misses>0</qm:regexp-cache-misses>
    <qm:link-cache-hits>0</qm:link-cache-hits>
    <qm:link-cache-misses>0</qm:link-cache-misses>
    <qm:fragments-added>0</qm:fragments-added>
    <qm:fragments-deleted>0</qm:fragments-deleted>
    <qm:fs-program-cache-hits>1</qm:fs-program-cache-hits>
    <qm:fs-program-cache-misses>0</qm:fs-program-cache-misses>
    <qm:db-program-cache-hits>0</qm:db-program-cache-hits>
    <qm:db-program-cache-misses>0</qm:db-program-cache-misses>
    <qm:env-program-cache-hits>0</qm:env-program-cache-hits>
    <qm:env-program-cache-misses>0</qm:env-program-cache-misses>
    <qm:fs-main-module-sequence-cache-hits>0
       </qm:fs-main-module-sequence-cache-hits>
    <qm:fs-main-module-sequence-cache-misses>0
       </qm:fs-main-module-sequence-cache-misses>
    <qm:db-main-module-sequence-cache-hits>0
       </qm:db-main-module-sequence-cache-hits>
    <qm:db-main-module-sequence-cache-misses>0
       </qm:db-main-module-sequence-cache-misses>
    <qm:fs-library-module-cache-hits>0
       </qm:fs-library-module-cache-hits>
    <qm:fs-library-module-cache-misses>0
       </qm:fs-library-module-cache-misses>
    <qm:db-library-module-cache-hits>0
       </qm:db-library-module-cache-hits>
    <qm:db-library-module-cache-misses>0
       </qm:db-library-module-cache-misses>
    <qm:fragments/>
    <qm:documents/>
    <qm:hosts/>
  </qm:query-meters> 
Example:

xquery version "1.0-ml";
declare namespace qm="http://marklogic.com/xdmp/query-meters";

fn:count(collection()),
xdmp:query-meters()/qm:elapsed-time

=> The count of the number of documents in the database followed by
   the elapsed-time element of the xdmp:query-trace XML output:

153
<qm:elapsed-time xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:qm="http://marklogic.com/xdmp/query-meters">
                 PT0.04S</qm:elapsed-time>


xdmp:query-trace(
$enabled as xs:boolean
)  as   empty-sequence()
Summary:

Enables or disables tracing of this query. When query tracing is enabled, "info" level messages are logged detailing the search optimizations performed.

Parameters:
$enabled : Specify true to enable query tracing, false to disenable query tracing.

Usage Notes:

Search optimizations are performed in three phases:

the path analysis phase
In this phase a path expression is analyzed to determine whether it can be executed in whole or in part through an optimized search. Each individual component of the path is analyzed to see if it is searchable. The searchablity of each path component is logged.
the search constraint gathering phase
In this phase, search constraints are gathered from the path expression components. The number of constraints contributed by each path component is logged.
the search execution phase
In this phase, a search is performed using the gathered constraints. The actual number of fragments selected for filtering is logged.

Example:
  xdmp:query-trace(true())
  => ()

xdmp:remove-orphaned-binary(
$forestID as xs:unsignedLong,
$binaryID as xs:unsignedLong
)  as   empty-sequence()
Summary:

Remove an orphaned large binary

Parameters:
$forestID : A forest ID.
$binaryID : The ID of an orphaned large binary.

Required Privilege:

http://marklogic.com/xdmp/privileges/xdmp-remove-orphaned-binary


Example:
xdmp:remove-orphaned-binary(8456374036761185098, 1236374036761185456)

xdmp:request(  ) as  xs:unsignedLong
Summary:

Returns the unique key of the current request.

Example:
  xdmp:request()
   => 18263538320779601865

xdmp:rethrow(  ) as  empty-sequence()
Summary:

Within the catch section of a try-catch expression, re-throw the currently caught error.

Example:
  try {
    xdmp:document-delete($uri)
  } catch ($ex) {
    (: ignore documents that aren't there :)
    if ($ex/error:code eq 'XDMP-DOCNOTFOUND') then ()
    else xdmp:rethrow()
  }

xdmp:schema-database(
[$database-id as xs:unsignedLong?]
)  as   xs:unsignedLong
Summary:

Returns the database ID of the schema database associated with the current database.

Parameters:
$database-id (optional): A database ID. Defaults to the current database.

Usage Notes:

To run queries against the schema database, you can specify the xdmp:schema-database() function as the second parameter to xdmp:eval-in().

Example:
  xdmp:schema-database()
  => 15467547981724877000

xdmp:security-database(
[$database-id as xs:unsignedLong?]
)  as   xs:unsignedLong
Summary:

Returns the database ID of the security database associated with the current database.

Parameters:
$database-id (optional): A database ID. Defaults to the current database.

Usage Notes:

To run queries against the security database, you can specify the xdmp:security-database() function as the second parameter to xdmp:eval-in().

Example:
  xdmp:security-database()
  => 8447094497219470018

xdmp:server(
[$name as xs:string],
[$group as xs:unsignedLong]
)  as   xs:unsignedLong+
Summary:

Return the ID(s) of the App Servers, XDBC Servers, ODBC Servers, or Task Servers with the given name. Returns the ID of the current server if no parameter is specified.

Parameters:
$name (optional): A server name.
$group (optional): A group to search. If not specified, all groups are searched.

Example:
  xdmp:server("foo.example.com")
  => 15495681647217162987

xdmp:server-collation(
$id as xs:unsignedLong
)  as   xs:string?
Summary:

Return the default collation of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID. For a Task Server, return the empty sequence.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-collation(845637403676198)
=> "http://marklogic.com/collation/"

xdmp:server-database(
$id as xs:unsignedLong
)  as   xs:unsignedLong?
Summary:

Return the database ID of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID. For a Task Server, return the empty sequence.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-database(845637403676198)
=> 12345678901234

xdmp:server-default-xquery-version(
$id as xs:unsignedLong
)  as   xs:string?
Summary:

Return the default xquery version of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID. For a Task Server, return the empty sequence.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-default-xquery-version(845637403676198)
=> "1.0-ml"

xdmp:server-group(
$id as xs:unsignedLong
)  as   xs:unsignedLong
Summary:

Return the ID of the group for an App Server, XDBC Server, ODBC Server, or Task Server.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-group(845637403676198)
=> 9876543212344
Example:
xdmp.serverGroup(845637403676198);
=> "987654321234"

xdmp:server-modules-database(
$id as xs:unsignedLong
)  as   xs:unsignedLong?
Summary:

Return the modules database ID of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID. For a Task Server, return the empty sequence.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-modules-database(845637403676198)
=> 12345678901234

xdmp:server-name(
$id as xs:unsignedLong
)  as   xs:string
Summary:

Return the name of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-name(845637403676198)
=> "Docs"

xdmp:server-port(
$id as xs:unsignedLong
)  as   xs:unsignedInt?
Summary:

Return the port of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID. For a Task Server, return the empty sequence.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-port(845637403676198)
=> 8080

xdmp:server-root(
$id as xs:unsignedLong
)  as   xs:string?
Summary:

Return the root of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID. For a Task Server, return the empty sequence.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-root(845637403676198)
=> "Docs"

xdmp:server-ssl-certificate-template(
$id as xs:unsignedLong
)  as   xs:unsignedLong?
Summary:

Return the SSL certificate template ID of the App Server, XDBC Server, ODBC Server, or Task Server with the given ID. If none, return 0. For a Task Server, return the empty sequence.

Parameters:
$id : An App Server, XDBC Server, ODBC Server, or Task Server ID.

Example:
xdmp:server-ssl-certificate-template(845637403676198)
=> 987654345654321

xdmp:servers(  ) as  xs:unsignedLong*
Summary:

Returns a sequence of the IDs of all the App Servers in the system.

Example:
  xdmp:servers()
   => 18263538320779601865
2760886727871312968
1551965607977434000
2714941248661564752

xdmp:subbinary(
$source as binary(),
$starting-location as xs:double,
[$length as xs:double]
)  as   binary()
Summary:

Returns a binary node made up of a subset of the given binary node.

Parameters:
$source : A binary node whose subset will be returned
$starting-location : The new binary node starts at the byte position indicated by starting-location. The first byte is at location 1.
$length (optional): The length in bytes of the new binary node.

Usage Notes:

Usage is exactly like fn:substring except that it applies to a binary node rather than a string.


Example:
  data(xdmp:subbinary(binary { xs:hexBinary("DEADBEEF") }, 3, 2))
  => xs:hexBinary("BEEF")

xdmp:trace(
$name as xs:string,
$value as item()*
)  as   empty-sequence()
Summary:

Signal a trace event. If trace events are activated and the event is enabled, the trace event is logged.

Parameters:
$name : The trace event name.
$value : The trace event data.

Example:
  xdmp:trace("My Application Event",$my-application-data)
  => ()

xdmp:triggers-database(
[$database-id as xs:unsignedLong?]
)  as   xs:unsignedLong
Summary:

Returns the database ID of the triggers database associated with the current database.

Parameters:
$database-id (optional): A database ID. Defaults to the current database.

Example:
  xdmp:triggers-database()
  => 8447094497219470018

xdmp:uri-content-type(
$uri as xs:string
)  as   xs:string
Summary:

Returns the content type of the given URI as matched in the mimetypes configuration. xdmp:content-type continues to work too.

Parameters:
$uri : The document URI.

Example:
  xdmp:uri-content-type("example.txt")
  => text/plain
Example:
  xdmp:uri-content-type("example.xml")
  => text/xml
Example:
  xdmp:uri-content-type("example.doc")
  => application/msword

xdmp:uri-format(
$uri as xs:string
)  as   xs:string
Summary:

Returns the format of the given URI as matched in the mimetypes configuration.

Parameters:
$uri : The document URI.

Example:
  xdmp:uri-format("example.txt")
  => text
Example:
  xdmp:uri-format("example.xml")
  => xml

xdmp:validate(
$node as node(),
[$mode as xs:string],
[$typeName as xs:QName]
)  as   element(xdmp:validation-errors)
Summary:

Returns an element containing a summary of validation errors in a node.

Parameters:
$node : The node to validate.
$mode (optional): The validation mode, either "strict", "lax", or "type".
$typeName (optional): The name of the type to validate against, if the mode is "type". An error is raised if a typeName is given with a different validation mode, or if no type is given if the mode is "type".

Example:
declare namespace t="http://marklogic.com/xdmp/thesaurus";
xdmp:validate(
document {
<t:thesaurus>
  <t:entry>
     <t:term>one</t:term>
     <t:notes>unexpected stuff</t:notes>
     <t:part-of-speech>expl</t:part-of-speech>
     <t:synonym>
        <t:term>unique</t:term>
     </t:synonym>
  </t:entry>
</t:thesaurus>
} )
=>
<xdmp:validation-errors>
  <error:error xmlns:error="http://marklogic.com/xdmp/error"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <error:code>XDMP-VALIDATEUNEXPECTED</error:code>
    <error:name>err:XQDY0027</error:name>
    <error:xquery-version>1.0-ml</error:xquery-version>
    <error:message>Invalid node</error:message>
    <error:format-string>XDMP-VALIDATEUNEXPECTED:
    (err:XQDY0027) validate full { () } -- Invalid node: Found t:notes but
    expected (t:part-of-speech?,t:qualifiers?,t:scope-notes?,t:synonym*) at
    fn:doc("")/t:thesaurus/t:entry/t:notes using schema
    "thesaurus.xsd"</error:format-string>
    <error:retryable>false</error:retryable>
    <error:expr>validate full { () }</error:expr>
    <error:data>
      <error:datum>t:notes</error:datum>
      <error:datum>(t:part-of-speech?,t:qualifiers?,t:scope-notes?,t:synonym*)
      </error:datum>
      <error:datum>fn:doc("")/t:thesaurus/t:entry/t:notes</error:datum>
      <error:datum>"thesaurus.xsd"</error:datum>
    </error:data>
    <error:stack>
      <error:frame>
        <error:line>2</error:line>
        <error:column>0</error:column>
        <error:xquery-version>1.0-ml</error:xquery-version>
      </error:frame>
    </error:stack>
  </error:error><error:error xmlns:error="http://marklogic.com/xdmp/error"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <error:code>XDMP-VALIDATEBADTYPE</error:code>
    <error:name>err:XQDY0027</error:name>
    <error:xquery-version>1.0-ml</error:xquery-version>
    <error:message>Invalid node type</error:message>
    <error:format-string>XDMP-VALIDATEBADTYPE: (err:XQDY0027) validate
    full { () } -- Invalid node type: t:part-of-speech lexical value "expl"
    invalid for expected type #t:part-of-speech at
    fn:doc("")/t:thesaurus/t:entry/t:part-of-speech using schema
    "thesaurus.xsd"</error:format-string>
    <error:retryable>false</error:retryable>
    <error:expr>validate full { () }</error:expr>
    <error:data>
      <error:datum>t:part-of-speech</error:datum>
      <error:datum>"expl"</error:datum>
      <error:datum>#t:part-of-speech</error:datum>
      <error:datum>fn:doc("")/t:thesaurus/t:entry/t:part-of-speech</error:datum>
      <error:datum>"thesaurus.xsd"</error:datum>
    </error:data>
    <error:stack>
      <error:frame>
        <error:line>2</error:line>
        <error:column>0</error:column>
        <error:xquery-version>1.0-ml</error:xquery-version>
      </error:frame>
    </error:stack>
  </error:error>
</xdmp:validation-errors>

xdmp:version(  ) as  xs:string
Summary:

Returns the current MarkLogic Server version.

Example:
  xdmp:version()
   => "4.3-1"