[rules-users] forall not delivering as expected
Edson Tirelli
tirelli at post.com
Wed Sep 15 11:11:05 EDT 2010
Hey Wolfgang,
I owe you a few answers on this and other e-mails... I will try to
reply to all of them by EOD today... just been busy trying to finish
the parser changes...
Edson
2010/9/15 Wolfgang Laun <wolfgang.laun at gmail.com>:
> If someone from the Team would please confirm that this is indeed a bug?
> Then I'll submit a JIRA.
> -W
>
> On 13 September 2010 08:50, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:
>>
>> Since the following rule is just a variant of (Expert) Example 4.66, "All
>> Buses are Red", I think that there is a bug, in 5.1.1:
>>
>> // Does not fire even though all Triangle have all sides > 0
>> rule "All triangle sides are greater than 0"
>> when
>> forall( Triangle( a > 0, b > 0, c > 0 ) )
>> then
>> System.out.println( "All triangle sides are > 0." );
>> end
>>
>> Also, the tortuous equivalent does not fire:
>>
>> // Does not fire even though all Triangle have all sides > 0
>> rule "All triangle sides are greater than 0"
>> when
>> forall( $t: Triangle()
>> Triangle( this == $t, a > 0, b > 0, c > 0 ) )
>> then
>> System.out.println( "All triangle sides are > 0." );
>> end
>>
>> -W
>>
>>
>> On 12 September 2010 19:45, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:
>>>
>>> Given classes
>>> class Triangle { int a, b, c;... }
>>> class Quadrangle { int a, b, c, d;... }
>>> with appropriate getters (but no hashCode or equals) and these facts
>>> Triangle( 3, 3, 3 )
>>> Triangle( 3, 3, 3 ) // a duplicate, intentional
>>> Quadrangle ( 3, 4, 5, 6 );
>>> the rule
>>> rule "all equilaterals have a 'fitting' quadrangle"
>>> when
>>> forall( Triangle( $a: a, b == $a, c == $a )
>>> Quadrangle( a == $a || b == $a || c == $a || d == $a ) )
>>> then // ...
>>> end
>>> works as expected - it fires.
>>>
>>> But the rule
>>> rule "all equilaterals have a duplicate"
>>> when
>>> forall( $t: Triangle( $a: a, b == $a, c == $a )
>>> Triangle( this != $t, a == $a, b == $a , c == $a ) )
>>> then // ...
>>> end
>>> does not fire, not even when I omit this != $t. Why?
>>>
>>> Do I have a white spot in my grey cells? Please tint my taint...
>>>
>>> -W
>>>
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
More information about the rules-users
mailing list