import module namespace dls = "http://marklogic.com/xdmp/dls" at "/MarkLogic/dls.xqy";
let $uri := "/ml-workflow/test2.xml"
let $content := <apple>APPLE</apple>
let $properties := <prop>MANGO</prop>
return
(dls:document-insert-and-manage($uri,fn:false(),$content),dls:document-set-properties($uri,$properties) )
问题:我正在尝试在同一事务中使用Marklogic dls API插入文档并设置其属性,但它不允许我这样做。 请帮助!
答案 0 :(得分:1)
http://blakeley.com/blogofile/2013/06/21/introduction-to-multi-statement-transactions/
中的代码示例对此进行了解释尝试这样的事情:
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
declare option xdmp:transaction-mode "update";
let $uri := "/ml-workflow/test2.xml"
let $content := <apple>APPLE</apple>
return dls:document-insert-and-manage($uri,fn:false(),$content)
;
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
let $uri := "/ml-workflow/test2.xml"
let $properties := <prop>MANGO</prop>
return dls:document-set-properties($uri,$properties)
xdmp:commit()
如果使用外部变量,则可以避免重复的值。