In some cases, when a NOT node is the root of a subnetwork, the phreak segment having that node as root is not initialized as expected when the initial fact is inserted. That can prevent a rule to fire even if it should as demonstrated by the following test case. @Test public void testNestedNots() { String str = "package org.test; " + "rule negation_distributed_partially_no_sharing " + "when " + " (not String()) " + " and " + " (not (Double() and Integer())) " + "then " + " System.out.println(\"firing\"); " + "end"; KnowledgeBase kbase = loadKnowledgeBaseFromString(str); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); int n = ksession.fireAllRules(); assertEquals(1, n); } Note that if you invert the 2 NOTs putting the one with 2 conditions before the other the test succeeds.
Fixed by https://github.com/droolsjbpm/drools/commit/0faf0e32d
This was cherry-picked into the 6.0.1.ER2 tag: https://github.com/jboss-integration/drools/commit/db551f6
Mario Fusco <mario.fusco> updated the status of jira DROOLS-444 to Resolved
Verified that the fix is present in BRMS 6.0.1 ER2 and the relevant tests pass.