[rules-users] New to Drools. Is it possible to test inverse conditions?

Manuel Ortiz manuel.ortizramos at gmail.com
Thu Mar 10 04:09:28 EST 2011


   - Dear all:


My name is Manuel Ortiz, a very beginner in Drools, and have a question
related to Multi Restriction on Condition Elements.

In
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch04.html#RuleLanguage-ConditionalElements,
it can be found the following example:

*Example 4.52. Multi Restriction*

// Simple multi restriction using a single &&
Person( age > 30 && < 40 )
// Complex multi restriction using groupings of multi restrictions
Person( age ( (> 30 && < 40) ||
              (> 20 && < 25) ) )
// Mixing muti restrictions with constraint connectives
Person( age > 30 && < 40 || location == "london" )

I need to test a multi restriction in a rule and the opposite restriction in
another. The multi restriction will be given by the user, and the
application will build rules which test both the original restriction and
the opposite. I would like to know if it is possible to write a Drools rule
which evals the opposite conditions based on the original, something like

Person( !(age > 30 && < 40) )

or I have to rebuild the multi restriction, something like

Person( age <= 30 || >= 40 )

Thank you in advance for your time.

Kind regards,

Manuel Ortiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110310/8838d6e4/attachment.html 


More information about the rules-users mailing list