Malay Shah wrote:
Thanks for the response Dave. I see that a template engine like
XSLT/FreeMarker would surely help in this case, but am still interested in
knowing about the API to understand how I could model the rules in DB and
make sure that I don't loose any flexibility by storing rules in DB.
  
There is the Desr api, that is built by antlr. We have no plans to document that though, and it's not a stable api and thus subject to change. It is however straight forward and easy to reverse engineer as you can just parse stuff yourself and check the Descr tree that it builds. There is a lower level api, around rule/spi, which is after the build stage, which I've heard a few people are targetting - but that really is just for crazy people :)

My recomendation is by all means build and persist your own object structures but use a templating approach to render that structures to DRL. I would use the MVEL templating engine as it's both faster and more powerful than FreeMarker or Velocity and you already have MVEL as a dependency of Drools.
http://mvel.codehaus.org/MVEL+2.0+Templating+Guide

Mark
Regards,
Malay


David Cracauer wrote:
  
Malay,
We've been doing something similar to what you are asking for, but using
the rule syntax as an intermediate step.  We have a datamodel that users
can use to
express the rules, and we have a templating engine that turns that into
the drools syntax.  This then gets compiled into packages and built into a
rule base.  This has worked rather well for us, as it allows us to make
updates to logic on the fly by changing the templates.

--
Dave

-----Original Message-----
    
From: Malay Shah <malay.shah@morganstanley.com>
Sent: Jun 17, 2009 12:36 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] Creating drools rules porgramatically?


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.

Thanks
Malay

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

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
      
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users