http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/more-complex-patterns-for-CEP-was-CEP-two-transitions-to-the-same-state-tp9046p9093.html
Hi Frank,
thanks for sharing your analysis. It indeed pinpoints some of the current CEP library's shortcomings.
Let me address your points:
1. Lack of not operator
The functionality to express events which must not occur in a pattern is missing. We've currently a JIRA [1] which addresses exactly this. For the notFollowedBy operator, we should discard all patterns where we've seen a matching event for the not state. I think it could be implemented like a special terminal state where we prune the partial pattern.
For the notNext operator, we could think about keeping the event which has not matched the notNext state and return it as part of the fully matched pattern. Alternatively, we could simply forget about it once we've assured that it does not match.
2. Allow functions to access fields of previous events
This hasn't been implemented yet because it is a quite expensive operation. Before calling the filter function you always have to reconstruct the current partial pattern and then give it to the filter function. But I agree that the user should be allowed to use such a functionality (and then pay the price for it in terms of efficiency). Giving access to the partially matched fields via a Map would be a way to solve the problem on the API level.
I think that almost all functionality for this feature is already in place. We simply would have to check the filter condition whether they require access to previous events and then compute the partial pattern.
3. Support for recursive patterns
The underlying SharedBuffer implementation should allow recursive event patterns. Once we have support for branching CEP patterns [2] which allow to connect different states this should also be possible with some minor changes.
However, a more interesting way to specify recursive CEP patterns is to use regular expression syntax (Kleene star, bounded occurrences) to express recursive parts of a pattern. I think this makes specifying such a pattern easier and more intuitive for the user. We've also a JIRA issue to track the process there [3] and Ivan is already working on this.
If you want to get involved in Flink's CEP development, then feel free to take over any free JIRA issue or create one yourself :-)
Cheers,
Till