This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The solution to windowing use case Q7 (3.15.7) does not seem to handle the case where Anton enters the building, leaves, enters again, and then Barbara enters. A new window should open each time Anton enters even if the conditions for closing the previous window have not been satisfied.
Indeed, Michael. Here is a proposal for a solution: <result>{ for sliding window $w in $seq/stream/event start $s when $s/person = "Anton" and $s/direction = "in" only end $e when $e/person = "Barbara" and $e/direction = "in" where xs:dateTime($e/@time) - xs:dateTime($s/@time) < xs:dayTimeDuration("PT1H") return <warning time="{ $e/@time }">Barbara: Anton arrived 1h ago</warning> }</result> Notice the "sliding" instead of tumbling. Probably the "where" could also be replaced by a "and" with the "only end" condition.
The solution from Franc might cause several notifications. I would propose: declare variable $seq := fn:doc("person_events.xml"); <result>{ for tumbling window $w in $seq/stream/event start $s when $s/person eq "Anton" and $s/direction eq "in" only end $e next $n when xs:dateTime($n/@time) - xs:dateTime($s/@time) gt xs:dayTimeDuration("PT1H") or ($e/person eq "Barbara" and $e/direction eq "in") or ($e/person eq "Anton" and $e/direction eq "out") where $e/person eq "Barbara" and $e/direction eq "in" return <warning time="{ $e/@time }">Barbara: Anton arrived 1h ago</warning> }</result>
For the current working draft I used my solution and I mark this bug FIXED. Mike, if you agree with my solution, please mark it CLOSED.