<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    For further info, this is what ilog do. They only allow an implicit
    "else" on the last "evaluate" expression. Which while simple is
    quite restrictive.:<br>
    <a class="moz-txt-link-freetext"
href="http://publib.boulder.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=/com.ibm.websphere.ilog.jrules.doc/Content/Business_Rules/Documentation/_pubskel/JRules/ps_JRules_Global1895.html">http://publib.boulder.ibm.com/infocenter/brjrules/v7r1/index.jsp?topic=/com.ibm.websphere.ilog.jrules.doc/Content/Business_Rules/Documentation/_pubskel/JRules/ps_JRules_Global1895.html</a><br>
    <pre class="literallayout" xml:space="preserve"><span class="bold">rule</span> <span class="italics">ruleName</span> {
<span class="bold">   when</span> 
      {<span class="italics">conditioni</span> evaluate (<span class="italics">expression</span>)}
<span class="bold">   then</span> 
       {[<span class="italics">action1 </span>... <span class="italics">actionm</span>]}
  &nbsp;<span class="bold">else</span> 
       {[<span class="italics">action1</span> ... <span class="italics">actionp</span>]}
}; 

OPSJ is the only engine that i know of that uses labels:

x.name == obj,
x.weight == "light",
x.location != g.location);
mky: monkey;
[4] (mky.holds == obj);
} do {
makegoal("walkto", loc);
} else( 4 ) {
makegoal("holds", obj);
}
</pre>
    Although I would encourage people to think beyond simple "if/else",
    the proposal I put forward would allow for tree like data flows for
    signal processing - which will map very nicely to GUI tooling.<br>
    <br>
    Mark<br>
    <br>
    <br>
    On 19/08/2011 13:56, Toni Rikkola wrote:
    <blockquote
      cite="mid:912AD008-7DAE-4021-BAA9-13F4056B8F06@gmail.com"
      type="cite">
      <div>I got the same feeling that Geoffrey had about readability.</div>
      <div><br>
      </div>
      <div>We added "from" its really easy to get, why not add "else".</div>
      <div><br>
      </div>
      <div>when<br>
        &nbsp;&nbsp;&nbsp;&nbsp;Person( name == "darth" ) &nbsp;else &nbsp;[darthIsMissing]&nbsp;<br>
        &nbsp;&nbsp;&nbsp;&nbsp;A()<br>
        then<br>
        &nbsp;&nbsp;&nbsp;....<br>
        then.darthIsMissing<br>
        &nbsp;&nbsp;log("Darth was never found");</div>
      <div>end</div>
      <div><br>
      </div>
      <div>or</div>
      <div><br>
      </div>
      <div>when<br>
        &nbsp;&nbsp;&nbsp;&nbsp;Person( name == "darth" ) &nbsp;else &nbsp;{ log("Darth was never
        found"); }<br>
        &nbsp;&nbsp;&nbsp;&nbsp;A()<br>
        then<br>
        &nbsp;&nbsp;&nbsp;....<br>
        end</div>
      <div><br>
      </div>
      <div>"Inline then" could be done with inner rules. Similar to what
        Mario suggested.</div>
      <div><br>
      </div>
      <div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">rule "Handle Login"</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; when</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; &nbsp; $loginRequest :LoginRequest()</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; &nbsp; AuthorizedUsers( list contains
          $loginRequest.user ) else [unsuccessfulLoginAttempt]</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; min-height: 14px; "><br>
        </div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; &nbsp; &nbsp; inner rule "Check if Admin"</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $p :AdminRights( user ==
          $loginRequest.user )</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; &nbsp; &nbsp; then&nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; showAdminMenu();&nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp;&nbsp; &nbsp; &nbsp; end</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; min-height: 14px; "><br>
        </div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; then</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; &nbsp; logInUser( $loginRequest.user );</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; min-height: 14px; "><br>
        </div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; then.unsuccessfulLoginAttempt</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">&nbsp; &nbsp; log( "There was and unsuccessful login
          attempt with the user name " + $loginRequest.user.name ); &nbsp; &nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 12px/normal
          Helvetica; ">end</div>
      </div>
      <div><br>
      </div>
      <div>Toni</div>
      <br>
      <div>
        <div>On Aug 19, 2011, at 2:59 PM, Geoffrey De Smet wrote:</div>
        <br class="Apple-interchange-newline">
        <blockquote type="cite">
          <meta content="text/html; charset=ISO-8859-1"
            http-equiv="Content-Type">
          <div text="#000000" bgcolor="#ffffff"> I like Mario's proposal
            because I can actually read it.<br>
            Those special chars | &lt; are gibberish to me.<br>
            <br>
            The only reason we're not debating to use a new readable,
            intuitive keyword, is because of the back-wards
            compatibility issues involved.<br>
            But using unreadable, unintuitive special char just for
            that, is probably not a good idea.<br>
            I wonder if we reserve new keywords by prefix them with
            reserved special char like "@"?<br>
            Then we can introduce as many keywords as we want without
            breaking backwards compatibility.<br>
            <br>
            Who's our target users for DRL authors?<br>
            A) Supersmart computer science guys<br>
            B) Blue collar Java programmers<br>
            C) Domain experts (= not programmers)<br>
            <br>
            I 'd classify "{notA} &lt; A()" as (given some time to learn
            it) readable for A, but not for B and C.<br>
            <br>
            Op 18-08-11 23:35, Mario Fusco schreef:
            <blockquote
