Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Syntax error due to empty string or sequence in xdmp:unpath #333

Open
joecrean opened this issue Sep 26, 2019 · 0 comments
Open

Syntax error due to empty string or sequence in xdmp:unpath #333

joecrean opened this issue Sep 26, 2019 · 0 comments

Comments

@joecrean
Copy link

joecrean commented Sep 26, 2019

Trying to merge some documents using xquery in query console.

The call to merging:build-merge-models-by-uri results in the following exception

XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected $end

Specifically In /com.marklogic.smart-mastering/survivorship/merging/base.xqy on line 1761

It boils down to passing an empty string to xdmp:unpath in the function get-instance-props-by-path.
Here is the link to the line of code - the variable middle-path is empty.

xdmp:unpath($middle-path, $ns-map, $instance)/node()[fn:node-name(.) = $target-name]

In my case i have a simple Entity structure in a standard envelope structure (DHF 411).
e.g. /es:envelope/es:instance/FooEntity/keyword. The string-join call on 1578 excludes the last
member of the tokenised sequence and thus the only member of that sequence in my case thus resulting in an empty sequence which is passed into the unpath call and at that point throws
the above exception.

joecrean pushed a commit to joecrean/smart-mastering-core that referenced this issue Sep 27, 2019
arises when entity definition has a flat stucture - existing code
strips out the last path component resulting in an empty path being
passed to xdmp:unpath
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant