[
http://jira.jboss.com/jira/browse/JBRULES-1511?page=all ]
Mark Proctor updated JBRULES-1511:
----------------------------------
Assignee: Edson Tirelli (was: Mark Proctor)
Can only reason over sub-objects if you use the From Conditional
Element
------------------------------------------------------------------------
Key: JBRULES-1511
URL:
http://jira.jboss.com/jira/browse/JBRULES-1511
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Reteoo
Affects Versions: 4.0.4, 4.0.5
Reporter: Aaron Dixon
Assigned To: Edson Tirelli
Attachments: drools-issue.zip
It appears that you MUST use the From Condition Element to reason over sub-objects or
else Drools yields unpredictable behavior.
The first two rules below appear to be semantically equivalent. However the
"bad" rule (the rule that does not use the from conditional element) does not
get activated correctly when there is another rule (see the third rule) that modifies the
age sub-property before the first two rules are activated:
rule "Older than 20 - Good"
salience -100
when
person : Person( )
Details( age > 20 ) from person.details
then
System.out.println( "Older than 20 (good) : " + person );
end
rule "Older than 20 - Bad"
salience -100
when
person : Person( details.age > 20 )
then
System.out.println( "Older than 20 (bad) : " + person );
end
rule "30 is the new 20"
when
person : Person( details.age == 30 )
then
person.getDetails().setAge( 20 );
System.out.println( "Now 20 : " + person );
update( person );
end
Given that the "bad" rule is semantically equivalent to the second rule, Drools
should treat both rules the same in the engine. See the referenced forum thread for
further justification for this claim.
Also, see the attached zip for an executable example.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira