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 15285 - [XQ30UseCases] WindowingUseCase05 - incorrect results
Summary: [XQ30UseCases] WindowingUseCase05 - incorrect results
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.0 Use Cases (show other bugs)
Version: Last Call drafts
Hardware: PC All
: 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:
Depends on:
Blocks:
 
Reported: 2011-12-20 18:21 UTC by Michael Kay
Modified: 2012-05-31 19:15 UTC (History)
3 users (show)

See Also:


Attachments

Description Michael Kay 2011-12-20 18:21:52 UTC
The results I get from this test are 8.88 8.68 12.52 15.6 24.72, which I believe to be correct.

For example, the third window is (6, 13, 33). The smoothed average is therefore 

(0.2*33) + (0.8*(0.2*13 + 0.8*6))

which is 12.52, not 12.32 as given.

(Note, the error appears to be present in the published use cases)
Comment 1 Matthias Brantner 2011-12-20 18:27:38 UTC
I have confirmed the proposed result with Zorba and updated the test's expected result.

I'm changing the component of the bug to "XQuery 3.0 Use Cases" because the expected results given in the use cases document also needs to be changed.
Comment 2 Jonathan Robie 2011-12-20 18:38:05 UTC
Fixed in the internal Working Draft of the XQuery 3.0 Use Cases document.
Comment 3 Andrew Eisenberg 2012-03-15 16:43:35 UTC
The resolution for Bug #11763 was to change the source document for Q5. With this modified source document, the result of the query should continue to be:

8.88 8.68 12.32 15.24 23.92

For example, the third window is (6, 13, 32). The smoothed average is therefore 

(0.2*32) + (0.8*(0.2*13 + 0.8*6))

which is 12.32.
Comment 4 Jonathan Robie 2012-03-27 15:23:46 UTC
Fixed now:

<quote>
Solution in XQuery:

declare variable $timesequence := fn:doc("temp_events.xml");
let $SMOOTH_CONST := 0.2

for sliding window $w in $timesequence/stream/event
  start at $s_pos when true()
  only end at $e_pos when $e_pos - $s_pos eq 2
return
  round-half-to-even($SMOOTH_CONST * data($w[3]/@temp) + (1 - $SMOOTH_CONST) *
    ( $SMOOTH_CONST * data($w[2]/@temp) +
      (1 - $SMOOTH_CONST) * data($w[1]/@temp) ), 2)

Expected Result:

8.88 8.68 12.32 15.24 23.92
</quote>