Referring to org.drools.integrationtests.helloworld example:

                $m : Message(list contains "hello")
                Message(text:message == "hola")
                Message(number > 40)
                Message(birthday > "10-Jul-1974")
                Message(message matches ".*ho.*")

I first assumed that all 5 column conditions must be fulfilled by the
same Message object, and not just by any. (Adding a clone of the message
would trigger the rule 32 times)

A better less misleading LHS [a] seems to me:
$m : Message(list contains "hello", message matches ".*ho.*", message ==
"hola", number > 40, birthday > "10-Jul-1974")

My question: Would it be possible to rewrite the LHS [a] to:

                $m : Message(list contains "hello")
                $m : Message(text:message == "hola")
                $m : Message(number > 40)
                $m : Message(birthday > "10-Jul-1974")
                $m : Message(message matches ".*ho.*")

$m should only be bound the first time, subsequent "bindings" would only
check for object identity or equality?

Currently, fact binding with : seems to behave like an assignment. The
upper LHS yields no errors, but the last binding counts; and the rule is
still triggered 32 times when asserting a clone of the message.

Thanks, Juergen


Reply via email to