【发布时间】:2016-06-16 08:36:15
【问题描述】:
我已经在计划任务 XQuery 中编写了这段代码 -
xquery version "1.0-ml";
declare namespace grp = "http://marklogic.com/xdmp/group";
declare namespace c = 'http://iddn.icis.com/ns/core';
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
declare variable $task-file-path := "/var/tmp/Projects/update-malformed-ids-task.xqy";
declare variable $string-starting-with-new-line-pattern := " *";
declare variable $string-starting-with-space-pattern := " *";
declare variable $LIVE-ASSET-COLLECTION := "live-collection";
declare variable $batch-size := 100;
declare function local:is-migration-needed()
{
(
fn:exists(cts:element-value-match(xs:QName("c:id"), $string-starting-with-space-pattern, (), cts:collection-query($LIVE-ASSET-COLLECTION))) or
fn:exists(cts:element-value-match(xs:QName("c:id"), $string-starting-with-new-line-pattern, (), cts:collection-query($LIVE-ASSET-COLLECTION)))
)
};
declare function local:migrate()
{
if(local:is-migration-needed())
then (: do task here :)
else ()
}
local:migrate()
但此代码不适用于计划任务。错误日志中记录的错误为XDMP-ARG: cts:element-value-match(xs:QName("c:id"), " *", (), cts:collection-query("live-collection")) -- arg2 is invalid
我在 QConsole 上尝试了相同的查询。它工作正常。我还尝试在同一个文件上使用xdmp:spawn,效果也很好。
我还尝试在没有任何模式或通配符的情况下触发简单的cts:element-value-match。 计划任务中似乎不支持cts:element-value-match。
是否需要执行其他操作才能从计划任务运行此代码?
【问题讨论】:
标签: xquery marklogic marklogic-8