Project

Profile

Help

XQuery - range on sequence not working

Added by Anonymous about 14 years ago

Legacy ID: #8013780 Legacy Poster: David Lee (daldei)

Is this a bug or a feature ? This xquery expression in 9.2 HE (1 to 10)[2 to 4] Gives me this error: FORG0006: Effective boolean value is not defined for a sequence of two or more items starting with a numeric value In MarkLogic it produces the "expected" result. I get the same error with this (1,2,3,4,5)[2 to 4] Is this a bug or a misunderstanding ? Thanks -David Lee


Replies (2)

RE: XQuery - range on sequence not working - Added by Anonymous about 14 years ago

Legacy ID: #8014729 Legacy Poster: Michael Kay (mhkay)

Saxon is in conformance with the spec here: MarkLogic isn't (it's a documented extension in MarkLogic if you use the language dialect 1.0-ml). Write (1 to 10)[position() = 2 to 4] instead. I find it rather surprising that MarkLogic found it necessary to provide this extension when the capability is readily available using standard syntax. It's not like try/catch or something where there is a need to fill functional gaps in the language.

RE: XQuery - range on sequence not working - Added by Anonymous about 14 years ago

Legacy ID: #8014759 Legacy Poster: David Lee (daldei)

Thanks. In hindshight it does look a little odd. The expression (1 to 10][2 to 4] expands to (1,2,3,4,5,6,7,8,9,10)[1,2,3,4] which "of course" is invalid. My "guess" (as a new MarkLogic user) is that this syntax was invented to support the cts:search() functionality. It is the documented way to effeciently return a subset of a search, for example a search that returns 10mil items you can get the 10th to 20th item efficently using cts:search( ...)[ 10 to 20] Thats what the ML docs say to do and I got so used to doing it I didnt think about if this was "standard" or not. Although, as you say, I dont see what that has to be a language extension ... when [position() >= 10 and position() < 20] would work (?) maybe just not as 'easy on the eye'. Anyway thanks for the informative reply.

    (1-2/2)

    Please register to reply