rules icon indicating copy to clipboard operation
rules copied to clipboard

How to ensure event data is passed to the right context?

Open nikzasel opened this issue 4 years ago • 0 comments

For example i have facts like this (they are stated only once per program run, around 40k facts): {id: 1, attribute_1_min: 32, attribute_1_max: 64, attribute_2: True} {id: 2, attribute_1_min: 64, attribute_1_max: 128, attribute_2: False} {id: 3, attribute_1_min: 128, attribute_1_max: 256, attribute_2: True}

Then i have events like this {id: 1, attribute_1_value: 48} {id: 2, attribute_1_value: 32} {id: 3, attribute_1_value: 512}

So attributes name presented in events and facts are different

I want to make rules something like: when_all m.id == s.id (event id must be equal to fact id) m.attribute_1_value > s.attribute_1_min (minimum value for fact with id) m.attribute_1_value < s.attribute_1_max (these two rules, to ensure, that event attribute value is in some range) s.attribute_2 == True (context attribute is true) So m must be info only from my events, and s must be data only from my facts.

My questions are: How to ensure that events data go in m, and facts data only go to the s variable? Are my rules correct? Because I get "Message not handled" exception when state_facts is used. But If I use rule like +s.id, then program just runs indefinitely.

Thank you.

nikzasel avatar Oct 20 '20 11:10 nikzasel