[rules-users] Write Assumptions for NESTED List<Object>

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jun 26 07:26:51 EDT 2012


On 26/06/2012, aliosha79 <alex_orl1079 at yahoo.it> wrote:
> Laune,
> i need to know if this form is correct:
>
> when
>    $order: OrderType( $orderLineList: this.orderLine, priority != high )

(You could omit "this.")

>    $measureList: measure from $orderLineList

This is incorrect DRL syntax. You have to extract (using "from") the
elements of orderLine which are of class OrderLineType, and from these
you can extract measure.

>    not ( this.measure < 12 ) from $measureList

This is ncorrect DRL syntax.

> then
>    modify( $order ){ setPriority( "high" ) }
> end
>

Using variables bound to the List fields:

when
   $order: OrderType( $orderLineList: orderLines, priority != "high" )
   $olt: OrderLineType( $measures: measures ) from $orderLineList
   not Measure( measure < 12 ) from $measures
then


> The reason is that i'm implementing a rule editor for my work in a way
> that,
> according to a selected xsd element from a displayed tree, i have to build
> the right line of DRL code. So i m forced for many reason to use a form
> similar to the one written above.
> The pattern i'm using (and at this point i cannot change it anymore) is
> something like this:
> declaring $variableList
> accessing the list using (this.property == value) FROM $variableList

You'll *have* to add a class name up front, e.g.
    SomeType(property == value) FROM $variableList

-W
>
> it's a big costraint... i know... but i have to work this way.
> So should the previous rule work?
> Really thanks.
> Alessio
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Write-Assumptions-for-NESTED-List-Object-tp4018241p4018256.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> 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