[rules-users] Replacing Hand Written Rules

Wolfgang Laun wolfgang.laun at gmail.com
Sun Oct 31 11:14:12 EDT 2010


2010/10/31 Nirmal Fernando <nirmal070125 at gmail.com>:
> Hi,
>
> On Sun, Oct 31, 2010 at 7:47 PM, Wolfgang Laun <wolfgang.laun at gmail.com>
> wrote:
>>
>> Is there a compelling reason for discarding the system that's in use now?
>
> Mainly due to difficulty in maintaining a hand written large amount of
> rules.

Do you think that these translated rules will be easier to maintain?!?

>
>>
>> It would appear that you are emulating the existing system's functions
>> (_psubj,
>> date, equality test) by some mechanism using reflection, which, in
>> itself, will cause some
>> overhead. Then, in the Drools rule, you are using eval(), which is the
>> least efficient way of
>> formulating a condition; none of the optimizations will work this way.
>> This kind of
>> transformation may result in a significant increase of execution time
>> (which, of course, may not hurt you if there isn't much time spent in
>> condition evaluation now.)
>>
>> The eval() call after then looks suspicious: is this a function you
>> have defined?
>
> Not really, I think this is drools eval function.

eval() cannot be used on the RHS, after then. It is a wrapper for general
boolean expressions, to be used as a constraint in a Pattern (whar you have
in Processor( eval() ) ) or as a CE.

> Ok, let me ask you like this, if I give you the following rule, can you
> write an equivalent drools rule?
>
> IF _psubj(be,$var0) ^ NOT date($var0) ^ NOT $var0=$Time THEN
> ^1_Existence:Entity(be,$var0)

You must be kidding. I have no idea what the variables are and what
the methods might do.

-W

>
> Thanks for the great help!
>
>>
>>
>>
>>
>>
>>
>> 2010/10/31 Nirmal Fernando <nirmal070125 at gmail.com>:
>> > Hi Laun,
>> >
>> >> Consider that 5000+ is a large number. Estimate the time it'll take you
>> >> to transform one rule: Will you be able to spend, say, 3 months for
>> >> this
>> >> task?
>> >
>> > We've already developed a piece of code which does this conversion.
>> > Following is an example.
>> > Can you please comment on the converted rule? whether it is a valid
>> > drools
>> > rule or not?
>> >
>> > Our Rule
>> > IF _psubj(be,$var0) ^ NOT date($var0) ^ NOT $var0=$Time THEN
>> > ^1_Existence:Entity(be,$var0)
>> >
>> > Converted Drools Rule
>> > rule "0"
>> >     when p: Processor(
>> > eval(p.existence("_psubj(be,"+p.conceptVar[0]+")"))
>> > && eval(!p.existence("date("+p.conceptVar[0]+")")) &&
>> > eval(!p.testVar(p.conceptVar[0],"$Time")) )
>> >     then
>> >         eval(p.AppendRule("
>> > ^1_Existence:Entity(be,"+p.conceptVar[0]+")"));
>> >     end
>> >
>> >
>> >
>> > Thanks.
>> >>
>> >> -W
>> >>
>> >>
>> >> 2010/10/31 Nirmal Fernando <nirmal070125 at gmail.com>
>> >>>
>> >>> Something like following 2 rules:
>> >>>
>> >>> # IF when($Awareness,$var0) THEN ^1_Awareness:Time($Awareness,$var0)
>> >>> # IF $relTime($Awareness,$Time) THEN
>> >>> ^1_Awareness:Time($Awareness,$Time)
>> >>>
>> >>> thanks.
>> >>>
>> >>> 2010/10/31 Wolfgang Laun <wolfgang.laun at gmail.com>
>> >>>>
>> >>>> What, exactly, do you mean by "hand written"? Java statements?
>> >>>> Another
>> >>>> Rule System?
>> >>>> Can you provide a sample?
>> >>>>
>> >>>>
>> >>>> 2010/10/31 Nirmal Fernando <nirmal070125 at gmail.com>
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> I am having a 5000+ hand written rules which is used in an open
>> >>>>> source
>> >>>>> project.
>> >>>>> I am searching for the reasons, me to be shifted to a rule engine
>> >>>>> like
>> >>>>> Drools, instead of using hand written once.
>> >>>>> Drools rules can be debugged that will be a plus point, isn't it? I
>> >>>>> would love to get a list of benefits that I will be getting.
>> >>>>>
>> >>>>> Thanks.
>> >>>>>
>> >>>>> --
>> >>>>> Best Regards,
>> >>>>> Nirmal
>> >>>>>
>> >>>>> C.S.Nirmal J. Fernando
>> >>>>> Department of Computer Science & Engineering,
>> >>>>> Faculty of Engineering,
>> >>>>> University of Moratuwa,
>> >>>>> Sri Lanka.
>> >>>>> Blog: http://nirmalfdo.blogspot.com/
>> >>>>>
>> >>>>> _______________________________________________
>> >>>>> rules-users mailing list
>> >>>>> rules-users at lists.jboss.org
>> >>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>>>>
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> rules-users mailing list
>> >>>> rules-users at lists.jboss.org
>> >>>> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Best Regards,
>> >>> Nirmal
>> >>>
>> >>> C.S.Nirmal J. Fernando
>> >>> Department of Computer Science & Engineering,
>> >>> Faculty of Engineering,
>> >>> University of Moratuwa,
>> >>> Sri Lanka.
>> >>> Blog: http://nirmalfdo.blogspot.com/
>> >>>
>> >>> _______________________________________________
>> >>> rules-users mailing list
>> >>> rules-users at lists.jboss.org
>> >>> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>>
>> >>
>> >>
>> >> _______________________________________________
>> >> rules-users mailing list
>> >> rules-users at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> >
>> >
>> >
>> >
>> > --
>> > Best Regards,
>> > Nirmal
>> >
>> > C.S.Nirmal J. Fernando
>> > Department of Computer Science & Engineering,
>> > Faculty of Engineering,
>> > University of Moratuwa,
>> > Sri Lanka.
>> > Blog: http://nirmalfdo.blogspot.com/
>> >
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>> >
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> --
> Best Regards,
> Nirmal
>
> C.S.Nirmal J. Fernando
> Department of Computer Science & Engineering,
> Faculty of Engineering,
> University of Moratuwa,
> Sri Lanka.
> Blog: http://nirmalfdo.blogspot.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