I have a sequence of events which goes like this:
- Event A starts the sequence
- Multiple Events B happen
- Event C stops the sequence
I did that with a pattern [every A -> (B until C)], it seems to be correct (what do you think?). But I'm struggling to retrieve and aggregate infos from the B events that arose in the sequence. I'd like to simply have a count and maybe some avgs but nothing seems to work (example1 returns 1, example 2 returns 0 and example 3 return null, even if my B events are present).
insert into CreateMeasurement
select
C.source as source,
"carDrivingAnalyse" as type,
C.time as time,
{
"example1", count(*),
"example2", count(B),
"example3", B.countOf()
} as fragments
from pattern [
every A = EventCreated(
type = "Ignition",
getString(A, "Ignition.status") = "ON")
-> (
B = EventCreated(
type = "DrivingEvent",
source = A.source,
getString(B, "DrivingEvent.prop1") = getString(A, "Ignition.prop1"),
getNumber(B, "DrivingEvent.prop2") = getNumber(A, "Ignition.prop2"))
until C = EventCreated(
type = "Ignition",
getString(C, "Ignition.status") = "OFF",
source = A.source,
getString(C, "Ignition.prop1") = getString(A, "Ignition.prop1"),
getNumber(C, "Ignition.prop2") = getNumber(A, "Ignition.prop2"))
)
]