W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2009

[Bug 6647] New: [XQuery11UC] Windowing use case Q17: Invalid query

From: <bugzilla@wiggum.w3.org>
Date: Tue, 03 Mar 2009 12:53:41 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-6647-523@http.www.w3.org/Bugs/Public/>

           Summary: [XQuery11UC] Windowing use case Q17: Invalid query
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
               URL: http://www.w3.org/TR/2008/WD-xquery-11-use-cases-
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 1.1 Use Cases
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: wouter.cordewiner@datadirect.com
         QAContact: public-qt-comments@w3.org
                CC: marc.van.cappellen@datadirect.com

In XQuery 1.1 Use Cases, Working Draft 3 December 2008 the windowing use case
Q17 have query errors:

1. The window end condition is missing, ie "end when newstart" is not
appropriate for this query I think.

2. day-from-date(xs:dateTime($cur/@date)) is not correct as a xs:dateTime value
is provided where day-from-date() expects a xs:date().

Correcting both issues, I believe the corrected query should be (adhering to
the expected results):


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

for sliding window $w in $seq/sequence/* 
  start $cur previous $prev 
   when day-from-dateTime(xs:dateTime($cur/@date)) ne
day-from-dateTime(xs:dateTime($prev/@date)) or empty($prev)
  end $end next $next
   when day-from-dateTime(xs:dateTime($end/@date)) ne
  <mostValuableCustomer endOfDay="{xs:dateTime($cur/@date)}">{
    let $companies :=   for $x in distinct-values($w/@billTo ) 
                        return <amount company="{$x}">{sum($w[@billTo eq
    let $max := max($companies) 
    for $company in $companies
    where $company eq xs:untypedAtomic($max)
    return $company


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 Tuesday, 3 March 2009 12:53:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:26 UTC