I have reduced my problem to a minimal example:
- I use a pseudo clock and stream mode processing
- The events are inserted using a succession of advanceTime(), insert(),
fireAllRules()
- I have three events named: Thief, SwitchOn and SwitchOff
- I have three rules similar to:
rule "detect theft"
when
$t : Thief() from entry-point "thieves" // Line A
$lastSwitchOn : SwitchOn(this before $t) from entry-point "lightsControl"
// Line B
SwitchOff(this before $t, this after $lastSwitchOn) from entry-point
"lightsControl" // Line C
not( SwitchOff(this before $t, this after $lastSwitchOn) from entry-point
"lightsControl" ) // Line D
then
System.out.println($t);
end
The first rule is composed of lines A, B, the second of lines A, B and
C and the third of lines A, B and D. Please note that line D is the negation
of line C.
- Inserting the same sequence of events, only the first rule triggers.
This seems strange to me, because:
1) if the first rule triggers, then "Line A" and "Line B" = true
2) if the second rule doesn't, then "Line A" and "Line B" and
"Line C" =
false.
3) from 1) and 2), it follows "Line C" = false
4) from 1) and 3), it follows that "Line A" and "Line B" and not
"Line C"
= true, so the third rule should be triggered, but it is not. Why?
--
MM
--
View this message in context:
http://drools.46999.n3.nabble.com/Rule-evaluation-logic-tp3620772p3620772...
Sent from the Drools: User forum mailing list archive at
Nabble.com.