[rules-users] Unable to create DSL properly?

boy18nj boy18nj at gmail.com
Wed May 4 23:03:31 EDT 2011


I'm trying to create DSL and DSLR  out of DRL but so far unsuccessfull with
this small example-

DRL (Working OK)-

#created on: Apr 30, 2011
package com.fire
#list any import classes here.
import com.fire.*;
#declare any global variables here
rule "When there is a fire turn on the sprinkler"
	
	when
		#conditions
		Fire( $room : room )
		$sprinkler : Sprinkler( room == $room, on == false )
	then 
		#actions
		modify($sprinkler){setOn(true)};
		System.out.println( "Turn on the sprinkler for room " + $room.getName() );
end


DSL-
[condition][]There is fire in "{room}"=Fire( "{room}" : room )
[condition][]"{sprinkler}" is in same "{room}" and sprinkler is
"{off}"="{sprinkler}" : Sprinkler( room == "{room}", on == "{off}" )
[consequence][]Turn on the "{sprinkler}"=modify("{sprinkler}"){setOn(true)};

DSLR- (Error message when compiling mismatched input)
#created on: Apr 30, 2011
package com.fire

expander fireAlarm.dsl
#list any import classes here.
import com.fire.*;
rule "When there is a fire turn on the sprinkler"
	when
		#conditions
		There is fire in "{room}"
		"{sprinkler}" is in same "{room}" and sprinkler is "{off}"
	then 
		#actions
		Turn on the "{sprinkler}"
		log;
end

Can somebody point out what I am doing wrong?

--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-create-DSL-properly-tp2901873p2901873.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list