On 26/08/2013, hamorsky <peter.hamorsky(a)kogerusa.com> wrote:
Hello all,
how to denote this rule, which will be fulfilled when
for every Integer(this>10) exists at least one Integer, where existing
Integer's value is equal to -(this)
rule match
when
forall( Integer( $a: intValue > 10 )
Integer( intValue == -$a ) )
then
System.out.println( "YES!" );
end
Note that the "at least one Integer where the value is x" does not
require any extra effort, because there shouldn't be two Integers with
the same value in the first place.
-W
For example:
If in working memory are present only these facts:
Integer(5)
Integer(20)
Integer(-20)
then requested condition should be fulfilled because
5 is not above 10
-20 is not above 10
20 is above 10 and exists -20 where -20 =-(20)
Peter
--
View this message in context:
http://drools.46999.n3.nabble.com/first-order-logic-for-every-fact-exists...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users