Edson,
I tried what you said, but it is not the same... cant get the
expected result.
With agenda-group the can control de flow, but outside the rules
(auto-focus didnt work well),
and before that I prefer to use rule-flow-group (and use the GUI).
What Im trying to get is a set of rules that dont depend on flows or
sequences to work together, because
this set of rules can be large and I dont want the business user have
to check all rules to know how to write
the next rule... they must be writen in an independent way, but work
together...
lock-on-active didnt work either to get that result, because when I
use it stops activations, so the update(fact) actually
has no effect on other rules... I need to put wm.setFocus
("group1");wm.setFocus("group2");..etc. at the java code...
I dont want to do that...
Maybe you can help me...
an example will be this...(pseudo code)
rule "base vacation days"
when
e: Employee( yearsInCompany > 1)
then
e.setVacationDays(10);
update(e);
end
rule "seniors extra vacation days"
when
e: Employee( yearsInCompany > 4, vd: vacationDays)
then
e.setVacationDays(vd+2);
update(e);
end
rule "old-employee extra vacation days"
when
e: Employee( yearsInCompany > 10, vd: vacationDays)
then
e.setVacationDays(vd+4);
update(e);
end
....and so on....
So I need the business ppl write this rules without knowing the rest
of the rules... I think this is
the idea of having a rule-system...
Thanks.
On 03-07-2007, at 16:40, Edson Tirelli wrote:
Felipe,
Thanks. I'm working on it.
BTW, I forgot to mention, what you are doing to control rules is
a not a good way to do it. You should try agenda-group+lock-on-
active rule attributes instead.
Look at the conway's game of life as an example, and maybe help
us document the feature... :)
[]s
Edson
2007/7/3, Felipe Piccolini < felipe.piccolini(a)bluesoft.cl>:
Edson,
Thanks for the reply... it is nasty...
Jira created...
http://jira.jboss.com/jira/browse/JBRULES-966
Thanks
PD: duplicated email because I forgot to cut the huge-company-
signature... :)
On 03-07-2007, at 14:18, Edson Tirelli wrote:
>
> Felipe,
>
> Ok, this is a nasty damn bug. :(
>
> I'm working on a solution for it right now. May I ask you
> please to open a JIRA for it and attach your code bellow?
>
> Thank you,
> Edson
>
> 2007/7/3, Felipe Piccolini < felipe.piccolini(a)bluesoft.cl>:
> I know I already asked this in a previous email, but no answer and
> diferent subject... so I'll ask again
>
> I have an issue using update in 2 rules that update the same
> object... a loop is created even when I try to
> avoid the loop adding an extra condition to each rule... Im
> inserting an ArrayList as a fact too, so I can check
> the extra condition...
>
> Can anyone tell me how to fix this?
>
> Consider this:
> //-------RULES-----------------------------
> package cl.bluesoft.test
>
> #list any import classes here.
> import java.util.List
> import java.util.ArrayList
>
> import cl.bluesoft.test.rules.Fact
>
> #declare any global variables here
>
> rule "test update A"
> salience 699
> no-loop
> when
> $f : Fact($n: number > 0)
> $list: ArrayList( this excludes "key1" )
> then
> System.out.println( "A-fact number1:"+$f.getNumber()+ " list
> 1:"+$list);
> $list.add( "key1" );
> $f.setNumber($n + 1);
> update ($f);
> update ($list);
> System.out.println("A-fact number2:" +$f.getNumber()+" list
> 2:" +$list);
> end
>
>
> rule "test update B"
> salience 699
> no-loop
> when
> $f : Fact($n: number > 1)
> $list: ArrayList( this excludes "key2" )
> then
> System.out.println( "B-fact number1:" +$f.getNumber()+" list
> 1:" +$list);
> $list.add("key2" );
> $f.setNumber($n + 1);
> update ($f);
> update ($list);
> System.out.println("B-fact number2:" +$f.getNumber()+ " list
> 2:"+$list);
> end
>
> //-------FACT-----------------------------
> public class Fact implements Serializable {
> private static final long serialVersionUID = 331627137981862975L;
>
> private int number;
>
> public Fact(int number){
> this.number = number;
> }
>
> public Fact(){
> this(0);
> }
>
> /**
> * @return the number
> */
> public int getNumber() {
> return number;
> }
>
> /**
> * @param number the number to set
> */
> public void setNumber(int number) {
> this.number = number;
> }
>
> }
>
> //------TEST---------
> public class TestUpdateFact implements Serializable {
>
> private static final long serialVersionUID = -574789596641083743L;
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
> Package pkg = builder.getPackage();
> ....
> WorkingMemory session = ruleBase.getStatefulSession();
> ...etc etc...
>
> List list = new ArrayList();
>
> Fact fact1 = new Fact(1);
>
> session.fireAllRules();
>
> ....etc, etc...
>
> }
>
> }
>
> //--------OUTPUT------------
> A-fact number1:1 list 1:[]
> A-fact number2:2 list 2:[key1]
> B-fact number1:2 list 1:[key1]
> B-fact number2:3 list 2:[key1, key2]
> A-fact number1:3 list 1:[key1, key2]
> A-fact number2:4 list 2:[key1, key2, key1]
> B-fact number1:4 list 1:[key1, key2, key1]
> B-fact number2:5 list 2:[key1, key2, key1, key2]
> A-fact number1:5 list 1:[key1, key2, key1, key2]
> A-fact number2:6 list 2:[key1, key2, key1, key2, key1]
> B-fact number1:6 list 1:[key1, key2, key1, key2, key1]
> B-fact number2:7 list 2:[key1, key2, key1, key2, key1, key2]
> A-fact number1:7 list 1:[key1, key2, key1, key2, key1, key2]
> A-fact number2:8 list 2:[key1, key2, key1, key2, key1, key2, key1]
> B-fact number1:8 list 1:[key1, key2, key1, key2, key1, key2, key1]
>
> .... for ever.....
>
> So I have a loop... only when I use update and both rules...
> condition about the
> list not containing "key1" and "key2" seems not properly
> chequed... I dont know...
>
> Can somebody help me? Am I missing something here?
>
> Thanks.
>
>
> Felipe Piccolini M.
> felipe.piccolini(a)bluesoft.cl
>
>
>
>
>
> _______________________________________________
> 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 3529-6000
> Mobile: +55 11 9287-5646
> 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
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
Atentamente,
______________________
Felipe Piccolini Marfull
Jefe de Proyectos
Agustina 1141 Piso 8-B
Santiago
Fono +(56 2) 68830837
E-mail felipe.piccolini(a)bluesoft.cl