<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
In theory they can be indexed, but we havne't done it yet, no idea when
we'll get time. Patches welcome :)<br>
<br>
Mark<br>
Olenin, Vladimir (MOH) wrote:
<blockquote
 cite="mid:060D1E03738E6743B694DA541B5E4CC911145227@hscptoyfmxis101.moh.ad.gov.on.ca"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName">
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
  </style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  </o:SmartTagType>
  <div class="Section1">
  <div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">Thanks, Mark. Are there any
plans on making return
value, predicate and eval expressions indexable (in case it is possible
at
all)? Would it be included in 3.2 release? I understand that DROOLS can
not
guarantee that helper method will return the same value each time and
probably
that&#8217;s why excludes such cases from index, but the same goes for
&#8216;getters&#8217;
of the fact objects &#8211; DROOLS can&#8217;t guarantee the getter will return
the same value each time, so it just have to assume it (and it is
outlined in
the documentation).<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">There are a few use case that
might need this kind of
functionality, eg to cache the results of &#8216;associative&#8217; lookup.
Especially for the &#8216;Decision Tables&#8217;. The problem I&#8217;m facing
right now is I need to &#8216;expand&#8217; the list of codes based on some id
and use those codes as constraint:<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyObject(field
&lt;= LookupMap.getCodes($param))<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">Where $param is a value from
Decision Table data. In
this particular case a set of, say 100 codes, can be described with a
simple
ID. For more complex cases a pseudo &#8216;set select&#8217; expression can be
passed as a parameter (eg, LookupMap.getCodes(&#8220;groupId_1 &#8211;
grouperId_2&#8221;),
which should return the intersection of codes in groupId_1 and
groupId_2). In
any case, the &lt;key, value&gt; pairs returned by LookupMap class
would remain
the same.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">Vlad<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  </div>
  <div>
  <div class="MsoNormal" style="text-align: center;" align="center"><font
 color="black" face="Times New Roman" size="3"><span
 style="font-size: 12pt; color: windowtext;">
  <hr tabindex="-1" align="center" size="2" width="100%"></span></font></div>
  <p class="MsoNormal"><b><font color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext; font-weight: bold;">From:</span></font></b><font
 color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext;">
<a class="moz-txt-link-abbreviated" href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>
[<a class="moz-txt-link-freetext" href="mailto:rules-users-bounces@lists.jboss.org">mailto:rules-users-bounces@lists.jboss.org</a>] <b><span
 style="font-weight: bold;">On
Behalf Of </span></b>Mark Proctor<br>
  <b><span style="font-weight: bold;">Sent:</span></b> 12 February 2007
19:16<br>
  <b><span style="font-weight: bold;">To:</span></b> <st1:PersonName
 w:st="on">Rules Users List</st1:PersonName><br>
  <b><span style="font-weight: bold;">Subject:</span></b> Re:
[rules-users] calls
to 'Helper' classes in LHS - are they allowed?</span></font><font
 color="black"><span style="color: windowtext;"><o:p></o:p></span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">We were hoping the community
would work with us and
improve the documentation over the last year - to date we have had zip
:( We
will have another documentation drive once we get to the candidate
release
stage for the current development cycle. We simply don't have the
cycles to
work on a book, with any luck after we spend 3 to 4 weeks on
documentation
during hte candidate release stage it should get better, and maybe one
day&nbsp; the manual can form the basis of a book. Some ideas for the&nbsp;
community to work include the examples in drools-examples, they can
even use
what I did for drools 2.x as a starting basis, or to provide a really
good
tutorial on the basics of pattern matching, you can look the public
domain
clips manual for pointers here. It's not money we need, its time, YOUR
time :)<br>
  <br>
If you want to use a helper class it must be in a return value,
predicate or
eval - none of which are currently indexed. return value and predicate
must
also be time constant, eval does not have to be.<br>
  <br>
Mark<br>
Michael Suzio wrote: <o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">I see this in the docs:<br>
  <br>
"A <a name="d0e1997" moz-do-not-send="true"></a>Predicate constraint
can use
any valid Java expression as long as it evaluated to a primitive
boolean - avoid
using any Drools keywords as Declaration identifiers. Previously bound
declarations can be used in the expression. Functions used in a
Predicate
Constraint must return time constant results."<br>
  <br>
and under the discussion of 'eval':<br>
  <br>
"Evals cannot be indexed and thus are not as optimal as using Field
Constraints."<br>
  <br>
and this in general discussion of constraints and accessors of your
objects
used in them:<br>
  <br>
"Do please make sure that you are accessing methods that take no
parameters, and are in-fact "accessors" (as in, they don't change the
state of the object in a way that may effect the rules - remember that
the rule
engine effectively caches the results of its matching inbetween
invocations to
make it faster)."<br>
  <br>
So, if invoking a helper method is like an eval, I'm thinking Drools
computes
the match, but then throws it away because it knows this is not a
constant
expression.&nbsp; Whereas, if it were just a match of an accessor's value
vs. a
constant String, it could cache that. <br>
  <br>
I'm wildly speculating, only because I want to understand fully what is
happening, so I'm throwing stuff out there so the Drools team will have
to
correct my misapprehensions before I confuse the whole list (*g*).&nbsp;
Sometimes reading the Drools documentation is like a Talmudic scholar
trying to
find the deeper meaning of the sacred words...&nbsp; as much as I want the
3.2
milestone, I want real documentation even more (and *hint hint* --
would
probably be willing to pay for it, guys!&nbsp; Can we get an O'Reilly book?)<br>
  <br>
&nbsp; --- Michael<br>
  <br>
  <o:p></o:p></span></font></p>
  <span id="q_110b81fae178c623_1"></span>
  <div>
  <p class="MsoNormal"><span class="gmailquote"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">On
2/12/07, <b><span style="font-weight: bold;">Steven Williams</span></b>
&lt;<a href="mailto:stevenw@objectconsulting.com.au"
 moz-do-not-send="true">stevenw@objectconsulting.com.au</a>&gt;
wrote:</span></font></span> <o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">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 <o:p></o:p></span></font></p>
  <div><span id="q_110b81fae178c623_1">
  <p class="MsoNormal" style="margin-bottom: 12pt;"><span class="e"><font
 color="black" face="Times New Roman" size="3"><span
 style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></span></p>
  <div>
  <p class="MsoNormal"><span class="gmailquote"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">On
2/13/07, <b><span style="font-weight: bold;">Michael Suzio</span></b>
&lt;<a href="mailto:msuzio@gmail.com" target="_blank"
 moz-do-not-send="true">
msuzio@gmail.com</a>&gt; wrote:</span></font></span> <o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">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.&nbsp; 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.&nbsp; 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.&nbsp; It's the same as any other eval(...) situation in
Drools;
possible, but not good for performance. <o:p></o:p></span></font></p>
  <div>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  <div>
  <p class="MsoNormal"><span class="gmailquote"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">On
2/12/07, <b><span style="font-weight: bold;">Olenin, Vladimir (MOH)</span></b>
&lt;<a href="mailto:Vladimir.Olenin@moh.gov.on.ca" target="_blank"
 moz-do-not-send="true">Vladimir.Olenin@moh.gov.on.ca</a>&gt; wrote: </span></font></span><o:p></o:p></p>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;">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>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyObject(objField ==
Helper.transform("value"))<br>
Then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 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"
 moz-do-not-send="true">rules-users@lists.jboss.org</a><br>
  <a href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank" moz-do-not-send="true">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  </div>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
  <a href="mailto:rules-users@lists.jboss.org" target="_blank"
 moz-do-not-send="true">rules-users@lists.jboss.org </a><br>
  <a href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank" moz-do-not-send="true">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><br>
  <br clear="all">
  <br>
  <br>
  <o:p></o:p></span></font></p>
  </span></div>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">-- <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" target="_blank"
 moz-do-not-send="true">stevenw@objectconsulting.com.au </a><br>
  <a href="http://www.objectconsulting.com.au" target="_blank"
 moz-do-not-send="true">www.objectconsulting.com.au</a><br>
  <br>
consulting | development | training | support<br>
our experience makes the difference <br>
_______________________________________________<br>
rules-users mailing list<br>
  <a href="mailto:rules-users@lists.jboss.org" moz-do-not-send="true">rules-users@lists.jboss.org</a><br>
  <a href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank" moz-do-not-send="true">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><br>
  <br>
  <o:p></o:p></span></font></p>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><o:p>&nbsp;</o:p></span></font></pre>
  <pre style="text-align: center;"><font color="black"
 face="Courier New" size="2"><span style="font-size: 10pt;">

<hr align="center" size="4" width="90%">

</span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><o:p>&nbsp;</o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">_______________________________________________<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">rules-users mailing list<o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a moz-do-not-send="true"
 href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;"><a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><o:p></o:p></span></font></pre>
  <pre><font color="black" face="Courier New" size="2"><span
 style="font-size: 10pt;">&nbsp; <o:p></o:p></span></font></pre>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
</blockquote>
<br>
</body>
</html>