Hi Vincent,<br><br>Thanks for precisions.<br><br>Didn&#39;t knew only set/get are used. Get to be careful when i will have 100+ attributes  :-)<br><br>Yes i created rueles with guided editor and it&#39;s working with my attribute. is there a way to remove &quot;empty&quot;, &quot;entrySet&quot;, &quot;keySet&quot;, &quot;clone&quot;,... herited from Map. So i would have only the attribute i have defined?<br>

<br>Ok i will do like this for testing eval($m1 != $m2) ... i have put this in separate line to meke it clearer at the beginning.<br><br>I think i will do your first option, rules will be clearer. <br><br>i have always used drl file instead of package. If i deploy a  file.pkg, is there a way to know what&#39;s in it? If i deploy something, i just want to be able later to very that all is well what i think if i have a doubt (easy with drl file).<br>

<br>When i try to create my session i have problem with pkg. For know with .drl file i do with that :<br><br>KnowledgeBase knowledgeBase = createKnowledgeBase();<br>StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();<br>

<br>private static KnowledgeBase createKnowledgeBase() {<br>        final KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder ();<br><br>        builder.add(ResourceFactory.newUrlResource(&quot;file:///d://basicRule.drl&quot;), ResourceType.DRL);<br>

        if (builder.hasErrors()) {<br>            throw new RuntimeException(builder.getErrors()<br>                    .toString());<br>        }<br>        KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();<br>

        knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages());<br><br>        return knowledgeBase;<br>    }<br><br>If i replace the line :<br>builder.add(ResourceFactory.newUrlResource(&quot;file:///d://basicRule.drl&quot;), ResourceType.DRL);<br>

by :<br>builder.add(ResourceFactory.newUrlResource(&quot;file:///d://PackageTest1.pkg&quot;), ResourceType.PKG);<br><br>but it&#39;s crashing : <br>xception in thread &quot;main&quot; org.drools.RuntimeDroolsException: Unable to load dialect &#39;org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration&#39;<br>

    at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:283)<br>    at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:268)<br>

    at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:181)<br>    at org.drools.compiler.PackageBuilderConfiguration.&lt;init&gt;(PackageBuilderConfiguration.java:154)<br>    at org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilderConfiguration(KnowledgeBuilderFactoryServiceImpl.java:26)<br>

    at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(KnowledgeBuilderFactory.java:86)<br>    at TestMapPojoPackage.createKnowledgeBase(TestMapPojoPackage.java:86)<br>    at TestMapPojoPackage.main(TestMapPojoPackage.java:58)<br>

Caused by: java.lang.RuntimeException: The Janino jar is not in the classpath<br>    at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:100)<br>    at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)<br>

    at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:279)<br>    ... 7 more<br><br>Is it something special to do?<br><br>Thanks again for your time<br><br><br><div class="gmail_quote">

