Why would you only want to process the first item in the list?

That aside, If you really only want to evaluate the first String in the list
you might be better off using two rules, something like this:

rule 1
when
    $p : Parent( $mess : message );
    $s : List<String>() from $p.segments;
then
    if($s.size() > 0) {
        String segment = $s.get(0);
        insertLogical(new ParentSegment($p, $mess, segment) );
end

rule 2
when
    ParentSegment( $p : parent, $mess : message, $segment : segment )
then
    ....
end

2011/3/18 Sébastien Raickman <[email protected]>

> $m.segments is java.util.List<String>
>
> I want to evaluate one of the String (the first of the List)
>
> How should I do it?
>
> Thanks
>
>
> 2011/3/18 Wolfgang Laun <[email protected]>
>
>> The Java type of $m.segments would be - what?
>> -W
>>
>> 2011/3/18 Sébastien Raickman <[email protected]>
>>
>>> Hi all,
>>>
>>> Do someone knows how to disable strict type from the rule itself?
>>>
>>> Or the way to cast segments in (String []) in the following rule:
>>>
>>> dialect "mvel"
>>>
>>> when
>>>     $m : Parent();
>>>     $mess : Message() from $m.message;
>>>     $seg : String[]() from $m.*segments*;
>>>
>>> my error at deployment of drools-server is :
>>>
>>> *unqualified type in strict mode for: segments]*
>>>
>>> Thanks in advance
>>>
>>> Seb
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> [email protected]
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> [email protected]
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to