[rules-users] RHS

Edson Tirelli tirelli at post.com
Fri Apr 6 09:59:49 EDT 2007


   Is there a Role object asserted into your working memory?

   Remember that adding the Role pattern to your rule will make your rule
fire once for each Role object. If you don't have any role object, the rule
obviously will not fire.

   []s
   Edson



2007/4/5, fakhfakh ismail <ismail_info2005 at yahoo.fr>:
>
> Hello,
> when I run the code
>
> rule "sample1"
> when
>
>        $P: User( $nam : name, userId == "10", email matches ".*@yahoo.fr")
>        $role :Role($name : name, $users: users)
> then
>        System.out.println($P.getname());
>     end
>
> there 's nothing affiched the portion RHS didn't execute
>
> but when I remove
> $role :Role($name : name, $users: users)
>
> the result waited is affiched
> but I don't remove it and I want the portion RHS execute
>
>
>
> *Marko Frankovic <paparapap at gmail.com>* a écrit :
>
> Try this out : http://sourceforge.net/projects/droolsruleedit . It's in
> early development stage, but it might help you.
>
> On 4/5/07, John.Tal at gxs.com <John.Tal at gxs.com> wrote:
> >
> > Drools developers,
> >
> > In our specific use case we have customers who need to be able to write
> > validation rules and NOT have to resort to writing them in Java.  Hence our
> > interest in using drools as an open source 'standard' to potentially replace
> > a proprietary rules engine we already have.
> >
> > In the previous case I mentioned where I want to do this:
> >
> > > *rule* "UCCnet_DVE_Depth_All"
> > >       *when*
> > >         catalogObject : CatalogObject( )
> > >         String s = catalogObject.getElementValue("depth");
> > >         *eval*( s == *null* || s == "" )
> > >       *then*
> > >             logWriter.logDebug("Package Depth is Blank");
> > > *end*
> >
> > This is because potentially, in our use for data validation, there might
> > be 50 values we need to compare against.  Those values need to be on the
> > drools (not java) side of the world.  So getting the result of
> > catalogObject.getElementValue("depth") into a String variable and being
> > able to use String methods like indexOf or multiple || cases is much more
> > desirable than crossing from the rule back into the object by having to call
> > getElementValue 50 times.  There are numerous, other cases, where the result
> > of catalogObject.getElementValue need to be saved into a local drools
> > variable and evaluated multiple times without encurring the overhead of
> > multiple calls back into java.
> >
> > Please consider enhancing drl syntax to support this use case.  Is there
> > a bug/enhancement process for me to follow to submit this functionality
> > request.
> >
> > Thanks
> >
> > John
> >
> >
> >
> >
> > Date: Thu, 5 Apr 2007 16:47:07 +1000
> > From: "Michael Neale" < michael.neale at gmail.com>
> > Subject: Re: [rules-users] RE: Need DRL authoring Help
> > To: "Rules Users List" < rules-users at lists.jboss.org>
> > Message-ID:
> >       < 96ab3ced0704042347s130a4b46ma4a5b74fb45ef0d4 at mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > OK you are really bending what you would use rules for, I really
> > wouldn't recommend that. flattening the object model would allow you to
> > write rules over it, but as it stands, its just going to be a bit difficult
> > for you.
> >
> >         catalogObject : CatalogObject( )
> >
> >         *eval*( catalogObject.getElementValue("depth") == *null* ||
> > catalogObject.getElementValue ("depth") == "" )
> >
> > On 4/5/07, John.Tal at gxs.com <John.Tal at gxs.com> wrote:
> > >
> > >  Ok,  Thanks for the help on the drl syntax.
> > >
> > > So this works.
> > >
> > > *rule* "UCCnet_DVE_Depth_All"
> > >       *when*
> > >         catalogObject : CatalogObject( )
> > >         *eval*( catalogObject.getElementValue("depth") == *null* ||
> > > catalogObject.getElementValue("depth") == "" )
> > >       *then*
> > >             logWriter.logDebug("Package Depth is Blank");
> > > *end*
> > >
> > > But how do I get the drl parser to accept something like this:
> > >
> > > *rule* "UCCnet_DVE_Depth_All"
> > >       *when*
> > >         catalogObject : CatalogObject( )
> > >         String s = catalogObject.getElementValue("depth");
> > >         *eval*( s == *null* || s == "" )
> > >       *then*
> > >             logWriter.logDebug("Package Depth is Blank");
> > > *end*
> > >
> > > I am getting an Unexpected token 's'  InvalidRulePackage
> >
> >
> > _______________________________________________
> > 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
>
>
> ------------------------------
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions
> ! Profitez des connaissances, des opinions et des expériences des
> internautes sur Yahoo! Questions/Réponses<http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com>
> .
>
>
> _______________________________________________
> 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 3124-6000
  Mobile: +55 11 9218-4151
  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/20070406/5d850a18/attachment.html 


More information about the rules-users mailing list