1

In CEP engine I am trying to do a pattern like

from s1 = SensorStream[level == 'A'] **NOT** -> s2 = SensorStream[level == 'B'] within 10 sec  
select s1.id as id1, s2.id as id2 insert into AlertStream 

I found this link , but what I have is not a range...

Any idea?

Thanks!

Community
  • 1
  • 1
Marta
  • 21
  • 3

2 Answers2

0

Marta,

Can't you use below approach. Is that what you want to achieve ?

from s1 = SensorStream[level != 'A'] -> s2 = SensorStream[level == 'B'] within 10 sec
select s1.id as id1, s2.id as id2 insert into AlertStream

Mohanadarshan
  • 830
  • 5
  • 5
  • No @Mohanadarshan, what I am trying to do is to detect absences. In the example I want to be able to detect that s1 = SensorStream[level == 'A'] occurred and SensorStream[level == 'B'] did not occurred, within 10 sec. Thank you for your help. – Marta Mar 10 '15 at 13:12
0

This feature has been added to Siddhi 4.0 (currently under development) with the PR#483. According to this implementation, your requirement can be achieved using the following query:

from s1 = SensorStream[level == 'A'] -> not SensorStream[level == 'B'] for 10 sec  
select s1.id as id
insert into AlertStream;

Note that the not pattern cannot have a stream reference s2 because you cannt select the id of an event that is not arrived.

If you want to try Siddhi early access, follow the instructions given in this tutorial: Siddhi 4.0.0 Early Access

For more samples, have a look at the test cases.

Gobinath
  • 904
  • 1
  • 15
  • 23