Good suggestion Srinath,
Only concern is that these templates may get confused with the function
expressions.
We may need to have a better separation on that.

One simple option is to use template.xxx(...)

Another possibility is using another level of domain specific abstraction
to the language & CEP
E.g

if stock("WSO2") price increasing then send email to("[email protected]")
if list("[email protected]") get more_then 20 mail per 1 hour then ...

Then allow implementers to map the above to siddhi + CEP input/output
adapters
We may need to come up with a extensible architecture so that we can
achieve this

These domain specific customisations may involve some coding but since its
a one time effort
it will be still very useful for a non technical users to adopt CEP.

Regards
Suho




On Tue, Jun 3, 2014 at 10:10 AM, Srinath Perera <[email protected]> wrote:

> Hi Suho, All,
>
> We were chatting at DEBS about possibility of supporting "templates" in
> Siddhi, so we can build more descriptive functions into Siddhi without
> having to extend the language. e.g. have a increasing( ..) function instead
> of having to write complex query. (e.g. just like ESB templates)
>
> I have been thinking about this and have some thoughts about how to do
> this. Please comment.
>
> e.g 1. consider "Increasing"
>
>
> from e1=Speed->e2=speed[v > e1.v] insert into ...
>
> template
> =======
> define template Increasing($S1, $val1){
>      e1=$S1->e2=$S2[v$val> e1.v];
>      return e1,e2;
> }
>
> then query will look like
>
> from increasing("Speed", "v") insert into ..
>
> e.g. 2
>
> define template vShape($S1, $val1){
>      $S1 as e1, $S1[v$val> e1.v]+ as e2,$S1[v$val< e2[last].v]+ as e3;
>      return e1,e2, e3;
> }
>
> then final query looks like
>
> from vShape("Speed", "v") insert into ..
>
> Note this is just a template, not a function. We expand the query like a
> macro.
>
> Execution is that we expand queries using macros before execution. I think
> macro can have chain of streams to make its functions readable.
>
> We have to think about different scenarios, but in general I think this
> should work.
>
> Thanks
> Srinath
>
> --
> ============================
> Srinath Perera, Ph.D.
>   Director, Research, WSO2 Inc.
>   Visiting Faculty, University of Moratuwa
>   Member, Apache Software Foundation
>   Research Scientist, Lanka Software Foundation
>   Blog: http://srinathsview.blogspot.com/
>   Photos: http://www.flickr.com/photos/hemapani/
>    Phone: 0772360902
>



-- 

*S. Suhothayan*
Technical Lead & 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>*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to