confused again.... - why it selects all possible combinations? (D ROOLS 3.1M)
by Olenin, Vladimir (MOH)
Hi,
I finally got around to get my hands dirty. And I run into some problem. The
results I'm getting are not the ones I expected to get :-).
I have a rule:
rule "FC.93"
when
r1: Record( psc == "101", fundType == "1", $pa1: pa ==
"7111010", sa matches "F1202[0-9]" )
r2: Record( psc == "101", fundType == "1", pa == $pa1, sa
matches "F1202[0-9]" )
then
System.out.println( "rule FC.93 has been activated" );
System.out.println( "r1: " + r1 );
System.out.println( "r2: " + r2 );
System.out.println();
end
and the following set of facts:
1: new Record("101", "0942", "1", "7111010", "F12020")
2: new Record("101", "0942", "1", "7111010", "F12022")
3: new Record("101", "0942", "1", "7111010", "F12024")
4: new Record("101", "0942", "1", "7111020", "F12020")
5: new Record("101", "0942", "1", "7111020", "F12022")
With the rule above I expected to get only tuples
1,2 1,3 2,3
Or the printout:
rule FC.93 has been activated
r1: pa = 7111010, sa = F12020
r2: pa = 7111010, sa = F12022
rule FC.93 has been activated
r1: pa = 7111010, sa = F12020
r2: pa = 7111010, sa = F12024
rule FC.93 has been activated
r1: pa = 7111010, sa = F12022
r2: pa = 7111010, sa = F12024
Ie, get only 3 activations of the rule.
For some reason I'm getting all possible combinations (or is it
permutations?...):
rule FC.93 has been activated
r1: pa = 7111010, sa = F12024
r2: pa = 7111010, sa = F12024
rule FC.93 has been activated
r1: pa = 7111010, sa = F12022
r2: pa = 7111010, sa = F12024
rule FC.93 has been activated
r1: pa = 7111010, sa = F12024
r2: pa = 7111010, sa = F12022
rule FC.93 has been activated
r1: pa = 7111010, sa = F12020
r2: pa = 7111010, sa = F12024
rule FC.93 has been activated
r1: pa = 7111010, sa = F12024
r2: pa = 7111010, sa = F12020
rule FC.93 has been activated
r1: pa = 7111010, sa = F12022
r2: pa = 7111010, sa = F12022
rule FC.93 has been activated
r1: pa = 7111010, sa = F12020
r2: pa = 7111010, sa = F12022
rule FC.93 has been activated
r1: pa = 7111010, sa = F12022
r2: pa = 7111010, sa = F12020
rule FC.93 has been activated
r1: pa = 7111010, sa = F12020
r2: pa = 7111010, sa = F12020
I recall Edson mentioned that DROOLS would not select the same two facts in
the tuple, but that what seems to be happening.... I think I must be doing
smth wrong. How the rule should be modified to achieve the result I expect?
Also, for some reason regex "F1202\\d" doesn't return any matches as well,
while, supposedly the same pattern "F1202[0-9]" does...
Thanks. Any hints are very appreciated!
Vlad
PS: I'm using DROOLS 3.1M on JDK 1.5.0_11 under the 3.1M Eclipse plugin.