[rules-users] calls to 'Helper' classes in LHS - are they allowed?

Michael Suzio msuzio at gmail.com
Mon Feb 12 21:20:04 EST 2007


> 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.
>

OK, I fully understand what it means to use something in an eval block --
the scoping/use of that is clear, and that section of the Drools docs seems
pretty specific.  What does it mean to use a helper class in a predicate or
a return value?  Any sort of example of the two probably closes the
knowledge gap here and lets me understand the specifics of the use cases.

What I do get (and thank you for being very clear on this, it helps) is that
none of these cases is performant.  It's very clear that if a factual case
can be indexed, it can be optimized.  If it cannot, then there is a cost
every time the condition must be evaluated.  Of course, now I'm wondering...
when does *that* happen?  Is the "cost" a product of # of facts x number of
computed constraints? And then pre-computed/indexed constraints are some
(small) fixed cost on top of that?

Oh... and when does this "cost" occur?  Every time I call fireAllRules()?
Or does indexing persist across calls to that?  This might be important,
because my app right now calls fireAllRules() after pretty much every
insertion of a new fact (the ratio of global facts applicable to all cases
vs facts for a specific case is about 1 : 1000 -- I probably call
fireAllRules at least 1000 times per instantiation of a rules engine -- is
that bad?).

OK, sorry. Lots of question packed into one email.  But if you educate me, I
promise to only use that knowledge for good and to help others on this list!

  --- Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070212/7ea3ec93/attachment.html 


More information about the rules-users mailing list