Hi Anwar,

yes, once we have published the introductory blog post about the CEP
library, we will also publish a more in-depth description of the approach
we have implemented. To spoil it a little bit: We have mainly followed the
paper “Efficient Pattern Matching over Event Streams” for the
implementation.

Concerning your questions:

1.) followedBy means that there can be an arbitrary sequence of events
between two matching events, as long as they occur in the specified time
interval. Thus, TemperatureEvent(40) will match together with
TemperaturEvent(50), TemperaturEvent(70), TemperaturEvent(65) and
TemperaturEvent(60).

2.) The same applies here for the next operator. It says that the second
matching event has to follow directly after the previous matched event.
However, a matching event can be part of multiple matching sequences. Thus,
you will get TemperaturEvent(70), TemperaturEvent(65) and
TemperaturEvent(65), TemperaturEvent(60) as two distinct matching sequences.

To make a long story short, there is currently no option to change the
sequence semantics so that events are only part of one matching sequence.
At the moment, events can participate in multiple matching sequences. I
hope that answers your question Anwar.

Cheers,
Till
​

On Mon, Apr 4, 2016 at 11:18 AM, Anwar Rizal <anriza...@gmail.com> wrote:

> Hi All,
>
>
> I saw Till's blog preparation. It will be a very helpful blog. I hope that
> some other blogs that explain how it works will come soon :-)
>
> I have a question on followedBy pattern matching semantic.
>
>
> From the documentation
> https://ci.apache.org/projects/flink/flink-docs-master/apis/streaming/libs/cep.html
> ,
>
> <citaton>
>
> Non-strict contiguity means that other events are allowed to occur
> in-between two matching events. A non-strict contiguity pattern state can
> be created via the followedBy method.
>
> Pattern<Event, ?> nonStrictNext = start.followedBy("middle");
>
>
> </citation>
>
> I try to use Till's examples in the blog, to understand the semantic of
> followedBy
>
> --
> First question.
> Say, I have sequence of temperatures in a time window that corresponds to
> the within clause (say in 20 minutes).
>
> TemperatureEvent(40) , OtherEvent(...), TemperatureEvent(30),
> TemperatureEvent(50), OtherEvent(...), TemperatureEvent(70),
> TemperatureEvent(65), TemperatureEvent(60)
>
> say I want to match two TemperatureEvents whose temperatures > 35.
>
> What will be the matches in this case ?
>
>
>    -  Will TemperatureEvent(40) , TemperatureEvent(50), match ? (because
>    we have TemperatureEvent(30) at time 3 that does not match.
>    - Will TemperatureEvent(40) , TemperatureEvent(70) match ? (because
>    the pair matches also the specification of pattern , the difference is we
>    have TemperatureEvent(50) which happened before TempertureEvent(70) ).
>    Similar question for TemperatureEvent(40) - TemperatureEvent(65) and
>    TemperatureEvent(50)-TemperatureEvent(65) etc. pairs.
>
>
>
> --
> Second question.
> For next (and also for followedBy) , I have also questions regarding
> example above:
> Will TemperatureEvent(70), TemperatureEvent(65) and TemperatureEvent(65),
> TemperatureEvent(60) be returned , or the second pair is no longer returned
> because TemperatureEvent(65) has been used in the first pair ?
>
>
>
> Is there a way to define the different sequence semantics  for the two
> questions I asked above ?
>
>
> Thanks,
> Anwar.
>
>
>
>
>
>
>
>

Reply via email to