<!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 text="#000000" bgcolor="#ffffff">
    On 2/10/2011 11:36 AM, Wolfgang Laun wrote:
    <blockquote
      cite="mid:AANLkTikVN6XLzxDCTJj2bPjSX_nVCDcL=1aVVqHVXVyE@mail.gmail.com"
      type="cite">What about these DRL CEs and CE phrases:<br>
      &nbsp;&nbsp; forall<br>
      &nbsp;&nbsp; from<br>
      &nbsp;&nbsp; from collect<br>
      &nbsp;&nbsp; from accumulate with function<br>
      &nbsp;&nbsp; from accumulate with init/action/result<br>
      <br>
      Then, some rule attributes<br>
      &nbsp;&nbsp; no-loop<br>
      &nbsp;&nbsp; agenda-group<br>
      &nbsp;&nbsp; salience ( &lt;expression&gt; )&nbsp;&nbsp; // not a *literal* expression<br>
      <br>
      What about temporal operators and other CEP features?<br>
      <br>
      And I'm not even going to be mean and discuss plugins such as
      user-defined evaluators<br>
      or user-defined accumulate functions.<br>
      <br>
      <br>
      As for DRL in XML, one might simply add JAXB annotations to the
      classes representing a DRL Package and its constiuents. And then
      marshal and schemagen. Piece of cake, theoretically ;-)<br>
      <br>
      -W<br>
      <br>
    </blockquote>
    That's why I said earlier that DRL2RIF should be possible and it can
    be a very nice work.&nbsp; However, I believe&nbsp; the result is not only
    RIF-PRD, but&nbsp; maybe a mix between RIF-PRD and RIF-BLD. Checking what
    Edson said in <a
href="http://blog.athico.com/2007/06/accumulate-functions-edson-tirelli.html">an
      old blog post about "accumulate"</a>, or in the <a
href="http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e4893">documentation</a>,
    maybe such construct is suitable to a RIF-BLD translation.&nbsp; The rule
    Edson exemplified in his post is "<span style="font-weight: bold;
      font-style: italic; color: rgb(0, 0, 153);">Rule: apply 10%
      discount to orders that include at least US$ 100,00 of toys.</span>".
    He chose a nice&nbsp; implementation using&nbsp; accumulate. Maybe there are
    other solutions which does not make use of this construct.<br>
    Salience and agenda-group are discussed in the <a
      href="http://www.w3.org/2005/rules/wiki/PRD#Groups">RIF-PRD doc</a>.
    As for no-loop is any formal evidence that this is a necessary
    construct? <br>
    <br>
    -Adrian Giurca<br>
    <br>
    <br>
    <blockquote
      cite="mid:AANLkTikVN6XLzxDCTJj2bPjSX_nVCDcL=1aVVqHVXVyE@mail.gmail.com"
      type="cite"><br>
      <div class="gmail_quote">On 10 February 2011 10:21, <span
          dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:pdl@agh.edu.pl">pdl@agh.edu.pl</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="border-left: 1px solid
          rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left:
          1ex;">
          Adrian, Wolfgang, all,<br>
          <br>
          I've had issues translating the RHS java code for instance
          (c.f. XSLT<br>
          stylesheet).<br>
          <br>
          It would be nice to have the translation protocol to/from RIF
          provided<br>
          with the specification, at least for the main rule engines.<br>
          <br>
          All the best,<br>
          Pierre<br>
          <div class="im"><br>
            On 2/10/2011 8:07 AM, Wolfgang Laun wrote:<br>
            <br>
            <br>
          </div>
          &nbsp; &nbsp;On 9 February 2011 22:11, Edson Tirelli &lt;<a
            moz-do-not-send="true" href="mailto:ed.tire...@gmail.com">ed.tire...@gmail.com</a><br>
          <div class="im">&lt;mailto:<a moz-do-not-send="true"
              href="mailto:ed.tire...@gmail.com">ed.tire...@gmail.com</a>&gt;&gt;
            wrote:<br>
            <br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pierre,<br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good to see works like yours being done.<br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Drools has an internal canonical model that we use
            to round<br>
            &nbsp; &nbsp; &nbsp; &nbsp;trip rules between the syntaxes we support. The best
            way of<br>
            &nbsp; &nbsp; &nbsp; &nbsp;supporting "RIF" in Drools is to simply add a parser
            that parses<br>
            &nbsp; &nbsp; &nbsp; &nbsp;RIF and populates the canonical model. From that we
            have a DRL<br>
            &nbsp; &nbsp; &nbsp; &nbsp;"dumper" that generates DRL, enabling the RIF-&gt;DRL
            translation.<br>
            &nbsp; &nbsp; &nbsp; &nbsp;Also, if we create a RIF "dumper", one can then
            generate RIF rules<br>
            &nbsp; &nbsp; &nbsp; &nbsp;from the canonical model, enabling DRL-&gt;RIF
            translation. That<br>
            &nbsp; &nbsp; &nbsp; &nbsp;assumes that there is a 1-to-1 semantic mapping
            between RIF and<br>
            &nbsp; &nbsp; &nbsp; &nbsp;DRL (I believe there is, but didn't checked).<br>
            <br>
            <br>
            <br>
          </div>
          <div class="im"> &nbsp; &nbsp;Do you mean that all of RIF can be
            expressed in DRL? Then I'd agree.<br>
            But you can't express all of DRL in RIF.<br>
            <br>
            &nbsp; &nbsp;-W<br>
            <br>
            <br>
            A translator RIF-PRD2DRL should be "conformant RIF-PRD
            consumer" as in the<br>
            recommendation<br>
          </div>
          &lt;<a moz-do-not-send="true"
href="http://www.w3.org/TR/2010/REC-rif-prd-20100622/#Semantics-preserving_transformations"
            target="_blank">http://www.w3.org/TR/2010/REC-rif-prd-20100622/#Semantics-preserving_transformations</a>&gt;.<br>
          <div class="im">A translator DRL2RIF-PRD should be a
            "conformant RIF-PRD producer".<br>
            <br>
            For example, a heuristic validation (test-based) may work in
            a<br>
            "round-trip" i.e. take a Drools ruleset R, do R_RIF=
            DRL2RIF-PRD(R) then<br>
            R1= RIF-PRD2DRL(R_RIF) and compare answers by running Drools
            on R and R1<br>
            <br>
            <br>
            When Wolfgang said that not all Drools constructs can
            translate to RIF-PRD<br>
            I assume he is thinking to some lets say "nonlogical" or
            "procedural"<br>
            Drools constructs. However, because RIF can encode any
            partial recursive<br>
            function, DRL2RIF should be always possible i.e. when
            translating a ruleset<br>
            from Drools, one may obtain not only PR rules but, in
            addition some RIF-BLD<br>
            rules too.<br>
            <br>
            Therefore &nbsp;I assume that there is &nbsp;very nice work to do.<br>
            <br>
            -.Adrian Giurca<br>
            <br>
            <br>
          </div>
          <div>
            <div class="h5">_______________________________________________<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 moz-do-not-send="true"
                href="https://lists.jboss.org/mailman/listinfo/rules-dev"
                target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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>
  </body>
</html>