[rules-users] Efficiency Question

Simon French french.simon at gmail.com
Wed Jul 4 06:19:47 EDT 2007


Hi.
I'm wondering if somebody could tell me if what I'm doing is efficient or
not.

Having written a number of rules we found that we were duplicating a number
of constants, and if any of the "constants" (we later found out they are
more like variants !!) it meant changing them in a number of places.

What we came up with was to use a spreadsheet with three columns, variable
name, a string value and a numeric value. We then used a little VB to
produce an XML document, and via JAXB load the XML in as Java classes and
assert the data into working memory.

So we have a Class something like :-

public class ConstantValueType {

    protected String varName;
    protected int intVal;
    protected String stringVal;

 ...........
}

Then within our rules we doing

rule "Exclusions 1"
salience 500
when
    ConstantValueType(varName == "MaxProposerAge",$maxProposerAge : intVal
)
    $res : ResultData(schemeCode == "TE")
    $pr : Proposer($age : age > $maxProposerAge )
then
    System.out.println("**** Not flexing because proposer age >=
"+($maxProposerAge+1));
    retract($res);
end

What I'm wondering is because I'm  doing a ?join?     pr : Proposer($age :
age > $maxProposerAge ) presumably this is similar to an eval and as such
the rules engine is having to evaluate this each time rather than having the
information ready to hand each time the rule is evaluated?

If this is inefficient is there another way of achieving this? We're
currently working with 3.0.6

As it stands the rules engine is flying, but it would be nice to know if
what I'm doing could be done better

Thanks in advance

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070704/a5b5b096/attachment.html 


More information about the rules-users mailing list