[rules-users] Adding constraints to facts in DSL

stephane.remillieux at agysoft.fr stephane.remillieux at agysoft.fr
Fri Sep 21 08:30:10 EDT 2007



  Hi,

I have seen the ticket in JIRA. But to be sure to be understood,  I
give an other example.

I would find a way to write this DRL code :

  Person( age ( (> 30 && < 40) || (> 20 && < 25) ),name == 'DOE' )

In DSL code like this :

  There is a Person with

  ((- age is less than 40
     - age is more than 30)
     or
      (- age is more than 20
     - age is less than 25))
     - name is 'DOE'

Thanks andy for the ticket post :)

Stephane

  Andy Mei <andy.d.mei at gmail.com> a écrit :

> Ok, i took the liberty and created a ticket for this.
>
> http://jira.jboss.com/jira/browse/JBRULES-1186
>
>
> On 9/12/07, Edson Tirelli <tirelli at post.com> wrote:
>>
>>
>>     All,
>>
>>     This is a limitation of the current DSL engine implementation.
The
>> problem is not really the "or", but the "-" implementation. The
LHS and RHS
>> of a DSL rule are processed line by line, so, to allow the
behavior you are
>> requesting, we will need to implement some look ahead mechanism
with smart
>> interpolation that does not exist today.
>>     I'm not sure if someone already opened a ticket for that, but
in case
>> not, may I ask you please to open? We will look into supporting
that in the
>> future.
>>
>>     []s
>>     Edson
>>
>>
>> 2007/9/12, Andy Mei <andy.d.mei at gmail.com>:
>> >
>> > I am having the same problem as Stephane does.
>> >
>> > It's pretty bad if I need to hard code the 'or' constraint
within a
>> > single DSL constraint.  I guess I could split a complex OR
constraint to
>> > multiple rules with the same consequences, it just an ugly
hack. 
>> Also, how
>> > does this work if we need a Or constraint within another group
constraint?
>> >
>> > I just don't understand why the following doesn't work.
>> >
>> > [condition][]There is a Cheese with=Cheese()
>> > [condition][]- age is less than {low} =age < {low}
>> > [condition][]Or=or
>> > [condition][]- age is more than {high}=age > {high}
>> >
>> > On 9/11/07, stephane.remillieux at agysoft.fr <
>> > stephane.remillieux at agysoft.fr> wrote:
>> >
>> > >  Hi Vincent,
>> > >
>> > > Thanks for your answer but I would really like to use my
synthax.
>> > >
>> > > I need to write "or" between 2 constraints and not in a single
complex
>> > > constraint.
>> > >
>> > > If someone else could help me ...
>> > >
>> > > DELBART Vincent <delbart.v at mipih.fr> a écrit :
>> > >
>> > >
>> > > > Hello Stephane,
>> > > >
>> > > > I think it's difficult to do that. Could you try this :
>> > > > There is a Cheese with
>> > > >        - age is less than 42 or age is more than 60
>> > > >        - type is 'stilton'
>> > > > with in your DSL
>> > > > [condition][]There is a Cheese with=Cheese()
>> > > > [condition][]- age is less than {low} or age is more than
{high}=age
>> > >
>> > > > < {low} || age > {high}
>> > > > [condition][]- type is '{type}'=type == "{type}"
>> > > >
>> > > > I don't see other solution...
>> > > >
>> > > > vdelbart
>> > > >
>> > > >
>> > > >
>> > > > ________________________________
>> > > >
>> > > > De : rules-users-bounces at lists.jboss.org
>> > > > [mailto:rules-users-bounces at lists.jboss.org] De la part de
>> > > > stephane.remillieux at agysoft.fr
>> > > > Envoyé : mardi 11 septembre 2007 10:16
>> > > > À : rules-users at lists.jboss.org
>> > > > Objet : [rules-users] Adding constraints to facts in DSL
>> > > >
>> > > >
>> > > >
>> > > > Hello,
>> > > >
>> > > > I'm using JBossDrools in my company and I have some problems
with
>> > > DSL.
>> > > >
>> > > > Actually, I would like to write something like this :
>> > > >
>> > > > There is a Cheese with
>> > > >        ( - age is less
>> > > > than 42
>> > > >                 or
>> > > >         -  age is more than 60 )
>> > > >        - type is
>> > > > 'stilton'
>> > > >
>> > > > Unfortunately, It's the drools parser which manage "-" char.
>> > > >
>> > > > Also this previous synthax don't work in the LHS.
>> > > >
>> > > > Anyone could help me to do an equivalent condition in my DSL
? If
>> > > > possible with "-" sugar char.
>> > > >
>> > > > Stephane.
>> > > >
>> > > > PS : Sorry, for my very bad english.
>> > > >
>> > > >
>> > > >
----------------------------------------------------------------
>> > > > This message was sent using IMP, the Internet Messaging
Program.
>> > > >
>> > > >
>> > >
>> > >
>> > >
>> > >
----------------------------------------------------------------
>> > > This message was sent using IMP, the Internet Messaging
Program.
>> > >
>> > > _______________________________________________
>> > > 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
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070921/0daa05ac/attachment.html 


More information about the rules-users mailing list