I believe there is a caveat on functions and helper methods called from the LHS that they need to be constant over time (or at least over the life of the working memory) which then allows matches to be computed as per normal.
<br><br>Steve<br><br><div><span class="gmail_quote">On 2/13/07, <b class="gmail_sendername">Michael Suzio</b> <<a href="mailto:msuzio@gmail.com">msuzio@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The JBoss guys can correct me if I'm wrong, but although I think that works, what you've just done is eliminate any chance to precompute matches and trim down the checks that need to happen to find a rule match. Since the engine can't know that
Helper.transform("value") returns a constant value, it has to re-run that every time and it has to reject for matches to the rule constraint every time.<br><br>I'm sure this would really sink performance, in other words. You can easily see the effect -- write the rule this way and time it, and then write it with the return value of
Helper.transform being inlined, and I'm sure there's a big difference. It's the same as any other eval(...) situation in Drools; possible, but not good for performance.<div><span class="e" id="q_110b7e1658010758_1">
<br><br><div><span class="gmail_quote">On 2/12/07,
<b class="gmail_sendername">Olenin, Vladimir (MOH)</b> <<a href="mailto:Vladimir.Olenin@moh.gov.on.ca" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Vladimir.Olenin@moh.gov.on.ca</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I was wondering if calls to a Helper class are allowed in LHS of the rule?<br>Eg:<br><br>Rule myRule<br>When<br> MyObject(objField == Helper.transform("value"))<br>Then<br> // smth<br>End
<br><br><br>Thanks,<br><br>Vlad<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br>
</span></div><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div>
<br><br clear="all"><br>-- <br>Steven Williams<br><br>Supervising Consultant<br><br>Object Consulting<br>Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501<br><a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au
</a><br><a href="http://www.objectconsulting.com.au">www.objectconsulting.com.au</a><br><br>consulting | development | training | support<br>our experience makes the difference