[rules-users] Help writing LHS

Felipe Piccolini felipe.piccolini at bluesoft.cl
Tue Apr 10 14:18:08 EDT 2007


Hello,

  Im working in 2 rules and I'm having some problems writing the LHS  
in a way the final
user can understand reading the drl (which uses a dsl expander).

The first rule is something like this:

    Two facts: User and Form.
    The rule is something like this:

      'If the User is "User1" or "User2" or "User3" then The Form can  
be approved if the amount of Credit1(defined in the Form)
       is less than the User's maximum limit and the amount of  
Guarantee (another amount of money) is less than User's minum limit"

   I try to write it in a DSL:
      A user the type User1,User2 or User3=u: User(type=User1|=User2| 
=User3, max: maximumLimit, min: minimumLimit)
      A Form for a credit=f : Form(cred: creditAmount, guar:  
guaranteeAmount)
      The Credit amount is less than User's Maximum Limit=cred < max
      The Guarantee amount must be less than the User's Minimum  
Limit=guar < min

But it doesn't work, I know it shoudnt work, but How can I write the  
sentences in a way that can be used all in a rule, but also can be  
readed separatedly?

   The other rule I need help is something like this:
     Having a List with some objects (lets say Credit is the object  
with name, value and period as attributes)

       "The List only contains Credits of this types: {Credit 
(type=1,period=36, value=80) or Credit(type=2,period=48,value=100)  
or ... etc, etc)"

    How can I write  the LHS of something like this if the fact is  
the List of Credits?

    I have Edson's words in my mind all the time: "eval is EVIL"

So the question is how can I do this without eval and using DSL  
templates
so the templates can be readed properly from a human been?

Thanks for your help.

Felipe Piccolini M.
felipe.piccolini at bluesoft.cl




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070410/454d1dd6/attachment.html 


More information about the rules-users mailing list