<!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">
    <font face="Times New Roman, Times, serif">Part:<br>
    </font><font face="Times New Roman, Times, serif"><small><font
          face="Courier New, Courier, monospace">knowledgeBuilder.add(resource,
          ResourceType.DRL);</font></small></font><font face="Times New
      Roman, Times, serif"><br>
      is the most expensive part of my source code - rest of
      instructions are nothing when you compare them to above line.<br>
      <br>
      I cannot serialize the compiled rule packages because rules are
      generated from data read from database and this data isn't static.
      Data is generated before loading rules from files that user can
      change - so I have to do this:<br>
      1) read files (which could be changed by user since last JBoss
      startup)<br>
      2) process files and generate rows for database<br>
      3) get rows from database and generate rules for Drools<br>
      <br>
      Rules aren't stored directly into database - I wasn't accurate in
      my previous e-mail. - sorry.<br>
      <br>
      <br>
    </font><br>
    On 2011-01-07 14:00, Corneil du Plessis wrote:
    <blockquote cite="mid:4D270E86.8020008@tsctech.com" type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      You should only repeat <br>
      <br>
      <small><tt>knowledgeBuilder.add(resource, ResourceType.DRL);</tt></small><font
        face="Times New Roman, Times, serif"><small><font face="Courier
            New, Courier, monospace"><br>
            <br>
          </font></small></font><small>for each rule.<br>
        <br>
        The next thing you can do is to serialize the compiled rule
        packages.<br>
        <br>
        You should also consider using Guvnor to manage your rules.<br>
      </small><font face="Times New Roman, Times, serif"><small><font
            face="Courier New, Courier, monospace"><br>
          </font></small></font>On 07/01/2011 14:05, Piotr Jedrychowski
      wrote:
      <blockquote cite="mid:4D27019C.4050401@proximetry.pl" type="cite">
        <font face="Times New Roman, Times, serif">Hello.<br>
          <br>
          I'm loading a big amount of rules during starting of JBoss
          (20000 rules). All rules (in string format) are available
          before JBoss startup - they are stored into database. Rules
          are loaded one by one and it takes about 90 minutes. I want to
          speed up this process. Is there something like "bulk load" for
          inserting rules into knowledge base or another smart way to
          fast loading a big amount of rules?<br>
          <br>
          I'm using:<br>
          1) Drools 5.1<br>
          2) JBoss 4.2.3<br>
          <br>
          My source code looks like this:<br>
          <br>
          <small><font face="Courier New, Courier, monospace">String
              rule = ...<br>
              Resource resource = ResourceFactory.newReaderResource(new
              StringReader(rule));<br>
              KnowledgeBuilder knowledgeBuilder =
              KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
              knowledgeBuilder.add(resource, ResourceType.DRL);<br>
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());</font></small><br>
          <br>
          Regards,<br>
          Piotr<br>
        </font>
        <pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true" 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="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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>
  </body>
</html>