OK, Edson, I will try to check it out (I'm having problems accessing
subversion from work so will try from home).
Whilst trying to implement a workaround though I may have discovered
another problem (which might have been fixed too):-
rule "A"
when
MaterialEntry ( $m : material )
$a2 : Attribute( name ==
Constants.ATTRIBUTES_MATERIAL_LOCK_PRESSURE, $mlp : number, parent == $m
)
$a3 : Attribute( name ==
Constants.ATTRIBUTES_MATERIAL_LOCK_PRESSURE_MODIFIER, $lpm : number,
parent == $m )
then
System.out.println("Rule A"); //<-- Never fires
end
rule "B"
when
MaterialEntry ( $m : material )
$a2 : Attribute( name ==
Constants.ATTRIBUTES_MATERIAL_LOCK_PRESSURE, $mlp : number )
$a3 : Attribute( name ==
Constants.ATTRIBUTES_MATERIAL_LOCK_PRESSURE_MODIFIER, $lpm : number )
Then
if($a2.getParent() == $m && $a3.getParent() == $m) {
System.out.println("Rule B"); //<-- Fires
}
end
If the check for "parent" being equal across $m, $a2 and $a3 is in the
LHS the rule doesn't activate. However if check is in the RHS the rule
is OK.
Any thoughts or views (Edson)?
Thanks,
Mike
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: 13 March 2007 22:57
To: Rules Users List
Subject: Re: [rules-users] Shadow fact problem?
Mike,
Yes, that is a "shadow fact unwanted side-effect" (nice name for a
bug hm? :) ), but I remember fixing something similar as part of another
ticket I was working on. Is it possible for you to verify if the problem
is happening in trunk?
If it is still hapenning, let me know and I will fix it.
Thank you,
Edson
Anstis, Michael (M.) wrote:
Hi,
I am running 3.1-M1 and have (by way of example) two simple rules; A
and B as follows:-
*rule* "A"
*when*
$a1 : Attribute ( name == Constants.ATTRIBUTES_A, $pa :
number )
$a2 : Attribute ( name == Constants.ATTRIBUTES_B, $nc :
number )
$p : Process ( attributesList* contains* $a1,
attributesList* contains* $a2 )
*then*
* double* txy = doSomeMaths($pa, $nc, $p);
Attribute a =* new* Attribute(Constants.ATTRIBUTES_C,
txy);
$p.addAttribute(a);
* assertLogical*(a);
* modify*($p);
System.out.println("Rule 'A' fired");
*end*
*rule* "B"
*when*
$a1 : Attribute ( name == Constants.ATTRIBUTES_C, $txy :
number)
$p : Process( attributesList* contains* $a1 )
// <-- Line causing rule not to activate
*then*
* double* m = doSomeMoreMaths($txy, $p);
System.out.println("Rule 'B' fired");
*end*
Process exposes an ArrayList of Attribute objects (each having a
name\value pair).
When the content of the ArrayList held by Process is added to (Rule
'A') the next rule (Rule 'B') is not being activated.
Can anybody provide any insight into how best a workaround can be
engineered?
With kind regards,
Mike
-----------------------------------------------------------------------
-
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users