On Mon, Mar 7, 2011 at 7:44 PM, Vincent Legendre [via Drools - Java Rules Engine] <span dir="ltr">&lt;<a href="/user/SendEmail.jtp?type=node&node=2651282&i=0&by-user=t" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">

        
&lt;html&gt;
  &lt;head&gt;
    
  &lt;/head&gt;
  &lt;body text=&quot;#000000&quot; bgcolor=&quot;#ffffff&quot;&gt;
    <br>
    </div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">I&#39;ve just created 2 class like you show me with some
      changes to fit and test all (timestamp are long in fact, i have
      put int, double and string as well) <br>
    </blockquote><div class="im">
    In the second class you don&#39;t need the attributes as members,
    because Drools uses get / set methods to deduce them, and anyway you
    never use them as they are stored in the map.<br>
    <br>
    </div><div class="im"><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">Then i have imported this in Guvnor.<br>
      <br>
      I have made 2 categories. I have put the model (jar) in the 2
      categories.</blockquote></div>
    That is non-sense. Jars are not linked to a category but to a
    package.<br><div class="im">
    <br>
    <blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite"> I have created 2 simple rules playing with the
      attributes id, timestamp...<br>
    </blockquote></div>
    With Guided editor ?<div class="im"><br>
    <br>
    <blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">
      <table>
        <tbody>
          <tr>
            <td><br>
              1) For the condition Map $m1 different then Map $m2. I
              suppose i have to use the function define in MapPojo? I
              have to write it by hand using &quot;free from drl&quot; : eval($m1
              != $m2) ? or is there a better way? <br>
            </td>
          </tr>
        </tbody>
      </table>
    </blockquote></div><div class="im">
    Its a way.<br>
    You can also test the id directly in conditions (in Guided editor,
    bind the id of the first instance to a var, then compare it in the
    second condition.<br>
    </div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">
      <table>
        <tbody>
          <tr>
            <td>
              <br><div class="im">
              The same for testing that $m1 timestamp (Long) is befor
              $m2. I have to write it by hand : eval($m1.isBefore($m2))?
              So they have to know it exist a method isBefore if not
              said by the gui?<br>
            </div></td>
          </tr>
        </tbody>
      </table>
    </blockquote><div class="im">
    Same. Add the test directly in the condition.<br>
    Another solution is to use a custom operator (search this mailing
    list for samples).<br>
    <br>
    </div><div class="im"><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">
      <table>
        <tbody>
          <tr>
            <td>2) In the code It&#39;s written MapTest1(..) instead of
              Map(...) so i suppose drools has to do it with the
              precompiled package  .pkg to know about the MapPojo and
              MapTest1.. If i take only the .drl, drools won&#39;t know
              about class MapTest1.<br>
            </td>
          </tr>
        </tbody>
      </table>
    </blockquote></div><div class="im">
    It is MapTest1, because this is the class used .... and drools knows
    it because it uses it ... You don&#39;t use Map directly anymore<br>
    </div><blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite"><br><div class="im">
      <div class="gmail_quote">Yes i can set a category to each of my
        rule. </div>
    </div></blockquote>
    Yes you can !<div class="im"><br>
    <blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">
      <div class="gmail_quote">Do you mean create 4 categories (cat1,
        cat2, cat3, cat4) and for rules of file1.drl, put them it cat1,
        for file2.drl, put them in cat2... ? </div>
    </blockquote></div>
    Yes<div class="im"><br>
    <blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">
      <div class="gmail_quote">Set a first condition in the rules? </div>
    </blockquote></div>
    Choose between categories and first condition. Don&#39;t use both<br>
    <blockquote style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;" type="cite">
      <div class="gmail_quote">Am i obliged to create a package per file
        and filter by category or is it possible to make a package with
        all and filtering when creating the knowledgeBase or something
        like that?<br>
      </div>
    </blockquote><div class="im">
    You certainly can filter your KB afterwards, but this is not really
    an out-of-the-box function. To me you have two options. For both
    options, you have only one Guvnor package :<b><br>
      <br>
      First option</b> : categories<br>
    set categories for your rules as you said<br>
    compile by filtering one category, do a snapshot. Redo the same for
    other categories (in other snapshots). <br>
    Use these 4 snapshots in your code<br>
    <br>
    <b>Second option </b>: First filtering condition<br>
    create a new POJO having only one field to handle the task asked (or
    category or group or file or whatever you call that) add a condition
    to all your rules testing this fact according to their group (as
    described in one of my previous mail)<br>
    create a single package (or use DRL) for all your rules.<br>
    when calling your rules, insert the suitable POJO according to
    tehexec you want.<br>
    <br>
    The second is my favorite because it is less work to deploy, and
    your number of rules are quite small. The second option can be
    change to use a RuleFlow instead of a control fact.<br>
    <br>
    <br></div>
  &lt;/body&gt;
&lt;/html&gt;
<br><div class="im">_______________________________________________
<br>rules-users mailing list
<br><a href="http://user/SendEmail.jtp?type=node&amp;node=2647352&amp;i=0&amp;by-user=t" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br></div><div class="im"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" rel="nofollow" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
        
        <br>
        <br>
        </div><hr color="#cccccc" noshade size="1">
        <div style="color: rgb(68, 68, 68); font: 12px tahoma,geneva,helvetica,arial,sans-serif;"><div class="im">
                <div style="font-weight: bold;">If you reply to this email, your message will be added to the discussion below:</div>
                </div><a href="http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-implementation-questions-tp2602641p2647352.html?by-user=t" target="_blank" rel="nofollow" link="external">http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-implementation-questions-tp2602641p2647352.html</a>
        </div><div><div></div><div class="h5">
        <div style="color: rgb(102, 102, 102); font: 11px tahoma,geneva,helvetica,arial,sans-serif; margin-top: 0.4em;">
                
                
        </div></div></div></blockquote></div><br>

        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-and-drools-implementation-questions-tp2602641p2651282.html">Re: Guvnor and drools implementation - questions</a><br/>
Sent from the <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Drools-User-f47000.html">Drools - User mailing list archive</a> at Nabble.com.<br/>