[rules-users] Partial "not"?

Yuri de Wit ydewit at gmail.com
Wed Jul 25 08:23:58 EDT 2007


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?



More information about the rules-users mailing list