temporal:document-protect( $temporal-collection as xs:string, $uri as xs:string, [$options as (element()|map:map)?] ) as empty-sequence()
Protects a temporal document from certain temporal operations, such as update, delete or wipe for a specific period of time. Subsequent update operations on that document against which this operation is protected will get a TEMPORAL-PROTECTED exception. If an archive path is specified optionally save a serialized copy of the document to the specified location and record the file path and copy time in the document's metadata.
Parameters | |
---|---|
temporal-collection | The URI for the protected temporal collection in which the document is to belong. This must have been previously created by the temporal:collection-create function. All versions of the temporal document will be associated with this temporal collection. |
uri | The URI to be used to identify the document in the database. If the document is not the latest version, a suffix will be concatenated to the document URI with a dot as the new URI of the document. |
options |
Options with which to customize this operation. You
can specify options in either an XML options element in
the "temporal:document-protect" namespace, or as a map:map .
The options names below are XML element localnames. When using a map,
replace any hyphens in an option name with
camel casing. For example, "an-option" becomes "anOption" when used as a
map:map key. This function supports the following
options:
|
http://marklogic.com/xdmp/privileges/temporal-document-protect
or the one user specified for this temporal collection.
CamelCased option names should be used if the options are specified as map:map.
TEMPORAL-NOEXTIME is thrown if archive path option is specified and no expire time or duration option is specified.
When archive path option is specified, the latest version of the temporal document will be archived if it exists; else the version with the temporal document URI will be archived. If none of the above exists (such as the temporal document is deleted and version URI is used to create them), the protection will still be applied but no archive copy will be made.
temporal:document-protect("bitemp","tempdoc5.xml", <options xmlns="temporal:document-protect"><archivePath>blah2.xml</archivePath> <duration>P6Y</duration> </options>)
temporal:document-protect("bitemp", "tempdoc.xml", map:map(<map:map xmlns:map="http://marklogic.com/xdmp/map"> <map:entry key="archivePath"> <map:value>world.xml</map:value> </map:entry> <map:entry key="expireTime"> <map:value>2016-06-27T14:13:05.472585-07:00</map:value> </map:entry> </map:map>))