[rules-users] New DSL question...Interpreting constants...

Pegram, Macon zmpegram at choosehmc.com
Thu Oct 22 14:09:10 EDT 2009


Given the following rules (contrived example):

rule "Monetary 1"

      when

            Currency(typeID in (CurrencyConst.DOLLAR,
CurrencyConst.EURO, CurrencyConst.YEN))

      then

          insert(new Fact());

end       

 

 

rule "Monetary 2"

      when

            Currency(typeID in (CurrencyConst.RUBLES,
CurrencyConst.WON))

      then

          insert(new Fact());

end       

 

 

Is it possible to map constant values into a DSL?  

 

So the above rules could be partially rewritten as:

rule "Monetary 1"

      when

            Currency is one of DOLLAR, EURO, YEN 

      then

          insert(new Fact());

end       

 

rule "Monetary 2"

      when

            Currency is one of RUBLES, WON 

      then

          insert(new Fact());

end       

 

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


More information about the rules-users mailing list