[rules-users] forall with nested collections

braveheart85 andrea.pacifico.85 at gmail.com
Wed May 14 09:28:48 EDT 2014


Hello,

I'm pretty new to Drools hence i apologize if my question is newbie but i'm
getting crazy.
I'm trying to write a functioning query since yesterday without fortune.
I have data about vehicles owned by person organized for year. My structure
is:

     VechicleData
     |___VehicleYearData
           |____Vehicle

I have inserted in Drools only the root of the hierarchy (VehicleData)
because insert all objects has been problematic for me. Now i need to check
if a person has all vehicle of the same make.
I have tried this:

$result: PersonData( $id: identifierCode )
	forall 
		(
			($o: VehicleData( ownerIdentifierCode == $result.identifierCode )) &&
			($y: VehicleYearData( ) from $o.data) &&
			($v: VehicleEntity( ) from $y.vehicleEntity)
		)
		VehicleEntity( this == $v, make == "BMW" )
	) 

and this:

	PersonData( $id: identifierCode )
	$list: List( ) from accumulate (
		(and
			$o: VehicleData( ownerIdentifierCode == $id )
			$y: VehicleYearData( ) from $o.data
			$e: VehicleEntity( ) from $y.vehicleEntity
		),
		collectList( $e )
	)
	forall (
		$v: VehicleEntity( ) from $list
		VehicleEntity( this == $v, make == "BMW" )
	)

and many other...
Someone can help me??

Thank you.
Andrea



--
View this message in context: http://drools.46999.n3.nabble.com/forall-with-nested-collections-tp4029572.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list