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

Salaboy salaboy at gmail.com
Thu Mar 10 06:16:53 EST 2011


You can use not(Person(age > 30))
greetings

- CTO @ http://www.plugtree.com
- MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jbug.com.ar
- Mauricio "Salaboy" Salatino -

On 10/03/2011, at 06:09, Manuel Ortiz <manuel.ortizramos at gmail.com> wrote:

> 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
> _______________________________________________
> 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/20110310/2ab2f381/attachment.html 


More information about the rules-users mailing list