Siddhi Pattern Matching - sacjaya/siddhi-3 GitHub Wiki
Pattern matching should support the following scenarios
- Queries of the type
from a1 = A -> B select a1.price
- Logical and,or should be supported
-
A -> B or C -> D
- Will match A, B, D
- Will match A, C, D
- Will it match A, B, C, D ?? No, it will only match A, B, D for events received in the order A, B, C, D
-
A -> B and C -> D
- Will match A,B,C,D
- Will match A,C,B,D
-
- Counting patterns
-
A -> B <3:5> -> C
- Will match A, B, B, B, C
- Will match A, B^5, C
- Will match A, B^6, C
- Does using upper limit make sense in counting patterns?
A -> B <3:> -> C
A -> B <:5> -> C
-
- Logical not
-
A -> not B and C -> D
- Will match A, C, D
-
A -> not B within 5 min -> C
- Will match A, {no B events for 5 min, and then} C
-
- Support for 'within'
-
Within can be used inside any pattern matching construct. e.g.
A -> (B -> C) within 5 min -> D
- Will match A, B, C, {B,C within 5 min}, D
-
- Support for 'prev' keyword within a filter of pattern
-
a1 = A[(not (a1[prev] is null) and a1[prev].price > price)]<2:10> ???
- The first A event will be matched anyway. From second A event onwards, it will match only if the previous A event price is greater. With this we can detect monotonically increasing/decreasing patterns.
-
- Support for aggregate functions on counting patterns. e.g.
- For the pattern
a1 = A [prev.price > price]<2:10>
, the selectoravg(a1.price)
would give the average price of all the events matched inside the counting pattern for that single total match.
- For the pattern
Following will not be supported
- Patterns of type
every (A -> B -> every(C) -> D) -> E
(NOT SUPPORTED)