how are you calling the rule engine - can you show a snippet of code?

On 2/9/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
>
> I don't quite get your drift.
>
> If I modify N orders, each order with 1 item, I have to activate my rule
> N*N times. That's really costly.
>
> Regards,
> Alan
>
>
> -----Original Message-----
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 08, 2006 3:39 PM
> To: [email protected]
> Subject: Re: [drools-user] How do I control firing of rules ?
>
> so you are asserting into working memories orders, and items as "exploded"
> apart from each other? (if you get my drift).
>
>
> Michael.
>
> On 2/9/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I'm fairly new to drools, and was curious if there is a way to reduce
> > the firing of rules.
> >
> > Whenever a fact is modified, drools fires all rules who's parameter (
> > is the same class type of the fact.
> >
> > e. g.
> >
> >     <rule name="Order Level" salience="1" >
> >         <parameter identifier="order">
> >             <class>com.blah.shipping.ruleengine.Order</class>
> >         </parameter >
> >         <parameter identifier="item">
> >             <class>com.blah.shipping.ruleengine.Item</class>
> >         </parameter >
> >      :
> >      :
> >      :
> >     </rule>
> >
> > Whenever we modify any fact of type object Item or type Order, this
> > above rule will fire.
> >
> >
> > Can we somehow specify a parameter based a sub-field of an object.
> > Something like
> >
> >     <rule name="Order Level" salience="1" >
> >         <parameter identifier="order">
> >             <class>com.blah.shipping.ruleengine.Order</class>
> >         </parameter >
> >         <parameter identifier="Item">
> >             <instance>order.orderItem</instance>
> >         </parameter >
> >      :
> >      :
> >      :
> >     </rule>
> >
> > Where order.orderItem is of type Item. In this scenario, the rule will
> > only fire when an order fact or order.orderItem is modifed.
> >
> > Right now, to emulate the behaviour I am looking for, I am doing a
> > check in a rule condition:
> >
> >
> >     <rule name="Order Level" salience="1" >
> >         <parameter identifier="order">
> >             <class>com.blah.shipping.ruleengine.Order</class>
> >         </parameter >
> >         <parameter identifier="item">
> >             <class>com.blah.shipping.ruleengine.Item</class>
> >         </parameter >
> >
> >         <java:condition>order.orderItem == item</java:condition>
> >
> >      :
> >      :
> >      :
> >     </rule>
> >
> > Thanks,
> > Alan Ho
> >
> >
>

Reply via email to