Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was 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

@joecrean

Description

@joecrean

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions