简体   繁体   中英

Getting error in MarkLogic mlcp import- arg3 is not of type node() due to string typecast error during uri transform

I am using below transform xquery to change the document uri during mlcp import.

And I am getting below typecast error during import.

This is my Xquery:

xquery version "1.0-ml";
module namespace doc = "http://marklogic.com/example";

declare function doc:transform(
  $content as map:map,
  $context as map:map
) as map:map*
{
  let $systemref := map:get($content, "value")/EDILogFile/SystemRef
  let $_ := map:put($content, "value","EDI"||"_"||$systemref||"xml")
  return
    $content
};

This is the error:

23/01/17 09:17:46 ERROR contentpump.TransformWriter: Batch 1795441416.0: Document failed permanently: /opt/mlcp-10.0.9-bin/mlcp-10.0.9/bin/data/EDI_22000041.xml
23/01/17 09:17:46 WARN contentpump.TransformWriter: <error:format-string xmlns:error="http://marklogic.com/xdmp/error" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">XDMP-ARGTYPE: (err:XPTY0004) temporal:document-insert(xs:untypedAtomic("Unitempcoll"), "/opt/mlcp-10.0.9-bin/mlcp-10.0.9/bin/data/EDI_22000041.xml", "EDI_22000041xml", &lt;options xmlns="xdmp:document-insert"&gt;&lt;quality&gt;0&lt;/quality&gt;&lt;metadata/&gt;&lt;/options&gt;) -- arg3 is not of type node()</error:format-string>
23/01/17 09:17:46 INFO contentpump.LocalJobRunner:  completed 100%
23/01/17 09:17:46 INFO contentpump.LocalJobRunner: com.marklogic.mapreduce.MarkLogicCounter:
23/01/17 09:17:46 INFO contentpump.LocalJobRunner: INPUT_RECORDS: 1
23/01/17 09:17:46 INFO contentpump.LocalJobRunner: OUTPUT_RECORDS: 1
23/01/17 09:17:46 INFO contentpump.LocalJobRunner: OUTPUT_RECORDS_COMMITTED: 0
23/01/17 09:17:46 INFO contentpump.LocalJobRunner: OUTPUT_RECORDS_FAILED: 1

I have tried the below changes in the transform xquery which did not help to solve my error -

map:get($content, "value")/EDILogFile/SystemRef/text()
let $systemref := fn:string(map:get($content, "value")/EDILogFile/SystemRef)

The error message is telling you that the third parameter of temporal:document-insert is not a node() . Indeed, it is a string that is the value of the intended URI of the document.

You are setting the new/updated URI as the value property in the $content map.

map:put($content, "value","EDI"||"_"||$systemref||"xml")

You need to instead be updating the uri property:

map:put($content, "uri", "EDI"||"_"||$systemref||"xml")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM