[rules-users] Creating drools rules porgramatically?

Malay Shah malay.shah at morganstanley.com
Fri Jun 19 17:55:34 EDT 2009


Thanks Mark and Andreas. I think using the API would be pretty tricky,
considering that it does not have documentation and is not very popular. I
guess the option of creating drl on the fly would be easier for now.

Regards,
Malay


Andreas Kohn-5 wrote:
> 
> On Wed, 2009-06-17 at 09:36 -0700, Malay Shah wrote:
>> Hi,
>> 
>> I am looking to create the drools Rule objects programatically, and I
>> believe there is API to do that in 4.0.7. But, the API looks complex and
>> the
>> documentation is not sufficient. Could anyone please point me to some
>> examples of doing this? I basically don't want to write rules in .drl
>> files,
>> but have a database store the rules and make them strongly typed (by
>> generating Rule Objects directly from DB). Any help is much appreciated.
> 
> We're doing this by converting (XML) configuration files into rules
> directly. Our reason was to avoid the serialization requirements, as
> most of our objects used in facts are not serializable at all.
> 
> 
> There is indeed not much documentation, and our approach was to build
> simple rules first as DRL in a unit test, and then follow their way
> through
> the *Descr parts mentioned in another post, and observe how drools uses
> them to build the RuleConditionElements using a debugger.
> 
> We have our built own abstraction on top then that hides the drools
> "magic" behind documented classes, so that we can adjust our
> implementation easily when drools changes.
> 
> The unit tests inside drools can help a long way here as well, but be
> aware that this is quite some work and most of that follows a
> trial-and-error approach :)
> 
> FWIW, we're using drools 5.0.1.FINAL, and haven't tested whether the
> same approach works for 4.0.7.
> 
> HTH,
> --
> Andreas
> 
> -- 
> Never attribute to malice that which can be adequately explained by
> stupidity.                                        -- Hanlon's Razor
> 
>  
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Creating-drools-rules-porgramatically--tp24077426p24119376.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list