I have a container class that has a field that exposes a collection of record
numbers.  In the working memory, I have a bunch of record objects, and one
container object.  I want to write a rule that fires when it encounters a
container that has records matching some criteria.  Here's what I thought
would work:

1 when
2  Container( $things : things -> ( $things.size() > 0 ) )
3  $count : ArrayList( size > 0 ) from
4   collect( Record( $things contains number, otherfield == "somevalue" ) )
5 then
6  ...

Unfortunately, that gets me an error:

  InvalidRulePackage: Unable to create Field Extractor for '$things'

(I determined that the problem is in line 4)

Seems to me that what I'm doing is reasonable, and ought to work.  Is this a
bug, an oversight in drools, or is it in fact unreasonable?

The following "works":

  collect( Record( num : number -> ( $rlis.contains(num) ) ) )

But since the predicate is not time-constant (the list of things in the
Container will change), I'd have to modify() every Record every time I wanted
to re-run the rules.  That would not be very performant...

Note that this is actually unrelated to "collect" -- this doesn't work either:

1 when
2  Container( $things : things )
3  Record( $things contains number )
4 then

(I'm using trunk, revision 8056, updated this morning)

-- 
Dirk Bergstrom               [EMAIL PROTECTED]
_____________________________________________
Juniper Networks Inc.,          Computer Geek
Tel: 408.745.3182           Fax: 408.745.8905

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to