[rules-users] DSL questions....

Pegram, Macon zmpegram at choosehmc.com
Thu Oct 22 11:17:30 EDT 2009


Lucas,

 

Great!  Thanks for the quick reply. 

 

Macon

 

________________________________

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Lucas Amador
Sent: Thursday, October 22, 2009 10:58 AM
To: Rules Users List
Subject: Re: [rules-users] DSL questions....

 

Hi Macon,

you can write all on one statement, but must be separated by comma

 

	
	[when]User is eligible for "{testCD}"=not MyFeature(testCD == "{testCD}") ,  $eligible : FeatureEligible(testCD = "{testCD}")

 

and you will not get any overhead at runtime because all the interpretation happens at compilation, as you says

 

lucaz

 

El 22/10/2009, a las 11:28, Pegram, Macon escribió:





All,

 

Given the following rule:

 

rule "Add ABC123 Feature"

      when

            not MyFeature(testCD == "ABC123")

            UserRequest(someValue == "ABC123_FEATURE")

            $eligible : FeatureEligible(testCD == "ABC123")

      then

            insert(new MyFeature($eligible));        

end

 

I'd like to create a DSL.   Notice that "testCD" is the same value.   

 

Is it possible to apply a value captured in a DSL and use it in more than one condition?    In the above scenario we want to see if the user is eligible for the feature ABC123, and check whether or not that feature has already been added in working memory.

 

The DSL version of the rule might look something like:
rule "Add ABC123 Feature"

      when

          User is eligible for "ABC123"

          User requests "ABC123_FEATURE"

      then

            Add feature      

end

 

Would I need to write the DSL for the "ABC123" piece like this?

[when]User is eligible for "{testCD}"=not MyFeature(testCD == "{testCD}")   $eligible : FeatureEligible(testCD = "{testCD}")
 
Or will I always need to create 2 statements? 
 
What are the performance implications of using a DSL?  Is there extra overhead at runtime or does all the interpretation occur at rule compilation?
 
Thanks!
Macon
 
 

 

        

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091022/0603d918/attachment.html 


More information about the rules-users mailing list