[rules-users] Inserting (asserting) objects during LHS evaluation - side effects?

Lance Arlaus lance.nospam.1 at codeberet.com
Mon Apr 21 17:18:25 EDT 2008


All-

What are the potential side effects of asserting objects during LHS
evaluation, specifically a FROM clause?

For example, using the example from the docs, let's assume that the
zipcode property is in fact a field that's calculated via business
rules.  So, I'd like to perform just-in-time insertion of the person's
address and perhaps other objects as well necessary to the calculation.

In other words, I'd like to implicitly assert objects on-demand as
they're needed.  For the curious, this is something that's possible in
Blaze Advisor using their is-needed rules, and for which I'm attempting
to find a corresponding capability in Drools.

I guess it comes down to the question of whether insertObject() is
reentrant.  Anybody have a clue?  Or another way of approaching this?

For reference, here's the documentation example using the from clause:

rule "validate zipcode"
when
    Person( $personAddress : address ) 
    Address( zipcode == "23920W") from $personAddress 
then
    # zip code is ok
end






More information about the rules-users mailing list