<br> Can you please open a JIRA with your test case?<br><br> Thanks,<br> Edson<br><br><div><span class="gmail_quote">2008/3/17, Aaron Dixon <<a href="mailto:atdixon@gmail.com">atdixon@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello, Mike,<br> <br> The behavior is identical whether I update the sub-object or not --<br> the "good" rule always works as long as I update the root person<br> object AND the "bad" rule will not work even if I explicitly update<br>
the sub-object as you've suggested.<br> <br> This leads me to interpret the engine behavior as:<br> <br> 1) An update() to a root object is enough to communicate to the rules<br> engine that the entire object graph has (potentially) changed<br>
2) The engine will properly reason over sub-objects only if you use<br> the From conditional element (but not if you use MVEL sub-property<br> expressions)<br> <br> So if (1) is the intended behavior of the engine, then my question is<br>
still this... is (2) a necessary constraint? Shouldn't the engine be<br> able to reason over MVEL sub-property expressions without requiring<br> the From conditional element? If so, it makes for a more direct syntax<br>
to allow MVEL sub-property expressions in the LHS, doesn't it?<br> <br> Thanks in advance for any help on this!<br> <br><br> Aaron<br> <br><br> <br> On Mon, Mar 17, 2008 at 4:08 AM, Anstis, Michael (M.) <<a href="mailto:manstis1@ford.com">manstis1@ford.com</a>> wrote:<br>
> IMO, you have not informed the engine\RETE network that details have changed<br> > in your first example.<br> ><br> > This would probably be a better example:-<br> ><br> ><br> > rule "30 is the new 20"<br>
> when<br> > person : Person( $d : details.age == 30 )<br> ><br> > then<br> > person.getDetails().setAge(20);<br> > System.out.println( "Now 20 : " + person );<br> > update( person );<br>
> update( $d );<br> > end<br> ><br> > The From works because it gets external data rather than using that already<br> > in the engine\RETE network.<br> ><br> > IMO, I think the rules are working correctly; it's just a misunderstanding<br>
> of how the engine\RETE network function.<br> ><br> > I hope this helps.<br> ><br> > Thanks,<br> ><br> > Mike<br> ><br> ><br> ><br> > -----Original Message-----<br> > From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>
> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Aaron Dixon<br> > Sent: 14 March 2008 20:51<br> > To: Rules Users List<br> > Subject: [rules-users] Can only reason over sub-objects if you use the<br>
> FromConditional Element<br> ><br> > It appears that you MUST use the From Condition Element to reason over<br> > sub-objects.<br> ><br> > I have a Person class. Person::getDetails() returns a Details<br>
> instance, which has the name and age of the person. (This is a<br> > contrived example to demonstrate the issue.)<br> ><br> > My rules are:<br> ><br> > rule "30 is the new 20"<br> > when<br>
> person : Person( details.age == 30 )<br> > then<br> > person.getDetails().setAge(20);<br> > System.out.println( "Now 20 : " + person );<br> > update( person );<br>
> end<br> ><br> > rule "Older than 20 - Good"<br> > salience -100<br> > when<br> > person : Person( )<br> > Details( age > 20 ) from person.details<br> > then<br>
> System.out.println( "Older than 20 (good) : " + person );<br> > end<br> ><br> > rule "Older than 20 - Bad"<br> > salience -100<br> > when<br> > person : Person( details.age > 20 )<br>
> then<br> > System.out.println( "Older than 20 (bad) : " + person );<br> > end<br> ><br> > I assert Abe, Bob, Cat, Don, and Eve with ages of 10, 20, 30, 40, and<br> > 50, respectively. The output is as follows.<br>
><br> > Now 20 : Person(Details(Cat,20))<br> > Older than 20 (good) : Person(Details(Eve,50))<br> > Older than 20 (bad) : Person(Details(Eve,50))<br> > Older than 20 (good) : Person(Details(Don,40))<br>
> Older than 20 (bad) : Person(Details(Don,40))<br> > Older than 20 (bad) : Person(Details(Cat,20))<br> ><br> ><br> > You can see that the "Bad" rule is more concise but it does not use<br> > the From Conditional Element and therefore it doesn't work properly<br>
> (Cat is determined to be older than 20 when she is not.)<br> ><br> > Why does Drools allow the "Bad" rule to be written and compiled when<br> > it does not behave properly?<br> ><br> > Thanks,<br>
> Aaron<br> > _______________________________________________<br> > rules-users mailing list<br> > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br> > <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br> > _______________________________________________<br> > rules-users mailing list<br> > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br> > <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br> ><br> _______________________________________________<br> rules-users mailing list<br> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>