Lookup operator, conformance

Monday, 24 October 2022 · 3 messages
HR
Hans-Jürgen Rennau24 Oct 2022 12:45 #
Hello, I noticed that the lookup operator (?) accepts as key expression also non-parenthesized expressions, e.g.:
$map?$key
It seems to me that the XQuery spec does not allow that - the key specifier must be an NCName, an integer, * or a parenthesized expression [1]: [126] KeySpecifier ::= NCName | IntegerLiteral | ParenthesizedExpr | "*" So only this should be allowed: $map?($key) But I am not quite sure if I do not overlook something. *My question*: is the acceptance of non-parenthesized key expressions conformant behaviour, or a (certainly intended) laxness? Kind regards, Hans-Jürgen [1] https://www.w3.org/TR/xquery-31/#id-lookup
MH
Martin Honnen24 Oct 2022 13:29 #
Quoted text · Hans-Jürgen Rennau · 20 lines
Am 10/24/2022 um 12:45 PM schrieb Hans-Jürgen Rennau: > Hello, > > I noticed that the lookup operator (?) accepts as key expression also > non-parenthesized expressions, e.g.: > > $map?$key > > It seems to me that the XQuery spec does not allow that - the key > specifier must be an NCName, an integer, * or a parenthesized > expression [1]: > [126] KeySpecifier ::= NCName | IntegerLiteral | ParenthesizedExpr | "*" > So only this should be allowed: > $map?($key) > > But I am not quite sure if I do not overlook something. > > *My question*: is the acceptance of non-parenthesized key expressions > conformant behaviour, or a (certainly intended) laxness? >
If it is BaseX 10 it might be because it already tries to implement what XQuery 4 https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#id-unary-lookup is going to allow:
[141] |KeySpecifier
<https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#prod-xquery40-KeySpecifier>|   ::=
|NCName
<https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#prod-xquery40-NCName>|IntegerLiteral
<https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-IntegerLiteral>|StringLiteral
<https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-StringLiteral>|VarRef
<https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-VarRef>|ParenthesizedExpr
<https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-ParenthesizedExpr>|
"*"|
MH
Martin Honnen24 Oct 2022 15:45 #
Quoted text · Martin Honnen · 39 lines
Am 10/24/2022 um 1:29 PM schrieb Martin Honnen: > > > Am 10/24/2022 um 12:45 PM schrieb Hans-Jürgen Rennau: >> Hello, >> >> I noticed that the lookup operator (?) accepts as key expression also >> non-parenthesized expressions, e.g.: >> >> $map?$key >> >> It seems to me that the XQuery spec does not allow that - the key >> specifier must be an NCName, an integer, * or a parenthesized >> expression [1]: >> [126] KeySpecifier ::= NCName | IntegerLiteral | ParenthesizedExpr | "*" >> So only this should be allowed: >> $map?($key) >> >> But I am not quite sure if I do not overlook something. >> >> *My question*: is the acceptance of non-parenthesized key expressions >> conformant behaviour, or a (certainly intended) laxness? >> > > If it is BaseX 10 it might be because it already tries to implement > what XQuery 4 > https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#id-unary-lookup > is going to allow: > > [141] |KeySpecifier > <https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#prod-xquery40-KeySpecifier>| ::= > |NCName > <https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#prod-xquery40-NCName>|IntegerLiteral > <https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-IntegerLiteral>|StringLiteral > <https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-StringLiteral>|VarRef > <https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-VarRef>|ParenthesizedExpr > <https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#doc-xquery40-ParenthesizedExpr>| > "*"| >

⚡Generated with XQuery