<br>   Nancy,<br><br>   An inline eval will create a constraint in the corresponding node in the network. I.e., if it is an alpha constraint, the eval() will be added to an alpha node, or if it is a beta constraint, it will be added to the beta node. <br>
<br>   If it is an alpha constraint, it will be reevaluated every time the fact type changes (in your example, every time the engine is notified of a change in a User fact). If it is a beta constraint, it will be reevaluated every time the fact changes or a fact matching a previous pattern in the same rule changes.<br>
<br>   Evals are not indexed, so the reevaluation is a bit more costly. It is better to avoid them when possible, but sometimes it is not.<br><br>   []s<br>   Edson<br><br><div class="gmail_quote">2009/7/28 Nancy Dougherty <span dir="ltr">&lt;<a href="mailto:nancyhd@stanford.edu">nancyhd@stanford.edu</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello!<br>
<br>
I have a question about how an inline eval function is or isn’t<br>
efficient in the algorithm-  I have many User objects that I am<br>
inserting into Working Memory (in a stateful session), and each User<br>
object has as ArrayList of Messages<br>
<br>
The message class has 2 String fields: text and logid<br>
<br>
I have custom boolean function user.containsText(String keyword)<br>
function that takes in a string, and searches to see if that keyword<br>
contained in the text field of one of the message entries in the User<br>
message arraylist.  If I use an inline eval statement to implement<br>
this:<br>
<br>
$user: User( eval (containsText ( “sample text”) ) )<br>
<br>
Will it re-evaluate each time?  Or will Drools cache the result and<br>
remember it/ create a node based on it so the node will have every<br>
user this is true for, and it doesn’t re-evaluate when the users or<br>
rules are modified?  Will it create a &quot;node&quot; in the algorithm for all<br>
the users that this function is true for?<br>
<br>
On a similar note, if I use the “matches” comparator in a rule<br>
creation, does it create a node and cache the result? Will it<br>
automatically re-evaluate each time the field its matched against is<br>
modified?<br>
<br>
Thanks so much!<br>
<br>
Nancy<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" target="_blank">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>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>