A module for database manipulation functions.
Copy the collection $source-collection-uri to the collection $target-collection-uri.
$source-collection-uri | The source URI |
$target-collection-uri | The target URI |
Copy the collection $source-collection-uri to the collection $target-collection-uri.
$source-collection-uri | The source URI |
$target-collection-uri | The target URI |
$preserve | Cause the copy process to preserve the following attributes of each source in the copy: modification time, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) will also be preserved |
Copy the resource $source-collection-uri/$source-resource-name to collection $target-collection-uri/$target-resource-name. If the $target-resource-name is omitted, the $source-resource-name will be used.
$source-collection-uri | The source URI |
$source-resource-name | The name of the resource to copy |
$target-collection-uri | The target URI |
$target-resource-name? | The name of the resource for the target |
Copy the resource $source-collection-uri/$source-resource-name to collection $target-collection-uri/$target-resource-name. If the $target-resource-name is omitted, the $source-resource-name will be used.
$source-collection-uri | The source URI |
$source-resource-name | The name of the resource to copy |
$target-collection-uri | The target URI |
$target-resource-name? | The name of the resource for the target |
$preserve | Cause the copy process to preserve the following attributes of each source in the copy: modification time, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) will also be preserved |
Check if the user, $user-id, can authenticate against the database collection $collection-uri. The function simply tries to read the collection $collection-uri, using the credentials $user-id and $password. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true if the authentication succeeds, false otherwise.
$collection-uri | The collection URI |
$user-id? | The user-id |
$password? | The password |
Removes the user lock on the resource $resource in the collection $collection-uri. If no lock is in place, the empty sequence is returned. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
$resource | The resource |
Returns true() if the collection $collection-uri exists and is available, otherwise false(). Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
Create a new collection with name $new-collection as a child of $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.Returns the path to the new collection if successfully created, otherwise the empty sequence.
$target-collection-uri | The target collection URI |
$new-collection | The name of the new collection to create |
Returns the creation date of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
Returns the creation date of the resource $resource in $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
$resource | The resource |
Decodes the string $string such that any percent encoded octets will be translated to their decoded UTF-8 representation.
$string | The input string |
Decodes the URI $uri such that any percent encoded octets will be translated to their decoded UTF-8 representation.
$uri | The URI |
Start a defragmentation run on each document which has a node in $nodes. Fragmentation may occur if nodes are inserted into a document using XQuery update extensions. Please note that defragmenting a document changes its internal structure, so any references to this document will become invalid, in particular, variables pointing to some nodes in the document.
$nodes+ | The sequence of nodes from the documents to defragment |
Start a defragmentation run on each document which has a node in $nodes. Fragmentation may occur if nodes are inserted into a document using XQuery update extensions. The second argument specifies the minimum number of fragmented pages which should be in a document before it is considered for defragmentation. Please note that defragmenting a document changes its internal structure, so any references to this document will become invalid, in particular, variables pointing to some nodes in the document.
$nodes+ | The sequence of nodes from the documents to defragment |
$integer | The minimum number of fragmented pages required before defragmenting |
Returns the user-id of the user that holds a write lock on the resource $resource in the collection $collection-uri. If no lock is in place, the empty sequence is returned. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
$resource | The resource |
Encodes the string $string such that it will be a valid collection or resource path. Provides similar functionality to java's URLEncoder.encode() function, with some enhancements.
$string | The input string |
Encodes the string $string such that it will be a valid collection or resource path. Provides similar functionality to java's URLEncoder.encode() function, with some enhancements. Returns an xs:anyURI object representing a valid XmldbURI
$string | The input string |
Filters the given node set to only include nodes from resources which were modified since the specified date time.
$node-set* | A node set |
$since | Date |
Filters the given node set to only include nodes from resources which were modified until the specified date time.
$node-set* | A node set |
$until | Date |
Returns the names of the child collections in the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
Returns the names of the child resources in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
Returns the MIME type if available of the resource $resource-uri, otherwise the empty sequence. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
$resource-uri | The resource URI |
Returns the last-modification date of resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
$resource | The resource |
Login the user, $user-id, and set it as the owner of the currently executing XQuery. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true if the authentication succeeds, false otherwise. If called from a HTTP context the login is cached for the lifetime of the HTTP session and may be used for any XQuery run in that session. If an HTTP session does not already exist, none will be created.
$collection-uri | The collection URI |
$user-id? | The user-id |
$password? | The password |
Login the user, $user-id, and set it as the owner of the currently executing XQuery. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true() if the authentication succeeds, false() otherwise. If called from a HTTP context the login is cached for the lifetime of the HTTP session and may be used for any XQueryrun in that session. $create-session specifies whether to create an HTTP session on successful authentication or not. If $create-session is false() or the empty sequence no session will be created if one does not already exist.
$collection-uri | The collection URI |
$user-id? | The user-id |
$password? | The password |
$create-session? | whether to create the session or not on successful authentication, default false() |
Looks for collection names in the collection index that match the provided regexp
$regexp | The expression to use for matching collection names |
Moves the collection $source-collection-uri into the collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uri | The source collection URI |
$target-collection-uri | The target collection URI |
Moves the resource $resource from the collection $source-collection-uri into collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uri | The source collection URI |
$target-collection-uri | The target collection URI |
$resource | The resource |
Registers an XMLDB driver class with the XMLDB Database Manager. This is only required if you want to access a database instance different from the one that executes the XQuery.
$driver | The DB driver |
$create-db | The flag to create the db if it does not exist |
Reindex collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
$collection-uri | The collection URI |
Reindex document $doc-uri from $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
$collection-uri | The collection URI |
$doc-uri | The document URI |
Removes the collection $collection-uri and its contents from the database. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
Removes the resource $resource from the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
$resource | The resource |
Renames the collection $source-collection-uri with new name $new-collection-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uri | The source collection URI |
$new-collection-name | The new collection name |
Renames the resource $resource in collection $collection-uri with new name $new-resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
$resource | The resource |
$new-resource-name | The new resource name |
Set the MIME type of the resource $resource-uri.Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
$resource-uri | The resource URI |
$mime-type? | The new mime-type, use empty sequence to set default value. |
Returns the estimated size of the resource $resource (in bytes) in the collection $collection-uri. The estimation is based on the number of pages occupied by the resource. If the document is serialized back to a string, its size may be different, since parts of the structural information are stored in compressed form. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uri | The collection URI |
$resource | The resource |
Stores a new resource into the database. The resource is stored in the collection $collection-uri with the name $resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The contents $contents, is either a node, an xs:string, a Java file object or an xs:anyURI. A node will be serialized to SAX. It becomes the root node of the new document. If $contents is of type xs:anyURI, the resource is loaded from that URI. Returns the path to the new document if successfully stored, otherwise an XPathException is thrown.
$collection-uri | The collection URI |
$resource-name? | The resource name |
$contents | The contents |
Stores a new resource into the database. The resource is stored in the collection $collection-uri with the name $resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The contents $contents, is either a node, an xs:string, a Java file object or an xs:anyURI. A node will be serialized to SAX. It becomes the root node of the new document. If $contents is of type xs:anyURI, the resource is loaded from that URI. The final argument $mime-type is used to specify a mime type. If the mime-type is not a xml based type, the resource will be stored as a binary resource.Returns the path to the new document if successfully stored, otherwise an XPathException is thrown.
$collection-uri | The collection URI |
$resource-name? | The resource name |
$contents | The contents |
$mime-type | The mime type |
Stores a new resource into the database. The resource is stored in the collection $collection-uri with the name $resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The contents $contents, is either a node, an xs:string, a Java file object or an xs:anyURI. A node will be serialized to SAX. It becomes the root node of the new document. If $contents is of type xs:anyURI, the resource is loaded from that URI. Returns the path to the new document if successfully stored, otherwise an XPathException is thrown.
$collection-uri | The collection URI |
$resource-name? | The resource name |
$contents | The contents |
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
$collection-uri | The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. |
$directory | The directory in the file system from where the files are read. |
$pattern+ | The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one |
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
$collection-uri | The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. |
$directory | The directory in the file system from where the files are read. |
$pattern+ | The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one |
$mime-type? | If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource. |
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
$collection-uri | The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. |
$directory | The directory in the file system from where the files are read. |
$pattern+ | The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one |
$mime-type? | If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource. |
$preserve-structure | If preserve-structure is true(), the filesystem directory structure will be mirrored in the collection. Otherwise all the matching resources, including the ones in sub-directories, will be stored in the collection given in the first argument flatly. |
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
$collection-uri | The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. |
$directory | The directory in the file system from where the files are read. |
$pattern+ | The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one |
$mime-type? | If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource. |
$preserve-structure | If preserve-structure is true(), the filesystem directory structure will be mirrored in the collection. Otherwise all the matching resources, including the ones in sub-directories, will be stored in the collection given in the first argument flatly. |
$exclude* | A sequence of file patterns to exclude |
Sets the modification time of a resource to the current system time. If not resource does not exist it is not created.
$collection-uri | The collection URI |
$resource | The name of the resource in the collection |
Sets the modification time of a resource. If not resource does not exist it is not created.
$collection-uri | The collection URI |
$resource | The name of the resource in the collection |
$modification-time | The modification time to set on the resource |
Processes an XUpdate request, $modifications, against a collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.The modifications are passed in a document conforming to the XUpdate specification. http://rx4rdf.liminalzone.org/xupdate-wd.html#N1a32e0The function returns the number of modifications caused by the XUpdate.
$collection-uri | The collection URI |
$modifications | The XUpdate modifications to be processed |
Returns the document nodes in the collections $collection-uris non-recursively, i.e. does not include document nodes found in sub-collections. C.f. fn:collection(). Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uris+ | The collection URIs |