0

I am new to MLDataHubFramework,started to create a new entity flow by following the marklogic documentation.
1. Created Customer entity and ingested to staging database.
2. While trying to perform the harmonization am getting the below issue.

ERROR Output:

java.lang.RuntimeException: com.marklogic.client.FailedRequestException: Local message: failed to apply resource at resources/ml:sjsFlow: Internal Server Error. Server Message: TDE-INDEX: xdmp:eval("xdmp.docume
ntInsert(\"/12545362905389506919.json\",trace,xdmp.de...", {trace:{trace:{jobId:"38b8a84d-7927-4aac-a482-33d64a9cf56e", format:"json", traceId:"12545362905389506919", ...}}}, {database:"3883525708217113046", co
mmit:"auto", update:"true", ...}) -- Error applying template /tde/Customer-0.0.1.tdex to document /12545362905389506919.json: TDE-EVALFAILED: Eval for $subject-iri='sem:iri(concat("http://example.com/Customer-0
.0.1/Customer/", fn:encode-for-uri(./CustomerId)))' returns TDE-BADVALEXPRESSION: Invalid val expression: XDMP-ARGTYPE: (err:XPTY0004) arg1 is not of type xs:string? . See the MarkLogic server error log for fur
ther detail.

But here I have defined the CustomerId as string.I tried with multiple entities and getting same issue for all. Can anyone suggest me what goes wrong? I have cross verified the TDE files and other stuff(schema,entity json,xsd) as well but didn't see any issue at ll in those files.

Dave Cassel
  • 8,352
  • 20
  • 38

1 Answers1

0

MarkLogic is saying that when it applied this TDE template to the new document, it got a value that didn't fit.

Error applying template /tde/Customer-0.0.1.tdex to document /12545362905389506919.json: TDE-EVALFAILED: Eval for $subject-iri='sem:iri(concat("http://example.com/Customer-0 .0.1/Customer/", fn:encode-for-uri(./CustomerId)))' returns TDE-BADVALEXPRESSION: Invalid val expression: XDMP-ARGTYPE: (err:XPTY0004) arg1 is not of type xs:string?

Try this:

  • get the content of your new document in a variable
  • use your "context" from the template against that document
  • use ./CustomerId and see what you get

Something like:

let $doc := document { <envelope... /> }
let $context := $doc/my/context/path
return $context/CustomerId

I'm wondering whether you might be returning more than one CustomerId, which would fit the error message.

If that doesn't do it, I encourage you to update your question with minimal versions of your document and your template needed to recreate the error. With that information, it should be a lot easier to spot the problem.

Dave Cassel
  • 8,352
  • 20
  • 38