Loading TOC...

MarkLogic 12 EA 2 Product Documentation
op:from-doc-descriptors

op:from-doc-descriptors(
   $docs-descriptors as map:map+,
   [$qualifier as xs:string?]
) as map:map

Summary

This function constructs document rows from the docsDescriptors.

Parameters
$docs-descriptors A map of document descriptors. Each document descriptor describes a document. A document descriptor contains a combination of uri, doc, collections, metadata, permissions, quality and temporalCollection. This is a simpler form of op:from-param.
$qualifier Specifies a name for qualifying the column names.

See Also

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-doc-descriptors(
  map:entry("uri", '/optic/update/write1.xml')
  =>map:with("doc", <doc>1</doc>)
  =>map:with("collections", ("from-doc-descriptor", "optic"))
  =>map:with("metadata", map:entry("meta", "value1"))
  =>map:with("permissions", (xdmp:permission("rest-reader","read"),xdmp:permission("rest-writer","update")))
  =>map:with("quality", 1)
  =>map:with("temporalCollection", "update")
  )
=>op:result()
  

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";
declare option xdmp:update "true";

let $doc-descriptors := (
    map:entry("uri", '/optic/update/write1.xml')
      =>map:with("doc", <doc>1</doc>)
      =>map:with("collections", ("from-doc-descriptor", "optic"))
      =>map:with("metadata", map:entry("validStart", "2014-04-03T11:00:00")=>map:with("validEnd", "9999-12-31T11:59:59Z"))
      =>map:with("permissions", (xdmp:permission("rest-reader","read"),xdmp:permission("rest-writer","update")))
      =>map:with("quality", 1)
      =>map:with("temporalCollection", "update"),
    map:entry("uri", '/optic/update/write2.xml')
      =>map:with("doc", <doc>2</doc>)
      =>map:with("collections", ("from-doc-descriptor", "optic"))
      =>map:with("metadata", map:entry("validStart", "2014-04-03T11:00:00")=>map:with("validEnd", "9999-12-31T11:59:59Z"))
      =>map:with("permissions", (xdmp:permission("rest-reader","read"),xdmp:permission("rest-writer","update")))
      =>map:with("quality", 2)
      =>map:with("temporalCollection", "update")
  )
return op:from-doc-descriptors($doc-descriptors)
=>op:write()
=>op:result()
  

Example

xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

let $doc-descriptors := (
  map:entry("uri", '/test/fromDocUris/0.xml')=>map:with("doc", <doc>0</doc>),
  map:entry("uri", '/test/fromDocUris/1.xml')=>map:with("doc", <doc>1</doc>),
  map:entry("uri", '/test/fromDocUris/5.xml')=>map:with("doc", <doc>5</doc>)
  )
let $from-doc-descriptors := op:from-doc-descriptors($doc-descriptors, "left")
let $rows := (
  map:entry("uri", '/test/fromDocUris/0.xml')=>map:with("val", 0),
  map:entry("uri", '/test/fromDocUris/5.xml')=>map:with("val", 5))
let $from-literals := op:from-literals($rows, "right")
return $from-doc-descriptors
  => op:join-inner($from-literals, op:on(op:view-col("left", "uri"), op:view-col("right", "uri")))
  => op:order-by(op:view-col("left", "uri"))
  => op:result()
  

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