--- On Fri, 9/5/08, Michael Zimmermann <[EMAIL PROTECTED]> wrote:

> rule "MyRule"
> when
>   book(year==myYear, author==myAuthor ...)
> then
>   ....
> 
> This works only if all properties myYear, myAuthor ... are
> present. If one is undefined, the rule does not match.

You could have a function that returns true if the properties match or the 
property is null:

boolean matchesOrNull(Object o, Object p) {
  return p == null ? true : ( o == null ? true : o.equals(p) );
}

Call it using eval in the conditions.

Maybe if it's useful enough an operator could be added to Drools that does the 
same thing.  "~=" maybe?

GreG




      
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to