Loading TOC...

temporal:statement-set-document-version-uri

temporal:statement-set-document-version-uri(
   $document-uri as xs:string,
   $version-uri as xs:string
) as empty-sequence()

Summary

This function sets document URI for a temporal document to be used for the new version of temporal document to be generated in the current statement. Throw exception if the version URI is the same as the temporal document URI or if a fragment with the specified version URI exists in the database.

Parameters
$document-uri The URI of the temporal document.
$version-uri The URI of the new version of the temporal document.

Example


xquery version "1.0-ml";
import module namespace temporal = "http://marklogic.com/xdmp/temporal"
    at "/MarkLogic/temporal.xqy";
let $root :=
<tempdoc>
    <content>v1-content here</content>
</tempdoc>
let $options :=
<options xmlns="xdmp:document-insert">
    <metadata>
       <map:map xmlns:map="http://marklogic.com/xdmp/map">
         <map:entry key="validStart">
           <map:value>1601-01-01T13:59:00Z</map:value>
         </map:entry>
         <map:entry key="validEnd">
           <map:value>9999-12-31T11:59:59Z</map:value>
         </map:entry>
       </map:map>
    </metadata>
</options>
return
temporal:statement-set-document-version-uri("koolorder.xml","koolorder.v1.xml"),
temporal:document-insert("kool", "koolorder.xml", $root, $options)

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.