[rules-users] "not exists MyObject" - is it a valid LHS condition?
Edson Tirelli
tirelli at post.com
Sat Feb 10 07:44:45 EST 2007
Vlad,
The conditional element "not" is the oposite of "exists". It means
exactly what you want:
not MyObject( <constraints> )
Will evaluate to true if and only if there is no instance of MyObject in
the working memory that match the given <constraints>.
Exists will evaluate to true if there is at least one object that
matches the constraints:
exists MyObject( <constraints> )
So, you don't need to write "not exists"... write simply "not".
Having said that, 3.0.x will trigger an error if you write "not exists".
Trunk will "optimize" and remove your "exists" effectivelly using only
the "not".
[]s
Edson
Olenin, Vladimir (MOH) wrote:
> Hi,
>
> I wonder if the combination of ‘not’ and ‘exists’ keywords is a valid
> one and therefore the construct like
>
> rule “myrule”
>
> when
>
> not exist MyObject(param matches “somepattern”)
>
> then
>
> System.out.println(“Object for pattern ‘somepattern’ doesn’t exisit”);
>
> End
>
> Thanks.
>
> Vlad
>
> PS: basically I need to trigger a rule if some set of facts is NOT
> found and I need to trigger it only once.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>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 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com
More information about the rules-users
mailing list