In your scenario, I believe the best (better) approach would be to use a control fact (first in your RHS). Your context can become a Fact itself:-

rule "one"
when
    Foo( value == "bar" )
    ...other patterns
then
    ...do your thang
end
   
rule "two"
when
    Foo( value == "bar" )
    ...other patterns
then
    ...do your other thang
end

On 19 July 2011 16:25, magendo <robert.heisenberg@yahoo.com> wrote:

magendo wrote:
>
> 1. Using a contextObject which has foo and is checked in the first rule of
> each rulepackage. This first rule and the remaining rules in the
> rulepackage have the same agenda group. So if the first rule doesnt fit,
> the other rules wont be executed, either (does this really work? ;)).
>

Well, that doesnt even seem to work. Here are 2 examples I tried out:

rule "one"
auto-focus
agenda-group "foobar"
when
 foo != bar
then
 drools.getWorkingMemory().clearAgendaGroup("foobar");
end

rule "all the other rules"
agend-group "foobar"
when some conditions
then some consequences
end

This way the "some conditions" part is still executed in the lhs of "all the
other rules", altough I cleared the agendagroup "foobar" (I guess that
happens because the rhs is only executed after fireallrules()).

There must be a way to affect the lhs of the other rules before
fireallrules() is executed?!

Btw. my LHS is quite expensive thats why I dont wont to execute it 100 times
when only the right one is needed.




--
View this message in context: http://drools.46999.n3.nabble.com/Drools4-Filter-executed-rules-by-drl-file-tp3182568p3182842.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