[Bug 29622] New: [XQ31] Atomization in Postfix Lookup, Unary Lookup

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29622

            Bug ID: 29622
           Summary: [XQ31] Atomization in Postfix Lookup, Unary Lookup
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.1
          Assignee: jonathan.robie@gmail.com
          Reporter: tim@cbcl.co.uk
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

In 3.11.3.1 Unary Lookup we read

for $k in KS
return .($k)

and in 3.11.3.2 Postfix Lookup we read

for $e in E, $s in S return $e($s)

In neither is atomization explicit, so as written it is interpreted as:

for $k in KS
return .(fn:data($k))

and

for $e in E, $s in S return $e(fn:data($s))

Consider 

['A', 'B', 'C'] ! ?([1, 2])

is interpreted as

['A', 'B', 'C'] ! (for $k in ([1, 2]) return .(fn:data($k))

which causes an error since $k iterates over the single array item, and
fn:data([1, 2]) is the sequence (1, 2).

Similarly

['a', 'b', 'c'] ?([1, 2]))

is interpreted as

for $e in ['a', 'b', 'c'], $s in [1, 2] return $e(fn:data($s))

and it should fail in a similar manner.

I propse that the specification be modified to read in 3.11.3.1 Unary Lookup 

for $k in fn:data(KS)
return .($k)

and in 3.11.3.2 Postfix Lookup 

for $e in E, $s in fn:data(S) return $e($s)

The only effect is to make some queries which would otherwise return XPTY0004
return a non-error.  It affects cases where the key specfier includes arrays or
elements whose typed value is a sequence.

Note that one implementation already behaves in the manner suggested.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 11 May 2016 12:10:11 UTC