The Documents, Directories, Properties, and Locks functions are XQuery built-in extension functions that get information from documents, directories, properties, and locks from MarkLogic Server. All of these are stored as fragments in a database.
for $d in xdmp:collection-locks( ("http://example.com/col1/", "http://example.com/col2/")) return xdmp:node-uri($d) => http://example.com/bar.xml http://example.com/baz.xml
xquery version "0.9-ml" declare namespace cpf="http://marklogic.com/cpf" for $d in xdmp:collection-properties( ("http://example.com/col1/", "http://example.com/col2/")) where $d/property::cpf:error return xdmp:node-uri($d) => A list of document URIs of documents that have a cpf:error property in their corresponding properties documents. For example: http://example.com/bar.xml http://example.com/baz.xml
for $d in xdmp:directory("http://example.com/foo/","1") return xdmp:node-uri($d) => http://example.com/foo/bar.xml http://example.com/foo/baz.xml
for $d in xdmp:directory-locks("http://example.com/foo/","1") return xdmp:node-uri($d) => http://example.com/foo/bar.xml http://example.com/foo/baz.xml
xdmp:directory-properties("http://example.com/dir/","1") => <prop:properties xmlns:prop="http://marklogic.com/xdmp/property"> <prop:directory/> </prop:properties>
The properties document returned has one directory element, indicating that there is a single directory that is an immediate child of the specified directory.
xdmp:document-get-properties( "http://example.com/foo.xml", fn:QName("http://examples.com/","priority")) => <priority xmlns="http://examples.com/">5</priority>
xdmp:document-get-quality("example.xml") => 10
xdmp:document-locks("example.xml") => <lock:lock> <lock:active-locks> <lock:active-lock> <lock:lock-type>write</lock:lockt-ype> <lock:lock-scope>exclusive</lock:lock-scope> <lock:depth>infinity</lock:depth> <lock:owner> http://example.com/~user </lock:owner> <lock:timeout>5000</lock:timeout> <lock:lock-token> http://marklogic.com/xdmp/locks/e71d4fae </lock:lock-token> <lock:timestamp>5234768</lock:timestamp> <sec:user-id>52378234768</sec:user-id> </lock:active-lock> </lock:active-locks> </lock:lock>
xdmp:document-properties() => <prop:properties xmlns:prop="http://marklogic.com/xdmp/property"> Property Node1 </prop:properties> <prop:properties xmlns:prop="http://marklogic.com/xdmp/property"> Property Node2 </prop:properties> <prop:properties xmlns:prop="http://marklogic.com/xdmp/property"> Property NodeN </prop:properties>