[rules-users] DSL to DRL File Conversion - Is it possible ?

kingston raja_kingston at yahoo.co.in
Wed May 30 01:14:14 EDT 2007


Hi Mark ,

Can you just help me  in  converting this drl to dsl. ? How do i break lines
in DSL involving OR conditions.?
"[when]-" works for AND conditions . Do i really need give some english text
(DSL mapping) for each line of the when condition when i use "[when]-"


//Sample drl file.

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


The above conditions could be wrriten on a single line using eval() . But
this looks pretty long. Are there any other options i coudl try for breaking
line.? Do we have any workarounds for this.?



Mark Proctor wrote:
> 
> Its not straight forward but you can use the DRLDumper, one a 
> PackageDescr, assuming it parses without errors:
>         DrlParser parser = new DrlParser();
>         PackageDescr pkg = parser.parse( source,
>                                                               dsl );
>         final DrlDumper drlDumper = new DrlDumper();
>         final String drlResult = drlDumper.dump( pkg );
> 
> 
> 
> Michael Neale wrote:
>> no in 3.0 version unfortunately. You can tell the parser to print out 
>> the DRL - but it will just write it out the System.out (only for 
>> debuggin). Look in RuleParser for that option.
>>
>> In trunk - which will be the new version - there is a seperate step 
>> which outputs DRL - but I don't think that made it into the M1 release 
>> - should be in M2 though.
>>
>> On 3/7/07, *kingston* <raja_kingston at yahoo.co.in 
>> <mailto:raja_kingston at yahoo.co.in>> wrote:
>>
>>
>>     Is there anyway to get the DRL syntax out of the DSL format?
>>
>>     Is there any Convenient API method Which takes rule in DSL format
>>     and the
>>     DSL File Name as arguments and returns the DRL Syntax ?
>>
>>     --
>>     View this message in context:
>>    
>> http://www.nabble.com/DSL-to-DRL-File-Conversion---Is-it-possible---tf3360408.html#a9347582
>>     Sent from the drools - user mailing list archive at Nabble.com
>>     <http://Nabble.com>.
>>
>>     _______________________________________________
>>     rules-users mailing list
>>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>>     https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>   
> 
> 
> _______________________________________________
> 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/DSL-to-DRL-File-Conversion---Is-it-possible---tf3360408.html#a10867626
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list