This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 11762 - [XQuery30UC] additional parens needed in "Windowing" Q18 and Q19
Summary: [XQuery30UC] additional parens needed in "Windowing" Q18 and Q19
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.0 Use Cases (show other bugs)
Version: Working drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
: 11913 11929 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-14 17:46 UTC by Andrew Eisenberg
Modified: 2011-03-30 19:17 UTC (History)
1 user (show)

See Also:


Attachments

Description Andrew Eisenberg 2011-01-14 17:46:02 UTC
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>
Comment 1 Matthias Brantner 2011-02-01 14:31:16 UTC
*** Bug 11913 has been marked as a duplicate of this bug. ***
Comment 2 Matthias Brantner 2011-02-01 14:39:33 UTC
*** Bug 11929 has been marked as a duplicate of this bug. ***