[rules-users] Partial "not"?

Edson Tirelli tirelli at post.com
Wed Jul 25 08:48:40 EDT 2007


    Haaaaa!!! :)

    I knew there would be a use case for a constraint negative operator
(not/!)!!
    Sorry, it is not available in 4.0 but you can open a feature request and
I may add it to the next release! :)

    Anyway, there are other ways. Just to make sure I understand your case,
can you please state your rules in plain English? I think there may be
easier ways to express them then the way you showed bellow.

    []s
    Edson

2007/7/25, Yuri de Wit <ydewit at gmail.com>:
>
> I have a case where I need to negate only part of the predicates.
>
> RULE1
> when:
>   c1 : Child()
>   c2 : Child(hashCode < c1.hashCode, prop1==c1.prop1, ... propN==c1.propN)
> then:
>   insert(new Parent(c1, c2));
>
> RULE2
> when
>   p:Parent()
>   c1:Child(this memberOf p)
>   not Child(this memberOd p, prop1==c1.prop1, ...propN==c1.propN)
> then
>   retract(p);
>
> While in rule1 I use a matching criteria to group c1 and c2, in rule2
> I want to use the inverse of the same exact criteria to ungroup them.
> I dont care which propN no longer holds, as long as the any of the
> propN no longer holds. The problem is that I still need the "positive"
> this memberOf p. How to solve this problem?
>
> RULE2
> when
>   p:Parent()
>   c1:Child(this memberOf p)
>   Child(
>           this memberOd p,
>           not(prop1==c1.prop1, ...propN==c1.propN)
>   )
> then
>   retract(p);
>
> (afaik, not supported)
>
> any ideas?
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070725/bcd21214/attachment.html 


More information about the rules-users mailing list