Thanks for the GSoC idea, I hope this will be a good way to improve the
Siddhi language and make it more powerfull.
If time permits we can also add other use-cases of patterns & sequences and
improve it further.

Since you are still not a commuter I hope these contributions will help you
be a committer to Siddhi as well :)
I'll make this as a formal idea, do work on a proposal as well.

Regards
Suho


On Wed, Mar 15, 2017 at 6:09 PM, Gobinath <slgobin...@gmail.com> wrote:

> Hi team,
>
> This is Gobinath a former software engineer at WSO2 currently doing
> masters at Western University. This time I plan to do GSoC with WSO2 and
> this is the basic idea of what I have discussed with Suho.
> Based on Suho's suggestion, I come up with a proposal to implement
> detecting non-occurring events using Siddhi patterns. The current Siddhi
> patterns allow identifying the patterns that present.
>
> See an example:
> from every e1=Stream1[price>20] -> e2=Stream2[price>e1.price] within 1 sec
> select e1.symbol as symbol1, e2.symbol as symbol2
> insert into OutputStream;
>
> Detecting the absence of a pattern is not natively supported by Siddhi
> patterns for the moment. In other words, identifying event_a not followed
> by event_b within 2 minutes is not possible using the current patterns
> implementation (Note that a time frame is required otherwise we have to
> wait for infinite time to say event_b has not arrived). The current
> workaround [1] to detect non-delivered items is shown below:
>
> from arrivals_stream#window.time(2 minutes)
> select *
> insert expired events into overdue_deliveries_stream;
>
> from every arrivalEvent = arrivals_stream ->
> deliveryEvent = deliveries_stream[arrivalEvent.trackingId == trackingId]
>     or overdue_delivery = overdue_deliveries_stream[arrivalEvent.trackingId
> == trackingId]
> select arrivalEvent.trackingId as trackingId, arrivalEvent.customerName as
> customerName, arrivalEvent.telephoneNo as telephoneNo,
> deliveryEvent.trackingId as deliveryId
> insert into filter_stream;
>
> from filter_stream [ (deliveryId is null)]
> select trackingId, customerName, telephoneNo
> insert into alert_stream;
>
> This solution requires a time window and it is inefficient if we are
> interested only on one occurrence of such a pattern (In other words same
> query without every keyword). Further, the query is more complex and not
> user-friendly.
>
> If we provide patterns to detect absence of patterns, the above query can
> be rewritten as below:
>
> from every arrivalEvent = arrivals_stream ->  (not
> deliveries_stream[arrivalEvent.trackingId == trackingId] within 2 min )
> select arrivalEvent.trackingId as trackingId, arrivalEvent.customerName as
> customerName, arrivalEvent.telephoneNo as telephoneNo
> insert into alert_stream;
>
> As you can see, we can use the existing language components like not &
> within. This can be achieved by extending the existing
> StreamPreStateProcessors and StreamPostStateProcessors with an internal
> timer so that they can expire their internal list of events based on the
> time limit. It is somewhat similar to time windows but the processor can
> turn off the timer and ignore the events if it is a one time pattern
> detection.
>
> I hope it gives the basic idea and I am waiting for your suggestions and
> feedback.
>
> [1] https://docs.wso2.com/display/CEP400/Sample+0111+-+D
> etecting+non-occurrences+with+Patterns
>
>
> Thanks & Regards,
> Gobinath
> --
> *Gobinath** Loganathan*
> Graduate Student,
> Electrical and Computer Engineering,
> Western University.
> Email  : slgobin...@gmail.com
> Mobile : (+1) 416-895-0721
> Blog    : javahelps.com <http://www.javahelps.com/>
>
>



-- 

*S. Suhothayan*
Associate Director / Architect & Team Lead of WSO2 Complex Event Processor
*WSO2 Inc. *http://wso2.com
* <http://wso2.com/>*
lean . enterprise . middleware


*cell: (+94) 779 756 757 | blog: http://suhothayan.blogspot.com/
<http://suhothayan.blogspot.com/>twitter: http://twitter.com/suhothayan
<http://twitter.com/suhothayan> | linked-in:
http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to