cite="mid:CAPYjU_mV45SC5M-UYOmFk9bF7Pi34144pqPEjUtm1woZrdXDRg@mail.gmail.com"
              type="cite">Hi Mark,<br>
              <br>
              Since you're gathering 2 cents here and there I decided to
              add also mine even if I am pretty sure that I am still
              missing the whole picture and anyway at the moment I
              cannot see all the consequences of what I am going to
              propose.<br>
              <br>
              To tell you the truth I find the label syntax not very
              intuitive and I was wondering if we could avoid it in some
              way. In the end what the 90% of the users are asking for
              is just something like:<br>
              <br>
              rule R<br>
              &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; A()<br>
              &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; do something<br>
              &nbsp;&nbsp;&nbsp; else<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; do something else<br>
              end&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
              <br>
              while we are going to give them something that is not
              exactly the same:<br>
              <br>
              rule R<br>
              &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {notA} &lt; A()<br>
              &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; do something<br>
              &nbsp;&nbsp;&nbsp; then.notA<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; do something else<br>
              end&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
              <br>
              In particular I was thinking if we could keep the when ...
              then ... else syntax that should be familiar to the
              biggest part of the users and at the same time obtain a
              flexibility similar to the one provided by the labels
              syntax. Probably we could do it with a kind of nested
              rules so, for instance, the rule:<br>
              <br>
              rule R1<br>
              &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {af} &lt; A() &gt; {at}<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; B()<br>
              &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO<br>
              &nbsp;&nbsp;&nbsp; <a moz-do-not-send="true" href="http://then.af/">then.af</a><br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO.af<br>
              &nbsp;&nbsp;&nbsp; <a moz-do-not-send="true" href="http://then.at/">then.at</a><br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <a moz-do-not-send="true" href="http://DO.at">DO.at</a><br>
              end<br>
              <br>
              could be rewritten as it follows:<br>
              <br>
              rule R1<br>
              &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; B()<br>
              &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rule R1A<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; A()<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <a moz-do-not-send="true"
                href="http://DO.at">DO.at</a><br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO.af<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; end&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
              end&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
              <br>
              Of course the nested rule couldn't be used by the Drools
              engine as it is, but we could implement a kind of
              "linearization" process at compile time that translates it
              more or less as:<br>
              <br>
              rule R1_1<br>
              &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; A()<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; B()<br>
              &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <a moz-do-not-send="true" href="http://DO.at">DO.at</a><br>
              end<br>
              <br>
              rule R1_2<br>
              &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; not A()<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; B()<br>
              &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO.af<br>
              end<br>
              <br>
              In the same way the "or" example:<br>
              <br>
              rule R1<br>
              when<br>
              &nbsp;&nbsp;&nbsp; ( &nbsp;&nbsp;&nbsp; A() &gt; {a1} or<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; B() &gt; {b1} or<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; C() &gt; {c1} )<br>
              &nbsp;&nbsp;&nbsp; D()<br>
              then<br>
              &nbsp;&nbsp;&nbsp; DO<br>
              then.a1<br>
              &nbsp;&nbsp;&nbsp; DO.a1<br>
              then.b1<br>
              &nbsp;&nbsp;&nbsp; DO.b1<br>
              then.c1<br>
              &nbsp;&nbsp;&nbsp; DO.c1<br>
              end<br>
              <br>
              could be written as:<br>
              <br>
              rule R1<br>
              &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; D()<br>
              &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rule R1A<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; A()<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO.a1<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; end&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rule R1B<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; B()<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO.b1<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; end&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rule R1C<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; when<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; C()<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; then<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DO.c1<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; end<br>
              end&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
              <br>
              and then linearized at compile time in a similar way as I
              wrote before.<br>
              <br>
              Once again I still haven't evaluated all the implications
              of my suggestion neither I know if we can cover with it
              all the cases proposed by Mark. I am pretty sure I am
              missing something important to be honest, but since we are
              in a "brainstorming phase" I thought it could worth to
              consider it at least.<br>
              <br>
              My 2 cents,<br>
              Mario<br>
              <br>
              <pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
            </blockquote>
            <br>
            <pre class="moz-signature" cols="72">-- 
With kind regards,
Geoffrey De Smet</pre>
          </div>
          _______________________________________________<br>
          rules-dev mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
          <a class="moz-txt-link-freetext"
            href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
rules-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
    </blockquote>
    <br>
    <br>
  </body>
</html>