temporal:document-load( $temporal-collection as xs:string, $location as xs:string, [$options as (element()|map:map)?] ) as empty-sequence()
This function inserts a document into the database and stores it as a temporal document. The document will belong to the specified temporal collection to ensure that it can only be updated or deleted using the temporal functions. If a temporal document already exists at the specified URI, this function performs an update instead of an insert. (Note that updates on temporal documents mean that a new document is created in the temporal collection with a different time period.)
An exception is thrown if $temporal-collection
is not
temporal or $collection
includes temporal collection(s).
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.
|
location | The location of the input document. If the scheme of the location is HTTP (that is, if the string starts with "http://"), then the document is requested over HTTP. If the scheme is file (that is, if the string starts with "file://"), then the document is requested over file protocol from the local filesystem. Otherwise, the document is fetched from the local filesystem. On the filesystem, the path can be fully qualified or relative. Relative pathnames are resolved from the directory in which MarkLogic Server is installed. |
options |
Options with which to customize this operation. You
can specify options as either an options XML element
in the "temporal:document-load" namespace, or as a map:map .
The options names below are XML element localnames. When using a map,
replace the hyphens with camel casing. For example, "an-option"
becomes "anOption" when used as a map:map key.
This function supports the following options, plus the options from
xdmp:http-get
(when retrieving content via HTTP).
|
xquery version "1.0-ml"; import module namespace temporal = "http://marklogic.com/xdmp/temporal" at "/MarkLogic/temporal.xqy"; temporal:document-load("temporalCollection", "c:\myFile.xml", <options xmlns="temporal:document-load"> <uri>/documents/myFile.xml</uri> <repair>none</repair> <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> <permissions>{xdmp:default-permissions()}</permissions> </options>) => Loads the temporal document with a URI "/documents/myFile.xml" into the temporal collection, "temporalCollection", and does not perform tag repair during the load.