<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Malay Shah wrote:
<blockquote cite="mid:24078773.post@talk.nabble.com" type="cite">
  <pre wrap="">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.
  </pre>
</blockquote>
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 :)<br>
<br>
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.<br>
<a class="moz-txt-link-freetext" href="http://mvel.codehaus.org/MVEL+2.0+Templating+Guide">http://mvel.codehaus.org/MVEL+2.0+Templating+Guide</a><br>
<br>
Mark<br>
<blockquote cite="mid:24078773.post@talk.nabble.com" type="cite">
  <pre wrap="">
Regards,
Malay


David Cracauer wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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-----
    </pre>
    <blockquote type="cite">
      <pre wrap="">From: Malay Shah <a class="moz-txt-link-rfc2396E" href="mailto:malay.shah@morganstanley.com">&lt;malay.shah@morganstanley.com&gt;</a>
Sent: Jun 17, 2009 12:36 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
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
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->the
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">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
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->files,
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">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:
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!----><a class="moz-txt-link-freetext" href="http://www.nabble.com/Creating-drools-rules-porgramatically--tp24077426p24077426.html">http://www.nabble.com/Creating-drools-rules-porgramatically--tp24077426p24077426.html</a>
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
<br>
</body>
</html>