[rules-users] Drools & "Query by Example"?

Mark Proctor mproctor at codehaus.org
Fri Sep 5 11:02:30 EDT 2008


Someone poppe onto irc a few months back, claiming they did this for 
their company and would provide the code as a patch - never heard 
anything after that though :(
So if that person is read, please upload your patch to JIRA :)

Mark
Greg Barton wrote:
> --- On Fri, 9/5/08, Michael Zimmermann <list at incunabulum.de> 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
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>   

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


More information about the rules-users mailing list