forall is evaluated as true when there is no fact to match the first pattern in BRMS
Issue
- The combination of the following rule and facts hit the rule. Is it expected?
rule "All guys older than 30 earn more than 1900"
when
forall($p : Person( age > 30)
Person( this == $p, salary > 1900 )
)
then
System.out.println( "fire!" );
end
// no person older than 30
Person john = new Person("john", 24, 2000);
Person paul = new Person("paul", 22, 1800);
Person george = new Person("bob", 21, 1600);
kSession.insert(john);
kSession.insert(paul);
kSession.insert(bob);
kSession.fireAllRules();
Environment
- Red Hat JBoss BRMS
- 6.4.4
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.