|
|
dls:document-add-collections(
|
|
$uri as xs:string,
|
|
$collections as xs:string*
|
| ) as empty-sequence() |
|
 |
Summary:
This function adds the named document to the specified collections.
|
Parameters:
$uri
:
The URI of
the document to be added to the collection.
|
$collections
:
A set of collection URIs.
|
|
Required Privilege:
The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user
For each collection
that is protected, the user must have permissions to update that collection or
the privilege:
http://marklogic.com/xdmp/privileges/any-collection
For each unprotected collection, the user must have the privilege:
http://marklogic.com/xdmp/privileges/unprotected-collections
The document must specify dls-user(update) permission.
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
dls:document-add-collections(
"/foo/bar/baz.xml",
"http://marklogic.com/documents/foo")
(: Adds 'bax.xml' to the 'foo' collection. :)
|
|
|
|
dls:document-add-permissions(
|
|
$uri as xs:string,
|
|
$permissions as element(sec:permission)*
|
| ) as empty-sequence() |
|
 |
Summary:
This function adds the specified permissions for the named document. Any
permissions that were previously set for the document are retained.
|
Parameters:
$uri
:
The URI of
the document.
|
$permissions
:
The permissions to be added for the document.
|
|
Required Privilege:
The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user
The document must specify dls-user(update) permission.
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
dls:document-add-permissions("/foo/bar/baz.xml",
(xdmp:permission("dls-user", "read"),
xdmp:permission("dls-user", "update")))
(: Adds the specified permissions to the list of permissions for the 'baz.xml'
document. :)
|
|
|
|
dls:document-set-permissions(
|
|
$uri as xs:string,
|
|
$permissions as element(sec:permission)*
|
| ) as empty-sequence() |
|
 |
Summary:
This function sets the specified permissions for the named document.
Any unspecified permissions that were previously set for the document are removed.
|
Parameters:
$uri
:
The URI of
the document.
|
$permissions
:
The permissions
to be set for the document.
|
|
Required Privilege:
The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user
The document must specify dls-user(update) permission.
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
dls:document-set-permissions("/foo/bar/baz.xml",
(xdmp:permission("dls-user", "read"),
xdmp:permission("dls-user", "update"),
xdmp:permission("Developer", "read"),
xdmp:permission("Developer", "update")))
(: Sets the permissions on the 'baz.xml' document. :)
|
|
|
|
dls:document-set-properties(
|
|
$uri as xs:string,
|
|
$properties as element()*
|
| ) as empty-sequence() |
|
 |
Summary:
This function sets the properties of a document to the given
sequence of elements. With the exception of the Library Services properties, any properties
that already exist on the document are replaced.
To preserve existing document properties, use dls:document-add-properties.
Each element QName is the property name and the element value is the property value.
|
Parameters:
$uri
:
The URI of
the document.
|
$properties
:
The properties to be set
for the document.
|
|
Required Privilege:
The dls-user role is required to run
this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user
Modifying properties requires update permissions on a document.
|
Usage Notes:
You cannot set any property nodes in the DLS namespace.
|
Example:
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
dls:document-set-properties(
"/foo/bar/baz.xml",
(<priority>1</priority>,
<status>unedited</status>))
(: The <priority> and <status> properties are set to the 'baz.xml' document. :)
|
|
|
|
dls:document-update(
|
|
$uri as xs:string,
|
|
$doc as node(),
|
|
$annotation as item()*,
|
|
$retain-history as xs:boolean,
|
|
[$permissions as element(sec:permission)*],
|
|
[$collections as xs:string*],
|
|
[$quality as xs:integer?],
|
|
[$forest-ids as xs:unsignedLong*]
|
| ) as xs:string* |
|
 |
Summary:
This function updates the managed document at the specified URI
with the specified contents. This function does an implicit dls:document-purge
and returns the URI of any version of the document purged as
the result of the established retention policy.
This function must be called in a separate transaction from the
dls:document-checkout and dls:document-checkin functions.
You must first check out the document
with dls:document-checkout before you can update,
otherwise an exception is thrown. If the document does not exist, then an
exception is thrown.
|
Parameters:
$uri
:
The URI of the document.
|
$doc
:
The new contents of the document.
|
$annotation
:
Any comments you
want to add to the new versions of the documents.
|
$retain-history
:
Determines whether or not
to retain the document's properties fragment in the database. Set to
true to retain the original document's properties in order to track
when the document was updated and by whom. Otherwise, set to false.
|
$permissions
(optional):
The permissions to be set on the updated document.
If not supplied, then the existing permissions set for the document remain.
|
$collections
(optional):
The collection URIs for the collections to which the updated document is to belong.
If not supplied, then the existing collections set for the document remain.
|
$quality
(optional):
Specifies the quality of the updated 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 the updated document is inserted.
If this parameter is not specified, the updated document will remain in the
original document's 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 this parameter to include one or
more forests that allow updates, otherwise an exception is thrown.
|
|
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";
let $bazbook :=
<BOOK>
<TITLE>Baz Goes to the Disco</TITLE>
<CHAPTER1>
<TITLE>Baz Wakes Up</TITLE>
<PARA>
Baz woke up this afternoon to the sound of James Brown. Soon
Baz was feeling a little funky, so he put on his cleanest
propeller hat and headed out in search of a Disco.
</PARA>
</CHAPTER1>
</BOOK>
return
dls:document-update(
"/foo/bar/baz.xml",
$bazbook,
"Changed the title from Baz Feelin' Funky",
fn:true())
(: Updates the contents of 'baz.xml'. :)
|
|
|