[rules-users] "collection contains" problem

Mike Dougherty mjdougherty at gmail.com
Mon Jan 25 15:36:54 EST 2010


Hey Edson and Wolfgang,

I went to setup an example app and rules file to send you, and it seemed to work correctly. So now I have to figure out the difference between the sample code and application code. Hopefully, I'll be able to find it.


Thanks to both of you for your help.
Mike



On Jan 25, 2010, at 10:22 AM, Edson Tirelli wrote:

> 
>     Mike,
> 
>     Wolfgang has it right. When you write:
> 
>            property : StatusProperty( name == "propertyName", value == "valueA" )
> 
>     You are telling the engine that the StatusProperty is a fact in the working memory. Reading that, I assumed you were inserting them, because if they are not facts in the working memory, the rule will obviously never match.
> 
>     If you don't want to insert them (although recommended), you need to rewrite the pattern using "from" to tell the engine where to look for the properties. Example:
> 
> when
>            t : TrainingStatus( currentSection == "section_a" )
>            property : StatusProperty( name == "propertyName", value == "valueA" ) from t.properties
> then
> end
> 
>     []s
>     Edson
> 
> 2010/1/25 Mike Dougherty <mjdougherty at gmail.com>
> Hello Wolfgang,
> 
> Thank you for the response. However, as I read this documentation this should not be necessary. Even still, if I try it, it does not seem to help.
> 
> 
> Thanks,
> Mike
> 
> 
> 
> On Jan 24, 2010, at 9:17 AM, Wolfgang Laun wrote:
> 
>> On Sun, Jan 24, 2010 at 8:16 AM, Mike Dougherty <mjdougherty at gmail.com> wrote:
>> 
>> I'm inserting a TrainingStatus object that should match this rule. But the resulting object does not have the nextSection and previousSection fields set to the values they should.
>> 
>> Only because you mention the insertion of the TrainingStatus object but not the one(s) of (a) StatusProperty object(s): They should be inserted, too!
>> 
>> -W
>> 
>> 
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> 
> 
> -- 
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss by Red Hat @ www.jboss.com
> _______________________________________________
> 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/20100125/bb13d678/attachment.html 


More information about the rules-users mailing list