[Bug 11762] New: [XQuery30UC] additional parens needed in "Windowing" Q18 and Q19

http://www.w3.org/Bugs/Public/show_bug.cgi?id=11762

           Summary: [XQuery30UC] additional parens needed in "Windowing"
                    Q18 and Q19
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.0 Use Cases
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: andrew.eisenberg@us.ibm.com
         QAContact: public-qt-comments@w3.org


The query in Q18 is

declare variable $seq := fn:doc("cxml.xml");

<result>{
  for sliding window $w in $seq/sequence/* 
    start  $s when $s[self::OrderRequest]
    end  $e when $e/@orderID eq  $s/@orderID and
      $e[self::ConfirmationRequest] and $e/@status eq "reject" 
      or $e[self::ShipNotice]
  where $e[self::ShipNotice]
  return 
    <timeToShip orderID="{ $s/@orderID}">{xs:dateTime($e/@date) -
xs:dateTime($s/@date) }</timeToShip> 
}</result>

The end condition requires additional parens:

declare variable $seq := fn:doc("cxml.xml");

<result>{
  for sliding window $w in $seq/sequence/* 
    start  $s when $s[self::OrderRequest]
    end  $e when $e/@orderID eq  $s/@orderID and
      ( $e[self::ConfirmationRequest] and $e/@status eq "reject" 
        or $e[self::ShipNotice])
  where $e[self::ShipNotice]
  return 
    <timeToShip orderID="{ $s/@orderID}">{xs:dateTime($e/@date) -
xs:dateTime($s/@date) }</timeToShip> 
}</result>


The same issue occurs in Q19. It current reads:

declare variable $seq := fn:doc("cxml.xml");

<result>{
  for sliding window $w in $seq/sequence/* 
    start previous $wSPrev when $wSPrev[self::OrderRequest]
    end next $wENext when $wENext/@orderID eq  $wSPrev/@orderID and
          ( $wENext[self::ConfirmationRequest] and $wENext/@status eq "reject") 
            or $wENext[self::ShipNotice]
  where $wENext[self::ShipNotice]
  return 
    <bundleWith orderId="{$wSPrev/@orderID}">{
        for sliding window $bundle in $w 
          start  $bSCur 
            when $bSCur[self::OrderRequest] and $bSCur/@shipTo eq
$wSPrev/@shipTo
          end  $bECur next $bENext 
            when $bECur/@orderID eq  $bSCur/@orderID 
             and ($bECur[self::ConfirmationRequest] and $bECur/@status eq
"reject") 
              or $bECur[self::ShipNotice]
          where empty($bENext)
          return $bSCur
    }</bundleWith>
}</result>


In both end conditions, additional parens are needed:

declare variable $seq := fn:doc("cxml.xml");

<result>{
  for sliding window $w in $seq/sequence/* 
    start previous $wSPrev when $wSPrev[self::OrderRequest]
    end next $wENext when $wENext/@orderID eq  $wSPrev/@orderID and
          ( ( $wENext[self::ConfirmationRequest] and $wENext/@status eq
"reject") 
            or $wENext[self::ShipNotice] )
  where $wENext[self::ShipNotice]
  return 
    <bundleWith orderId="{$wSPrev/@orderID}">{
        for sliding window $bundle in $w 
          start  $bSCur 
            when $bSCur[self::OrderRequest] and $bSCur/@shipTo eq
$wSPrev/@shipTo
          end  $bECur next $bENext 
            when $bECur/@orderID eq  $bSCur/@orderID 
             and ( ($bECur[self::ConfirmationRequest] and $bECur/@status eq
"reject") 
              or $bECur[self::ShipNotice] )
          where empty($bENext)
          return $bSCur
    }</bundleWith>
}</result>

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 14 January 2011 17:46:04 UTC