[rules-users] probleam in breaking conditions into multiple lines in DSL

kingston raja_kingston at yahoo.co.in
Thu Jun 21 09:17:45 EDT 2007



Hi ,

I was using  a drl file as pasted below.

package com.fruit;
import com.test.sample.*;


rule "FruitExample"
	
	when
		C: Customer();
		Fruit ( name == "apple" , costinrupees == 10) ; &&
		eval ( C.getNumOfCustomers() == 20 && (  C.getCityname() == "kanput"  ||
C.getCityname() == "Disput" )) 
	then 
		System.out.println("Rule Success");
		
end


Where do i need to break lines in dsl ? Do we reallly need some "english
text"  in dsl for each line i break ?[when]- works well for rules involviing
"OR" conditioins but it doesn't seem to work for "AND" conditions.

Can you please help me in getting out of this problem...? 




Edson Tirelli-3 wrote:
> 
>    Kingston,
> 
>    Are you using OR between patterns or between field constraints? Can you
> please show an example with the syntax you are using?
> 
>    []s
>    Edson
> 
> 
> 2007/5/17, kingston <raja_kingston at yahoo.co.in>:
>>
>>
>> Hi
>> i have written many rules in DRL . These rules look like
>>
>> when
>>
>> <condition1> ||
>> <condition2> &&
>> <condition3> ||
>> <condition4>
>>
>> Then
>> <some action>
>>
>> end;
>>
>> I am trying to rewrite these rules in DSL format .
>> I tried something like this :
>>
>> I added the english text before the statement for condition1 and used
>> variables for passing input values. and in the rule file ( .drl file ) i
>> had
>> the english text along with the input value in the place for the
>> variable.
>>
>> Finally i could make the dsl syntax work onlly when i had all the
>> conditions
>> on a single line using "eval".  This looks pretty long. The syntax
>> provided
>> in Drools documentaion  " [when]- " works fine for "AND" conditions
>>
>> How do i break my conditions in the dsl format on each new line with all
>> my
>> logical conditions "AND" , "OR" intact ? Do we have any other options for
>> breaking into new line ? Is there any work around for that ? How do I
>> handle
>> "OR" conditions?
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/probleam-in-breaking-conditions-into-multiple-lines-in-DSL-tf3771959.html#a10664273
>> Sent from the drools - user mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/probleam-in-breaking-conditions-into-multiple-lines-in-DSL-tf3771959.html#a11232387
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list