[rules-users] Assistance with DSL syntax

Edson Tirelli tirelli at post.com
Thu Sep 13 13:27:56 EDT 2007


    No good. This is a bug. May I ask you please to open a JIRA for it? I
will fix asap.

    Meanwhile, as a workaround, add a space before the retract call:

[consequence][]Manually release the Order=setManualRelease(drools.getRule
().getName());* retract(theOrder);*

    []s
    Edson

2007/9/13, Christopher.Mathrusse at sybase.com <
Christopher.Mathrusse at sybase.com>:
>
>
> I did make certain that my rule file had the extension of .dslr. I
> discovered this early on and realized the importance when I renamed it. Of
> course I renamed it back to .dslr once I saw the difference.
>
> The DRL preview of  my rule is as follows:
>
> *rule* "Maximum Order Amount Exceeded"
> *salience* 9800
>         *when*
>            theOrder : Order( amount >= 100000 )
>         *then*
>         theOrder.setManualRelease(drools.getRule().getName());*retract*(theOrder);
>
>
> *end*
>
>
> Thanks once again for all the help...
>
>
>
>
>  *"Edson Tirelli" <tirelli at post.com>*
> Sent by: rules-users-bounces at lists.jboss.org
>
> 09/13/2007 04:39 AM
>  Please respond to
> Rules Users List <rules-users at lists.jboss.org>
>
>   To
> "Rules Users List" <rules-users at lists.jboss.org>  cc
>
>  Subject
> Re: [rules-users] Assistance with DSL syntax
>
>
>
>
>
>
>
>    No, you need to identify which object are you trying to retract, since
> you may have multiple facts constrained in the LHS.
>
>    Regarding your problem, make sure your rules file has the extension
> ".dslr" so that eclipse selects the correct editor when opening the file.
> Then click in the DRL preview in the editor bottom tab. Can you please show
> me the result of the DRL preview?
>
>    Thanks
>     Edson
>
> 2007/9/12, *Christopher.Mathrusse at sybase.com*<Christopher.Mathrusse at sybase.com><
> * Christopher.Mathrusse at sybase.com* <Christopher.Mathrusse at sybase.com>>:
>
> I was just looking for a more "short hand" syntax, one where I would not
> need to declare *"theOrder".*
>
> On the same subject though, I compiled my rules with the DRL/DSL editors
> in Eclipse (very nice by the way) and I am getting a compilation error being
> caused by my DSL entry:
>
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());*retract(theOrder);*
>
>
> It seems that there is an issue with the *retract(theOrder);*statement.
> *
> The method retract(Order) is undefined for the type
> Rule_Maximum_Order_Amount_Exceeded_0        *
>
> Might you have any idea as to why this would be occurring or exactly what
> the message is meaning?
>
> Thanks for the help...
>
>
>
>   *"Edson Tirelli" <**tirelli at post.com* <tirelli at post.com>*>*
> Sent by: *rules-users-bounces at lists.jboss.org*<rules-users-bounces at lists.jboss.org>
>
> 09/12/2007 05:55 PM
>   Please respond to
> Rules Users List <*rules-users at lists.jboss.org*<rules-users at lists.jboss.org>
> >
>
>
>   To
> "Rules Users List" <*rules-users at lists.jboss.org*<rules-users at lists.jboss.org>
> >  cc
>
>  Subject
> Re: [rules-users] Assistance with DSL syntax
>
>
>
>
>
>
>
>
>
>  Yes, that is correct.
>  Why do you mean by a "cleaner" way?
>
>   []s
>   Edson
>
> 2007/9/12, *Christopher.Mathrusse at sybase.com *<Christopher.Mathrusse at sybase.com>
> <*Christopher.Mathrusse at sybase.com * <Christopher.Mathrusse at sybase.com>>:
>
> I'm using a DSL with my DRL file and I've read through the documentation
> but I've gotten hung-up on the syntax. Below is a rule from my DRL and the
> expansion in my DSL.
>
> My rule in the DRL: *
> rule* "Maximum Order Amount Exceeded" *
> salience* 9800
>       *when*
>                  There *is* an Order *with*
>                  - an amount that exceeds 100000
>       *then*
>               Manually release the Order
>               *
> end*
>
>
> My DSL:
> [condition][]There is an Order with=Order()
> [condition][]- an amount that exceeds {number}=amount >= {number}
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());
>
> What I would like to do is add to my consequence the following in red:
> [consequence][]Manually release the Order=setManualRelease(drools.getRule
> ().getName());*retract(theOrder);*
>
>
> I know that I would need to modify my condition statement to be able to
> use the variable *theOrder*  in my call to retract:
> [condition][]There is an Order with=*theOrder *: Order()
>
>
> but is there a cleaner way to achieve this?
>
> _______________________________________________
> rules-users mailing list*
> **rules-users at lists.jboss.org* <rules-users at lists.jboss.org> *
> **https://lists.jboss.org/mailman/listinfo/rules-users *<https://lists.jboss.org/mailman/listinfo/rules-users>
>
>
>
>
> --
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
>  JBoss, a division of Red Hat @ *www.jboss.com* <http://www.jboss.com/>
> _______________________________________________
> rules-users mailing list*
> **rules-users at lists.jboss.org* <rules-users at lists.jboss.org>*
> **https://lists.jboss.org/mailman/listinfo/rules-users*<https://lists.jboss.org/mailman/listinfo/rules-users>
>
>
> _______________________________________________
> rules-users mailing list*
> **rules-users at lists.jboss.org* <rules-users at lists.jboss.org>*
> **https://lists.jboss.org/mailman/listinfo/rules-users*<https://lists.jboss.org/mailman/listinfo/rules-users>
>
>
>
>
> --
>  Edson Tirelli
>  Software Engineer - JBoss Rules Core Developer
>  Office: +55 11 3529-6000
>  Mobile: +55 11 9287-5646
>   JBoss, a division of Red Hat @ *www.jboss.com* <http://www.jboss.com/>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070913/88fb72e1/attachment.html 


More information about the rules-users mailing list