Hi Antonio,
Documentation states that the complement to "not" is "exists",whereas
"not" keyword is used to match the absence of a fact (in Working Memory), and
"exists" keyword is used to test the existence of one or more facts (in Working
memory).
So if you want to test that a fact is not in working memory, then you should use the
not(MyClass()) pattern.
Hope this helps,
Francois.
Antonio Neto <antoniosouzaneto(a)gmail.com> a écrit :
Any idea? Please...
2010/5/4 Antonio Neto <antoniosouzaneto(a)gmail.com>
> Hi all,
>
> I don't know exactly why I have a problem in my "exists" function.
I've
> tried many different ways, but it does not work. Anybody could help me,
> please?
>
>
> I have the following rules:
>
> *rule "diff"
> when
> $var1: EReference(name == "employee")
> $var2: EClass(name == "Company", EAllReferences contains $var1)
> not (exists( EPackage(EClassifiers contains $var2 ) ))
> then
> insertLogical(new IntConstraintOccurrence("diff", 10));
> end
>
> rule "ClassesNotReferenced"
> when
> $q1 : EClass();
> $q2 : EPackage(EClassifiers contains $q1);
> not( exists ( EReference(EType == $q1) ));
> then
> insertLogical(new IntConstraintOccurrence("ClassesNotReferenced",
> 1, $q1));
> end*
>
>
> and in my facts (and my EPackage) I have 4 instances of EClass "Company"
> with a EReference "employee", and another EClass "Person". I
still have a
> "move" that removes EClasses in my Drools Solver.
>
> I need to have only one classe "Company" after processing. But it removes
> only the EClass "Person", when it was supposed to remove one EClass
"Person"
> and 3 ECLasses "Company". Leaving one EClass "Company" in the
end.
>
> The problem is: when Drools tries to remove a EClass "Person" it thinks
> that the EClass "Company" does not exists. But in fact there are 3
others.
>
> Any clue about it, please ?
>
> Thanks
>
> Bests regards
>
> Antonio
>
>
>