<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>11762</bug_id>
          
          <creation_ts>2011-01-14 17:46:02 +0000</creation_ts>
          <short_desc>[XQuery30UC] additional parens needed in &quot;Windowing&quot; Q18 and Q19</short_desc>
          <delta_ts>2011-03-30 19:17:45 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQuery 3.0 Use Cases</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrew Eisenberg">andrew.eisenberg</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>matthias.brantner</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>44353</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Eisenberg">andrew.eisenberg</who>
    <bug_when>2011-01-14 17:46:02 +0000</bug_when>
    <thetext>The query in Q18 is

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

&lt;result&gt;{
  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 &quot;reject&quot; 
      or $e[self::ShipNotice]
  where $e[self::ShipNotice]
  return 
    &lt;timeToShip orderID=&quot;{ $s/@orderID}&quot;&gt;{xs:dateTime($e/@date) - xs:dateTime($s/@date) }&lt;/timeToShip&gt; 
}&lt;/result&gt;

The end condition requires additional parens:

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

&lt;result&gt;{
  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 &quot;reject&quot; 
        or $e[self::ShipNotice])
  where $e[self::ShipNotice]
  return 
    &lt;timeToShip orderID=&quot;{ $s/@orderID}&quot;&gt;{xs:dateTime($e/@date) - xs:dateTime($s/@date) }&lt;/timeToShip&gt; 
}&lt;/result&gt;


The same issue occurs in Q19. It current reads:

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

&lt;result&gt;{
  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 &quot;reject&quot;) 
            or $wENext[self::ShipNotice]
  where $wENext[self::ShipNotice]
  return 
    &lt;bundleWith orderId=&quot;{$wSPrev/@orderID}&quot;&gt;{
        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 &quot;reject&quot;) 
              or $bECur[self::ShipNotice]
          where empty($bENext)
          return $bSCur
    }&lt;/bundleWith&gt;
}&lt;/result&gt;


In both end conditions, additional parens are needed:

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

&lt;result&gt;{
  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 &quot;reject&quot;) 
            or $wENext[self::ShipNotice] )
  where $wENext[self::ShipNotice]
  return 
    &lt;bundleWith orderId=&quot;{$wSPrev/@orderID}&quot;&gt;{
        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 &quot;reject&quot;) 
              or $bECur[self::ShipNotice] )
          where empty($bENext)
          return $bSCur
    }&lt;/bundleWith&gt;
}&lt;/result&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44948</commentid>
    <comment_count>1</comment_count>
    <who name="Matthias Brantner">matthias.brantner</who>
    <bug_when>2011-02-01 14:31:16 +0000</bug_when>
    <thetext>*** Bug 11913 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44952</commentid>
    <comment_count>2</comment_count>
    <who name="Matthias Brantner">matthias.brantner</who>
    <bug_when>2011-02-01 14:39:33 +0000</bug_when>
    <thetext>*** Bug 11929 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>