[rules-dev] RIF PRD translation effort to/from Drools & Jess

Adrian Giurca giurca at tu-cottbus.de
Thu Feb 10 07:58:03 EST 2011


On 2/10/2011 11:36 AM, Wolfgang Laun wrote:
> What about these DRL CEs and CE phrases:
>    forall
>    from
>    from collect
>    from accumulate with function
>    from accumulate with init/action/result
>
> Then, some rule attributes
>    no-loop
>    agenda-group
>    salience ( <expression> )   // not a *literal* expression
>
> What about temporal operators and other CEP features?
>
> And I'm not even going to be mean and discuss plugins such as 
> user-defined evaluators
> or user-defined accumulate functions.
>
>
> 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 ;-)
>
> -W
>
That's why I said earlier that DRL2RIF should be possible and it can be 
a very nice work.  However, I believe  the result is not only RIF-PRD, 
but  maybe a mix between RIF-PRD and RIF-BLD. Checking what Edson said 
in an old blog post about "accumulate" 
<http://blog.athico.com/2007/06/accumulate-functions-edson-tirelli.html>, or 
in the documentation 
<http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e4893>, 
maybe such construct is suitable to a RIF-BLD translation.  The rule 
Edson exemplified in his post is "Rule: apply 10% discount to orders 
that include at least US$ 100,00 of toys.". He chose a nice  
implementation using  accumulate. Maybe there are other solutions which 
does not make use of this construct.
Salience and agenda-group are discussed in the RIF-PRD doc 
<http://www.w3.org/2005/rules/wiki/PRD#Groups>. As for no-loop is any 
formal evidence that this is a necessary construct?

-Adrian Giurca


>
> On 10 February 2011 10:21, <pdl at agh.edu.pl <mailto:pdl at agh.edu.pl>> wrote:
>
>     Adrian, Wolfgang, all,
>
>     I've had issues translating the RHS java code for instance (c.f. XSLT
>     stylesheet).
>
>     It would be nice to have the translation protocol to/from RIF provided
>     with the specification, at least for the main rule engines.
>
>     All the best,
>     Pierre
>
>     On 2/10/2011 8:07 AM, Wolfgang Laun wrote:
>
>
>        On 9 February 2011 22:11, Edson Tirelli <ed.tire... at gmail.com
>     <mailto:ed.tire... at gmail.com>
>     <mailto:ed.tire... at gmail.com <mailto:ed.tire... at gmail.com>>> wrote:
>
>
>               Pierre,
>
>               Good to see works like yours being done.
>
>               Drools has an internal canonical model that we use to round
>            trip rules between the syntaxes we support. The best way of
>            supporting "RIF" in Drools is to simply add a parser that
>     parses
>            RIF and populates the canonical model. From that we have a DRL
>            "dumper" that generates DRL, enabling the RIF->DRL translation.
>            Also, if we create a RIF "dumper", one can then generate
>     RIF rules
>            from the canonical model, enabling DRL->RIF translation. That
>            assumes that there is a 1-to-1 semantic mapping between RIF and
>            DRL (I believe there is, but didn't checked).
>
>
>
>        Do you mean that all of RIF can be expressed in DRL? Then I'd
>     agree.
>     But you can't express all of DRL in RIF.
>
>        -W
>
>
>     A translator RIF-PRD2DRL should be "conformant RIF-PRD consumer"
>     as in the
>     recommendation
>     <http://www.w3.org/TR/2010/REC-rif-prd-20100622/#Semantics-preserving_transformations>.
>     A translator DRL2RIF-PRD should be a "conformant RIF-PRD producer".
>
>     For example, a heuristic validation (test-based) may work in a
>     "round-trip" i.e. take a Drools ruleset R, do R_RIF=
>     DRL2RIF-PRD(R) then
>     R1= RIF-PRD2DRL(R_RIF) and compare answers by running Drools on R
>     and R1
>
>
>     When Wolfgang said that not all Drools constructs can translate to
>     RIF-PRD
>     I assume he is thinking to some lets say "nonlogical" or "procedural"
>     Drools constructs. However, because RIF can encode any partial
>     recursive
>     function, DRL2RIF should be always possible i.e. when translating
>     a ruleset
>     from Drools, one may obtain not only PR rules but, in addition
>     some RIF-BLD
>     rules too.
>
>     Therefore  I assume that there is  very nice work to do.
>
>     -.Adrian Giurca
>
>
>     _______________________________________________
>     rules-dev mailing list
>     rules-dev at lists.jboss.org <mailto:rules-dev at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110210/5ce29b1d/attachment-0001.html 


More information about the rules-dev mailing list