you are right, each binding is literally a variable assignment, and the last one counts, so its doesn't really make sense to have multiple assignments in most cases.
There is no reason why it is written that way in the LHS, the example you suggest is possibly more appropriate - of course it means something different. The aim of that test/example is really to show examples of the different types of constraints, not so much in how to write a rule. On 4/7/06, Juergen <[EMAIL PROTECTED]> wrote: > > 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 > > >
