I need some help with MarkLogic, XQuery & corb,
I have millions of documents in the database, I'm trying to write the XQuery to saved the matched uris.
urisVersions.xqy
xquery version "1.0-ml";
let $uris := cts:uri-match("*versions/*version-*")
return (fn:count($uris), $uris)
urisSave.xqy
xquery version "1.0-ml";
declare variable $URI as xs:string external;
let $uri := $URI
return xdmp:save("/tmp/test",$uri)
save-job.properties
XCC-CONNECTION-URI= xcc://user:admin@localhost:8000/
URIS-MODULE=urisVersions.xqy|ADHOC
XQUERY-MODULE=urisSave.xqy|ADHOC
THREAD-COUNT=10
Getting below error SEVERE: fatal error com.marklogic.developer.corb.CorbException: Invalid argument type at URI: /12312/versions/item/papkov.xml.version-24
Can anyone please help me to solve this issue?
Configure the job with the
PROCESS-TASKoption to use thecom.marklogic.developer.corb.ExportBatchToFileTaskclass, which will write the results of each process module invocation to an output file. You can configure where to write the file and the filename withEXPORT-FILE-NAMEandEXPORT-FILE-DIRoptions. If you don't configure the EXPORT-FILE-DIR and just give it a filename with EXPORT-FILE-NAME it writes relative from where CoRB is launched.Change your process module to simply return the $URI value:
If you just want to write the URIs to a file and aren't transforming or doing any processing, then you could use the ModuleExecutor class and have it write the results of the cts:uri-match directly to the output file.