This set of statements would be created at 9am:
create window TickWindow.win:time(5 min) (price double, priorprice double)
insert into TickWindow select price, prior(1, price) as priorprice from StockTickEvent
on MyMaxQueryEvent as limit select * from TickWindow where price > limit.pricelimit or priorprice > limit.pricelimit
The last statement, the on-select is the predefine query.
When the question is posed at 11am one can send in a MyMaxQueryEvent with the pricelimit property set to 70 and the listener to the on-select statement gets the result.
Simply keeping only the max price in the named window would also work if that is the only data points needed, i.e. perhaps one cannot keep all ticks e.g. because of volume.
Perhaps one doesn't want to keep only the max to satisfy other queries such as between.
Best regards,
Tom
From: Opher Etzion <opher@...>
To: CEP-Interest@yahoogroups.com
Sent: Monday, January 5, 2009 11:52:17 PM
Subject: Re: [CEP-Interest] How would you solve this simple problem?
Hello Pedro. The main issue with this query is that it is not a query
that deals directly with the event history, but with the temporal semantics
imposed by some types of events,
I agree that there is a sense to provide good support for temporal queries
and also enable to run it as an action triggered by events, but it does
not make it basic functionality of event processing, and as such, it is not
surprising that event processing products don't directly support it. See:
http://epthinking. blogspot. com/2009/ 01/on-event- processing- and-some. html
for a more detailed discussion.
Cheers,
Opher
------------ --------- --------- --------- --------- --------- -
Dr. Opher Etzion
Senior Technical Staff Member, Master Inventor
Event Processing Scientific Leader, IBM Research Lab in Haifa
Chair, Event Process Technical Society (EPTS) Steering Committee
Phone: +972-4-829-6230; Cell: +972-54-790- 2086; Fax: +972-4-829-6116
Homepage:
http://domino. research. ibm.com/comm/ research_ people.nsf/ pages/opher. index.html
Blog: http://epthinking. blogspot. com/
EPTS: http://www.ep- ts.com/
------------ --------- --------- --------- --------- --------- -
From: "Pedro Bizarro" <pedro.bizarro@ gmail.com>
To: CEP-Interest@ yahoogroups. com
Date: 06/01/2009 03:36
Subject: Re: [CEP-Interest] How would you solve this simple problem?
Dear all,
Let me recast this question and address some of the comments and
answers. But first, thanks to all, it was an impressive set of
detailed answers.
Luis is working in our research group at the University of Coimbra and
we have talked about this and other similar questions. The issue is
not about whether this is CEP or not. [A more CEP-ish, similar query
is: what is the moving 5-min avg of X (e.g., temperature, stock value,
dice roll values)? - we argue that the answer is not as clear cut as
it seems.]
The issue is one of syntax and semantics. Regarding syntax, we expect
that simple English queries can be translated into simple CEP
expressions. What we noticed is that in a few cases, the semantics of
the engines are that simple English queries:
a) can be translated into simple CEP expressions but those expressions
do not return what we expected; or
b) to get the semantics we want, we are forced to write CEP
expressions significantly more complex then what we expected.
Regarding the state of the CEP field, my personal impression is that,
as also mentioned in one of the panels at the EPTS'08 Symposium, if
anything CEP is under-hyped. Several tech-savvy managers we have
talked with were unaware of CEP companies, products, and technology
even though they have systems were CEP engines could shine.
Also, this thread is not bad press for CEP. Ok, there is room for
improvement and some queries do not translate easily into CEP
expressions, but apart from those queries, we have been quite
impressed with the engines in terms of usability, integration, user
support, and performance. Some of the companies we give advice to have
been happily surprised too.
Regards,
Pedro
On Sun, Jan 4, 2009 at 00:04, pureza_l <pureza_l@yahoo. com> wrote:
> Hi,
>
> I have the good old StockTrades stream with two fields: symbol and
> price. I'm trying to answer the following question "Were Company X
> stock actions priced above $70 during any moment of the last 5 minutes?".
>
> Unfortunately, using a simple time-based sliding window won't work. To
> see why, imagine there were only two price updates: the first, at
> 10:54 am stated that stocks were at $71. The second, 2 minutes later,
> notified that the stocks went down to $69. Now imagine that the above
> question was posed at 11:00 am (of the same day). We, humans, know
> that the answer is "yes" because the price was $71 between 10:54 and
> 10:56. But the first event is outside the 5 minutes window and will
> thus be ignored by the system.
>
> How would you solve this?
>
> Thanks,
>
> Luís Pureza
>
>
> ------------ --------- --------- ------
>
> Yahoo! Groups Links
>
>
>
>
------------ --------- --------- ------
Yahoo! Groups Links