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

Reply via email to