[rules-users] Writing rules using java from template

Meny Kobel meny.kobel at gmail.com
Wed Apr 1 07:28:36 EDT 2009


Hi,
The example I used is very simple.
I don't have a concrete idea on how the rules should look.
For example the return value can be map or insert new bean to working
memory.
Probably I will have to build a generic component for processing and
building packages.
Are you familiar with an API that I can use?
Probably the BRMS component is doing the same - reading data base tables and
building the DRL files.
Should I use it?

Thanks,
Meny



On Tue, Mar 31, 2009 at 4:33 PM, Marcus Ilgner <marcus.ilgner at gmail.com>wrote:

> 2009/3/31 Meny Kobel <meny.kobel at gmail.com>:
> > Hi,
> > First - Thanks for your quick response.
> > Second - As I wrote rules conditions are saved in DB.
> >
> > Conditions table example :
> >
> >
> > TypeName    Operation       Value                Return Value
> > Var1                 >=                5                        “Segment
> > 1”
> > Var2                 matches      “someString”        “Segment 1”
> > Var3                 <                  6                        “Segment
> > 1”
> > Var4                  ==               1                        “Segment
> > 2”
> > Var5                  ==                5                       “Segment
> > 2”
> >
> > The table above should trasform to the following DRL rule -
> >
> > rule "example 1"
> >     when
> >
> >         Bean(var1 >= 5 ,var2 matches "someString",var3 < 6)
> >
> >     then
> >         list.add("Segment 1");
> > End
> >
> > rule "example 2"
> >     when
> >         Bean(var4 == 1 ,var5 == 5)
> >     then
> >         list.add("Segment 2");
> > End
> >
> > The conditions are dynamically build on Site by customer and I don’t know
> > the number of conditions And the conditions values(the values of columns
> > TypeName,Operation, Value and Return Value ).
> >
> > On Tue, Mar 31, 2009 at 2:35 PM, Meny Kobel <meny.kobel at gmail.com>
> wrote:
> >>
> >> Hi,
> >> Any updates regarding this subject?
> >> I have the same problem and can't find a solution.
> >> Like newbie I need to read varying rules from DB and transform them to
> >> drools language.
> >>
> >> Thanks,
> >> Meny
> >
>
> Hi,
>
> since you seem to have a concrete idea on how your rules should look,
> you can simply render them into a String according to your
> specification and then pass a StringReader to
> PackageBuilder.addPackageFromDrl(). The resultig package can then be
> added to your rulebase.
> Of course you could also use rules to generate the rules from the
> conditions in the DB, which would be more complex but more extensible,
> too.
>
> HTH
> Marcus
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090401/41600125/attachment.html 


More information about the rules-users mailing list