"when-then" is just another way of saying "condition-consequence".  I
think the "when-then" stuff is just pseudocode.  

The point is to implement if-then-else logic within a rules engine you
simply need two rules:

Rule 1:
condition 
        A 
consequence 
        doSomething()

Rule 2:
condition
         ~A      // (not 'a')
consequence 
        doSomethingElse()


Furthermore to implement a loop you only need a list and a single rule:

Looping rule:

condition 
        myList.hasNext()
consequence
        anItem = myList.next()
        anItem.processTheItem() 

In short, there are techniques for achieving the various logical
constructs within declarative languages, you just need to know how.

- Dave


-----Original Message-----
From: Dmitry Goldenberg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 13, 2006 8:37 AM
To: [email protected]
Subject: RE: [drools-user] Using While in drools

Can someone provide a summary of the new syntax?  A BNF would be great.
I guess if it's just WHEN/THEN there's no need.  I don't see any mention
of this on this on the http://drools.codehaus.org/ pages...

________________________________

From: Peter Van Weert [mailto:[EMAIL PROTECTED]
Sent: Thu 4/13/2006 11:01 AM
To: [email protected]
Subject: Re: [drools-user] Using While in drools



It is the Drools 3 lingo:

        http://labs.jboss.com/jbossrules

It is just the new and improved way of writing if-then rules, but still
without the else!

Dmitry Goldenberg wrote:
> What is this lingo that you guys are using, the when/then etc.?  Is 
> this supported by Drools?  Everyone just pushed back on me saying 
> they're not going to support the ELSE construct and here you are 
> talking about a WHEN?  I'm confused.  Please explain to a novice :)
> 
> Thank you.
>
> ________________________________
>
> From: news on behalf of Russ Egan
> Sent: Thu 4/13/2006 10:42 AM
> To: [email protected]
> Subject: Re: [drools-user] Using While in drools
>
>
>
> I'm a neophyte at this as well, but I think I'd assert all the 
> elements of the list into WM.
>
> Then the rule would just be:
>
> rule
>   when
>     Element()
>   then
>     doSomething();
> end
>
> Or, if you need to only trigger something when the item is added to 
> the list, assert the list as a fact:
>
> rule
>   when
>     $e : Element()
>     ActionableElements(elements contains $e)
>   then
>     doSomething();
> end
>
>
> Hello eliane,
>
>
>>Hello,
>>i'm trying to do the following with drools Suppose we have an 
>>arrayList in our drl File and we want to compare each element in the 
>>list to a certain value if they 're equal then do something for each 
>>(element in List) if (element == value)
>>doSomething()
>>else
>>next();
>>how can i utilize the while logic with drools?
>>
>>--
>>
>>Eliane
>>
>
>
>
>
>
>
>

Reply via email to