[jboss-jira] [JBoss JIRA] Resolved: (JBRULES-2760) forall CE not fworking for simple forms
Edson Tirelli (JIRA)
jira-events at lists.jboss.org
Tue Nov 2 18:04:01 EDT 2010
[ https://jira.jboss.org/browse/JBRULES-2760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Edson Tirelli resolved JBRULES-2760.
------------------------------------
Resolution: Done
Forall now works exactly like the logical equivalent: not( A and not( B C...) )
There is still a catch though: re-activation of rule that include forall. I am not aware of any specific semantic definition for when a forall CE should trigger a rule reactivation and when it should not. Since it is a FOL CE that operates on sets of facts, in the same way as "not" and "exists" CEs, my understanding is that it should only re-activate when the overall matching state moves from non-matching to matching, again in the same way that simple "not" and "exists" works.
Drools as it is now, though, will trigger a re-activation every time a matching "A" fact in the example above is retracted. Jess for instance, that triggers a re-activation every time a matching A fact is asserted. I don't think either are semantically correct.
The final solution for this will be implemented as part of the linked JBRULES-2769.
> forall CE not fworking for simple forms
> ---------------------------------------
>
> Key: JBRULES-2760
> URL: https://jira.jboss.org/browse/JBRULES-2760
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.1.1.FINAL
> Reporter: Wolfgang Laun
> Assignee: Edson Tirelli
> Fix For: 5.2.0.M1
>
>
> 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.
> Since he 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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list