[rules-users] how "exists" works exactly?
Wolfgang Laun
wolfgang.laun at gmail.com
Wed May 5 05:07:37 EDT 2010
One thing I've noticed is that
not (exists (EPackage( ) ) )
is a roundabout (and possibly inefficient) way of saying
not (EPackage( ... ) )
It's difficult (for me) to deduce what should happen in the rules as
the description of the
fact data isn't clear enough (for me).
-W
2010/5/5 Antonio Neto <antoniosouzaneto at gmail.com>:
> Any idea? Please...
>
> 2010/5/4 Antonio Neto <antoniosouzaneto at 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
>>
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
More information about the rules-users
mailing list