<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">Beside the line &quot;not Engineer(skill == $.....&quot; i managed to get close of that, but my system is way simpler, withing WorkOrder pojo, i have a skill and within Engineer pojo, also a skill field, both int field. So I wouldn&#39;t be able to do the EngineerSkillRelation as you described since engineer does not have a field to call itself.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">basically, the objects are </div><div style="font-family:arial,sans-serif;font-size:13px">WorkOrder</div>
<div style="font-family:arial,sans-serif;font-size:13px">  - id (inherited from abstractpersistable) (long)</div><div style="font-family:arial,sans-serif;font-size:13px">  - requiredWorkTime (int)</div><div style="font-family:arial,sans-serif;font-size:13px">
  - requiredSkill (int)</div><div style="font-family:arial,sans-serif;font-size:13px">  - Engineer engineer</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Engineer</div><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-size:small">   - worktime (int);</span><br></div><div><div><font face="arial, sans-serif"><span style="white-space:pre">   -</span> name (String);</font></div>
<div><font face="arial, sans-serif"><span style="white-space:pre">   - </span>skill (int);</font></div></div><div><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif">So, if I try something like this:</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"><div>rule &quot;assignSkillWOToSkilledEngineer&quot;</div><div> <span class="" style="white-space:pre">        </span>when</div><div> <span class="" style="white-space:pre">                </span>$wo : WorkOrder( $requiredSkill : requiredSkill, $engineer : engineer  )</div>
<div> <span class="" style="white-space:pre">                </span>not Engineer(skill == $requiredSkill)</div><div>      then</div><div>      <span class="" style="white-space:pre">        </span>insertLogical(new IntConstraintOccurrence(&quot;assignSkillWOToSkilledEngineer&quot;, ConstraintType.NEGATIVE_HARD,1, $wo));</div>
<div>end</div><div><br></div><div style>it runs, but does not sort.</div></font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/2/7 Geoffrey De Smet <span dir="ltr">&lt;<a href="mailto:ge0ffrey.spam@gmail.com" target="_blank">ge0ffrey.spam@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <br>
    <div>Op 07-02-13 15:15, André Fróes schreef:<br>
    </div><div class="im">
    <blockquote type="cite">
      <div dir="ltr">Hello!
        <div>I&#39;m still not getting good with drools rules, i&#39;m
          trying several examples and basic ones. Some i did without any
          problem and understood plenty well, but when I try to make an
          approach to what i&#39;m aiming, I&#39;m not able to.</div>
        <div><br>
        </div>
        <div>Right now I&#39;m trying to compose this:</div>
        <div><br>
        </div>
        <div>When</div>
        <div>   there&#39;s an workorder with skill</div>
        <div>   and there&#39;s and engineer with the skill and
          capable of doing that workorder</div>
        <div>then</div>
        <div>   the engineer should do it</div>
        <div><br>
        </div>
        <div>So i tried something like this:</div>
        <div><br>
        </div>
        <div>
          <div>rule &quot;assignSkillWOToSkilledEngineer&quot;</div>
          <div><span style="white-space:pre-wrap"> </span>when</div>
          <div><span style="white-space:pre-wrap"> </span>$wo :
            WorkOrder( $requiredSkill : requiredSkill  )</div>
          <div><span style="white-space:pre-wrap"> </span>$engineer
            : Engineer(skill == $requiredSkill)</div>
        </div>
      </div>
    </blockquote></div>
    there&#39;s no restriction that the WorkerOrder is assigned to that
    engineer, so it matches with every engineer of that skill?<div class="im"><br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div><span style="white-space:pre-wrap"> </span>then</div>
          <div><span style="white-space:pre-wrap"> </span>insertLogical(new
            IntConstraintOccurrence(&quot;assignSkillWOToSkilledEngineer&quot;,
            ConstraintType.NEGATIVE_HARD,</div>
          <div><span style="white-space:pre-wrap"> </span>1,
            $engineer));</div>
        </div>
      </div>
    </blockquote></div>
    the cause $engineer is a problem: If an engineer combines with 2
    workorders, it will only count for 1 point due the way insertLogical
    work.<br>
    Normally the causes are the planning entities involved.<br>
    Try <br><div class="im">
    insertLogical(new
    IntConstraintOccurrence(&quot;assignSkillWOToSkilledEngineer&quot;,
    ConstraintType.NEGATIVE_HARD,
    </div><div><span style="white-space:pre-wrap"> </span>1, <span style="white-space:pre-wrap"></span>$wo));</div>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>end</div>
          <div><br>
          </div>
        </div>
      </div>
    </blockquote>
    I would write it like this (pseudo code):<br>
    <br>
    <div>
      <div>rule &quot;assignSkillWOToSkilledEngineer&quot;</div>
      <div><span style="white-space:pre-wrap"> </span>when</div>
      <div><span style="white-space:pre-wrap"> </span>$wo :
        WorkOrder( $requiredSkill : requiredSkill, $assignedEngineer :
        assignedEngineer  )</div>
      <div><span style="white-space:pre-wrap"> </span>not
        EngineerSkillRelation(skill == $requiredSkill, engineer ==
        $assignedEngineer)<div class="im"><br>
              then<br>
                        insertLogical(new
        IntConstraintOccurrence(&quot;assignSkillWOToSkilledEngineer&quot;,
        ConstraintType.NEGATIVE_HARD,<br></div>
                          1, $wo));<br>
      </div>
    </div>
    end<br>
    <blockquote type="cite"><div class="im">
      <div dir="ltr">
        <div>
          <div>i get no exceptions, but the sort is not working
            properly</div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div><pre>_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br></div>