[rules-users] "collection contains" problem

Edson Tirelli ed.tirelli at gmail.com
Mon Jan 25 13:22:16 EST 2010


    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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100125/356dbefa/attachment.html 


More information about the rules-users mailing list