如何构建此XQuery以在CORB作业中运行?使用匹配的候选URI处理每个doc的第二个模块不起作用。
URIS模块
(:a module to select the candidate URIs to process:)
xquery version "1.0-ml";
declare variable $target-collection := "/activity";
declare variable $update-collection := "/activity/analytics-read-added"
let $uris := cts:uris( (),
(),
cts:and-query((
cts:collection-query($target-collection),
cts:not-query(cts:collection-query($update-collection))
))
)
return (count($uris), $uris)
流程模块
(:a module to process each doc with a matching candidate URI:)
declare variable $URI as xs:string external;
xdmp:document-add-permission($URI,xdmp:permission("act-read-role","read")),
xdmp:document-add-collections($URI,$update-collection)
答案 0 :(得分:2)
您的流程模块存在一些小问题:
$update-collection
。 xdmp:document-add-permissions()
将这些更改应用于Process模块:
xquery version "1.0-ml";
(:a module to process each doc with a matching candidate URI:)
declare variable $URI as xs:string external;
declare variable $update-collection := "/activity/analytics-read-added";
xdmp:document-add-permissions($URI, xdmp:permission("act-read-role","read")),
xdmp:document-add-collections($URI, $update-collection)
如果您需要排除故障并调查流程模块无法正常工作的原因,有时最简单的方法是将Process Module XQuery的内容粘贴到Query Console中,为$URI
变量赋值,并在QConsole中执行。
例如:
declare variable $URI as xs:string external := "/some/test/doc.xml";