1

如何构建此 XQuery 以在 CORB 作业中运行?使用匹配的候选 URI 处理每个文档的第二个模块不起作用。

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)
4

1 回答 1

2

您的流程模块有几个小问题:

  • URIS 模块中声明的变量$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 为何不工作,有时最简单的方法是将 Process Module XQuery 的内容粘贴到 Query Console 中,为$URI变量分配一个值,然后在 QConsole 中执行。

例如:

declare variable $URI as xs:string external := "/some/test/doc.xml";
于 2017-08-09T00:25:44.317 回答