[rules-users] Dynamically create rules in java

Edson Tirelli tirelli at post.com
Fri Feb 29 07:16:53 EST 2008


    Brian,

    Look for the XXXDescr classes (e.g. RuleDescr, PatternDescr, etc) in
drools-compiler. If you populate this classes directly, you avoid the steps
of generating the DRL string and parsing them back into the descriptor
classes.
    The best you can do to get one example is create a simple program with
the rule template you want, use the parser to parse it and inspect the
result to know what is expected.

    []s
    Edson


2008/2/27 Brian Trezise <Brian.Trezise at intellidata.net>:

> Is there a way to dynamically create rules in java?
>
> Specifically, for a rule in the following general form I have a .txt list
> of
> strings I want to match against and take actions upon.  I know I can make
> a
> .drl out of this list without too much trouble; however the ideal case
> would
> be to simply genearate and load the rules directly into the rulebase.  Is
> this possible?  And if so, can you give me a simple example?
>
>
> rule "name"
> no-loop true
> salience 0
>        when
>                sd : SmartDescription(description matches "string",
>                possibleFamilyKeySet contains "some value",
>                description : description);
>
>        then
>                *perform java actions*
> end
>
> Any assistance would be appreciated
> Thanks,
>
> ___________________________________________________
> Brian Trezise
> Staff Software Engineer
> IntelliData, Inc
> 3173 s. uravan way
> aurora, colorado 80013
> T: 720.524.4864
> brian.trezise at intellidata.net
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 Office: +55 11 3529-6000
 Mobile: +55 11 9287-5646
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080229/ba28ddd8/attachment.html 


More information about the rules-users mailing list