[rules-users] Using global in LHS

Markus Helbig info at markushelbig.de
Fri May 30 05:40:16 EDT 2008


Hi,

also using memberOf results in: Unable to create Field Extractor for
'advertisment' of '[ClassObjectType

do i'll miss sth else?

Cheers

Markus

On Thu, May 29, 2008 at 2:48 PM, Jaroslaw Kijanowski
<jaroslaw.kijanowski at redhat.com> wrote:
> Hi,
>  there are two issues:
> - the left side of contains needs to be filed of Item (it also needs to be a
> Collection or array)
> - in your case you should use "memberOf" to check if a field (catId) is a
> member of a Collection or array.
>
> see the docs for more info (6.5.2.1.1.3.1. Operators)
>
> However if you're going to use an array as your global, you will run into a
> CCE, because an array doesn't implement the Collection interface [1], [2].
> I'm not sure if this is a bug in drools or an expected "constraint", hence a
> bug in the docs.
> Anyway, your safe using a List.
>
> Cheers,
>  Jarek
>
> [1]
> drools-core/src/main/java/org/drools/base/evaluators/BaseMemberOfEvaluator.java
> (evaluate())
> [2] drools-core/src/main/java/org/drools/spi/FieldValue.java
>
>
> Markus Helbig wrote:
>>
>> Hi,
>>
>> again a question, any body had success using globals in LHS?
>>
>> Following DSL
>>
>> [condition][]is a Item=Item()
>> [condition][]-is of type Advertisment=advertisment contains catId
>>
>>
>> rule
>>         when
>>                $pli: is a Item
>>                    - is of type Advertisment
>>         then
>>                // do whatever you want
>> end
>>
>> catId is a member of Item
>> advertisment is a Integer[] array set as global
>>
>> comiling ends with:
>>
>> Unable to create Field Extractor for 'advertisment' of '[ClassObjectType
>>
>> It works fine if advertisment is a member of Item, but i want to have
>> it as global ...
>>
>> Cheers
>>
>> Markus
>> _______________________________________________
>> 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
>



More information about the rules-users mailing list