|
|
dls:document-checkout(
|
|
$uri as xs:string,
|
|
$deep as xs:boolean,
|
|
[$annotation as item()?],
|
|
[$timeout as xs:unsignedLong?]
|
| ) as empty-sequence() |
|
 |
Summary:
This function checks out (locks) the document at the
specified URI to prevent other users from modifying the document. An
exception is thrown if the document does not yet exist or does exist
but is not managed.
|
Parameters:
$uri
:
The URI of the document to check out.
|
$deep
:
If set to true, then
any documents
directly or indirectly included by the specified document are also checked out.
|
$annotation
(optional):
Any comments you
want to add to the document's active-lock element.
|
$timeout
(optional):
The duration of the
checkout, in seconds. For infinite, omit this parameter or specify ().
|
|
Required Privilege:
The dls-user role is required to run
this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
dls:document-checkout("/foo/bar/baz.xml", fn:true(), "updating doc", 3600)
(: Checks out the 'baz'xml' document, and all of its included documents,
for one hour. :)
|
|
|
|
dls:document-delete(
|
|
$uri as xs:string,
|
|
$keep-old-versions as xs:boolean,
|
|
$retain-history as xs:boolean
|
| ) as empty-sequence() |
|
 |
Summary:
This function removes the specified managed document.
You must have update permissions on the document to delete it.
If you set $retain-history to true, you can use
xdmp:document-properties to view the deleted document's properties
fragment in the database.
|
Parameters:
$uri
:
The URI of
the document.
|
$keep-old-versions
:
Determines whether to keep old versions of the document. Set to
false to delete all of the versions of the document.
|
$retain-history
:
Determines whether to retain the deleted document's property fragment
in the database. Set to true to
retain the property fragment, or false to delete.
|
|
Required Privilege:
The dls-user role is required to run
this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
dls:document-delete("/foo/bar/baz.xml", fn:false(), fn:true())
(: Deletes all versions of the 'baz.xml' document and retains the
property fragment for each version. :)
|
|
|
|
dls:document-insert-and-manage(
|
|
$uri as xs:string,
|
|
$deep as xs:boolean,
|
|
$doc as node(),
|
|
[$annotation as item()*],
|
|
[$permissions as element(sec:permission)*],
|
|
[$collections as xs:string*],
|
|
[$quality as xs:integer?],
|
|
[$forest-ids as xs:unsignedLong*]
|
| ) as xs:string* |
|
 |
Summary:
This function inserts a document into the database and places the document under
management.
|
Parameters:
$uri
:
The URI of the document.
|
$deep
:
Specifies whether to manage
this document as well as any documents for which this document
has XInclude references to. Specify true to manage
all XInclude references or false to not manage
any included documents. The default is false.
|
$doc
:
The contents of the document (root node). The document
root node can be one of XML format, binary (BLOB) format, or text (CLOB) format.
|
$annotation
(optional):
Any comments you want to add to the properties.
|
$permissions
(optional):
Security permission elements corresponding to the permissions
for the document. If not supplied, the current user's default
permissions are applied. The default value used for $permissions
can be obtained by calling xdmp:default-permissions(). A document that is
created by a non-admin user (that is, by any user who does not have the
admin role) must have at least one update permission,
otherwise the creation will throw an XDMP-MUSTHAVEUPDATE
exception.
|
$collections
(optional):
The collection URIs for collections to which this document
belongs. If not supplied, the document is added to the current
user's default collections. For each collection that is protected, the
user must have permissions to update that collection or have the
any-collection privilege. For each unprotected collection,
the user must have the unprotected-collections privilege.
The default value used for $collections can be obtained by calling
xdmp:default-collections().
|
$quality
(optional):
The quality of this document. A positive value increases
the relevance score of the document in text search functions.
The converse is true for a negative value. The default value is 0.
|
$forest-ids
(optional):
Specifies the ID of the forest in which this document is inserted.
If the document already exists in the database and if $forest-ids is
not specified, it will remain in its existing forest. If no such
forest exists or if no such forest is attached to the context database,
an error is raised. If multiple forests are specified, the document
is inserted into one of the specifed forests. If the document exists
and the forest in which it is stored is set to delete-only, then you
must set $forest-ids to include one or more forests that allow updates,
otherwise an exception is thrown.
|
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
let $contents :=
<BOOK>
<TITLE>Baz Goes to the Disco</TITLE>
<CHAPTER1>
<TITLE>Baz Wakes Up to James Brown and Feels Funky</TITLE>
</CHAPTER1>
</BOOK>
return
dls:document-insert-and-manage(
"/foo/bar/baz.xml",
fn:true(),
$contents)
(: Inserts 'baz.xml' into the database and places the document under management. :)
|
|
|
|
dls:document-version-delete(
|
|
$uri as xs:string,
|
|
$version as xs:integer,
|
|
$retain-history as xs:boolean
|
| ) as empty-sequence() |
|
 |
Summary:
This function removes the specified version of the managed
document at the specified URI. This overrides any configured retention policies
and should be used with care. You must have update permissions on the document
version in order to delete it.
If you set $retain-history to true, you can use
xdmp:document-properties to view the deleted document's properties
fragment in the database. For example, if you had deleted version 1 of
/foo/bar/baz.xml, you can view its properties by calling:
xdmp:document-properties("/foo/bar/baz.xml_versions/1-baz.xml")
|
Parameters:
$uri
:
The URI of
the document.
|
$version
:
The version of the document to
be deleted.
|
$retain-history
:
Determines whether or not
to retain the document's properties fragment in the database. Set to
true to retain the deleted document's properties in order to track
when the document was deleted and by whom. Otherwise, set to false.
|
|
Required Privilege:
The dls-user role is required to run
this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
dls:document-version-delete("/foo/bar/baz.xml", 1, fn:true())
(: Deletes version 1 of the 'baz.xml' document and records it in the document
history. :)
|
|
|