[rules-dev] Firing rules only if action causes updates to data?

Peter Lin woolfel at gmail.com
Tue Feb 27 19:39:26 EST 2007


the way i would handle this is to pre-process the english rules and convert
it to include "c != 0".

Since you're using BAL, that is already an english like language, so it gets
converted to Jrules language before it's executed anyways.

the equivalent in jbossrules would be writing the rules with DSL, which gets
compiled to JbossRules format.

there are no tools currently to automatically do that for you with an
existing set of rules. you're probably going to have to write your own
pre-processor.

peter

On 2/27/07, Premkumar Stephen <prem18 at gmail.com> wrote:
>
> Peter,
>
> Thanks for answering my post but I guess I was not clear ;
>
> I know how to modify the rule using what you have stated below. However,
> currently in our system, (using Ilog), the analysts write in English as how
> I had shown earlier:
>
> There are 4000 such rules and they would not like to go and modify them.
> Secondly, even if they were willing to put the physical effort, this  (c !=
> 0) is not a required condition for the rule to fire and this english version
> (which Ilog calls BAL or Business Action Language) needs to match whats in
> our requirements tool (Doors).
>
> Also, our rule actions in most cases, contain multiple actions. They would
> not want to pollute the rule view.
>
> So, anyways, Ilog lets me extract this out to a rule file called the Irl
> file. Now, I need to go behind the scenes and try to modify this file to the
> way I want it before deploying it in production.
>
> So, in other words, I am looking for a solution that may do these things
> in one of the ways below or achieve in some way that I have not thought of:
>
> 1) The drools api might have some flag that can be switched on; this flag
> will look at the action(s); do an 'AND' on the negation of the action(s) and
> 'AND' it to the conditions.
> This potentially could be triggered from the UI (where rules are in
> pseudo-english). Thus in this case, the Drl would look exactly the same as
> before but the rule itself is not fired if c = 0
>
> 2) There could be an api that modifies the drl file ( either hand-coded or
> generated from the JBoss Rules UI ) to update the drl to implement the rule
> as "rule x" as Peter Lin shows. (btw, the action I am looking for is rule x
> and not rule y)
>
> Thanks!!
>
>
> On 2/27/07, Peter Lin <woolfel at gmail.com> wrote:
> >
> >
> > simple
> >
> > rule x:
> >
> > if
> >   a = 5
> >   b = 3
> >   c != 0
> > then
> >   c = 0
> >
> > keep in mind that using negation NOT means that condition does not
> > exist. In other words, if I have this rule
> >
> > rule y:
> > if
> >   a = 5
> >   b = 3
> >   not c = 0
> > then
> >   c = 0
> >
> > rule y means a is 5, b is 3 and no c is zero.  Say i assert 100 objects
> > to the working memory and 1 of them has c = 0. it means rule y would never
> > fire, since there is a fact that satisfies "not c = 0".
> >
> > hope that helps
> >
> > peter
> >
> > On 2/27/07, Premkumar Stephen < prem18 at gmail.com> wrote:
> >
> > > Hi Dev team,
> > >
> > > Its been fascinating to watch the growth of this tool. Here is my
> > > question:
> > >
> > > Rule x:
> > > if
> > >    a = 5
> > >    b = 3
> > > then
> > >    c = 0
> > >
> > > Now, I have written this rule to run when a = 5 and b =3. But
> > > actually, I would like it to ideally run when a = 5 and b = 3 and c != 0
> > >
> > > Now, does the second scenario lead to any savings. In Ilog, the second
> > > scenario will result in the rule NOT being added to the agenda whereas it
> > > would in the first.
> > >
> > > I cannot code the second scenario into the rule as the rule ( as seen
> > > in UI) needs to match the requirements version ( in Doors) and they do not
> > > want to add these to the requirements. I would just like to make the second
> > > version for performance. We have noticed that less number of rules would
> > > fire.
> > >
> > > Now, if a = 5, b = 3 and c = 0, is there a way Drools can look at it
> > > and say, let me not fire this rule since there is no practical use anyways.
> > > If not, what are the ways to automate not firing rules in scenarios
> > > where action does NOT cause updates to data.
> > >
> > > Thanks!!
> > >
> > > _______________________________________________
> > > rules-dev mailing list
> > > rules-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-dev
> > >
> > >
> >
> > _______________________________________________
> > rules-dev mailing list
> > rules-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-dev
> >
> >
>
>
> --
> Regards,
> Prem
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20070227/9ea3346c/attachment.html 


More information about the rules-dev mailing list