With both Drools v5.5.0.Final and v5.6.0.Final I observe a different behavior than in both v6.0.0.Final and v6.0.1.Final. in certain rules with negation wrapped around nested constraints.
I have tried to make the simplest rules to demonstrate the situation. With a kb consisting of the following rules, which I have comments on that describe what I've found with the situation: ``` // Enabling this rule, makes "negation_over_nested" and // "negation_distributed_partially_sharing" fire; // without it they do not. // // I think this is due to some shared structure // in the underlying subnetwork (I believe this is referred to as a "segment"). // Perhaps it makes them "linked" in when otherwise they are being missed. /** *This is commented out, uncommenting causes different firing of other rules* rule shared_conjunct when (not (String() and Integer())) then System.out.println("shared_conjunct"); end */ // Won't fire with no wm facts UNLESS // it shares (I think) a node/subnetwork/segment with constraints // in a rule like "rule shared_conjunct" that DOES fire rule negation_over_nested when not ( (String() and Integer()) or (String() and Integer())) then System.out.println("negation_over_nested"); end // Won't fire with no wm facts rule negation_distributed_partially_no_sharing when (not (String() and Long())) and (not (String() and Long())) then System.out.println("negation_distributed_partially_no_sharing"); end // Same situation as "negation_over_nested" rule negation_distributed_partially_sharing when (not (String() and Integer())) and (not (String() and Integer())) then System.out.println("negation_distributed_partially_sharing"); end // DOES fire with no wm inserts. // DOES NOT need "shared_conjunct" to work rule negation_distributed_fully when ((not String()) or (not Integer())) and ((not String()) or (not Integer())) then System.out.println("negation_distributed_fully"); end ``` --- This is the only 2 rules in the kb. Running a session, with no facts inserted and then firing all rules. --- Drools v5.x output with "shared_conjuct" rule uncommented: ``` negation_distributed_fully negation_distributed_fully negation_distributed_fully negation_distributed_fully negation_distributed_partially_no_sharing negation_distributed_partially_sharing negation_over_nested shared_conjunct fired: 8 time elapsed: 0.0 done ``` with "shared_conjuct" rule commented out: ``` negation_distributed_fully negation_distributed_fully negation_distributed_fully negation_distributed_fully negation_distributed_partially_no_sharing negation_distributed_partially_sharing negation_over_nested fired: 7 time elapsed: 0.0010 done ``` --- Drools v6.x output: with "shared_conjuct" rule uncommented: ``` shared_conjunct negation_over_nested negation_distributed_partially_sharing negation_distributed_fully negation_distributed_fully negation_distributed_fully negation_distributed_fully fired: 7 time elapsed: 0.0 done ``` with "shared_conjuct" rule commented out: ``` negation_distributed_fully negation_distributed_fully negation_distributed_fully negation_distributed_fully fired: 4 time elapsed: 0.0 done ``` I do note in the v6.x output, "negation_distributed_partially_no_sharing" never fires, since it is specifically not sharing any negated conjunt with the other rules. This seems to correlate with whether or not these rules fire. Also, I realize my terminology is slightly off. I think this is an issue with rules having shared "segments", where one of these segments that is shared is the negation subnetwork introduced in "shared_conjunct". I also note that "negation_distributed_fully" always fires, independent of any potential "segment" sharing. As I mentioned in a comment on "shared_conjuct", I'm thinking this relates to the newer PHREAK algorithm vs the original ReteOO. Is this expected? Is there something incorrect about the structure of the negation rules? Perhaps I have stumbled upon a defect? I have not had time to do any sort of deeper debugging into the issue, if I find out more info, I'll post it up here. p.s. I know the types are not meaningful, this is just an example to show the difference. I hope it accomplishes this goal. -- View this message in context: http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-change-from-Drools-5-x-to-6-x-tp4028390.html Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users