With Drools 3.0 on the horizon, I'll limit my answers to 2.5, which I
understand slightly more.

On 3/30/06, tramesh <[EMAIL PROTECTED]> wrote:
>
> Hi Every Body,
>
> I am new to drools, but able to manage in executing/fire the drools (using
> DRL
> file). I have couple of questions on execution of drools.
>
> 1. How to achive if-else condtion in drools.
> Example : A rule contains conditions and consequence, if condition fails
> then
> there won't be any consequence. Is there any way to exeute else condition
> (how
> to achieve else condtion in drools).


You'd typically handle this with two rules.  So if you wanted this:
    if( car.getValue() < 20000 ) car.tag( "cheap" ) else car.tag(
"expensive" );

You'd do two rules - one that tags the car as cheap if the value is < 20K,
and another that tags the car as expensive if the value is >= 20k.

I've heard some chatter about support for an 'else' syntax, but I'm not sure
if that's planned.

2. Nested Rules :
> Example : Based on successful execution of one rule is there any way/means
> to
> execute another rule at a time.
>

The normal way to do this is for the first rule to make changes to working
memory that are prerequisites for the second rule.

So, in the example above, you could write a rule that looks for cars that
have been tagged as 'cheap' and takes other actions.

  - Geoffrey
--
Geoffrey Wiseman

Reply via email to