[rules-users] error when referening LHS->exists block var in RHS

David Sinclair dsinclair at chariotsolutions.com
Tue Feb 17 16:41:08 EST 2009


Use some ordered collection, like a TreeSet. It will order them for u

On Tue, Feb 17, 2009 at 4:35 PM, techy <techluver007 at gmail.com> wrote:

>
> That's makes Edson. Thank you.
>
> Is there way to to sort the facts collected using "collect" in LHS itself?
> I
> could not find any hint in the documentation.
>
>
>
> Edson Tirelli-3 wrote:
> >
> >    That is expected behavior.
> >
> >    This is because quantifier CEs like "exists", "not" and "forall" will
> > evaluate multiple facts at once. So, if your rule has 5 foos in the
> > working
> > memory, which one would you expect to print?
> >
> >    If you want to print each of them, remove the "exists"... if you want
> > to
> > print all of them, use "collect" instead of "exists".
> >
> >    []s
> >    Edson
> >
> > 2009/2/17 techy <techluver007 at gmail.com>
> >
> >>
> >> I get $foo can't be resolved error for following rule. Some guidance is
> >> appreciated to reference $foo without error.
> >>
> >> Rule "Foo rule"
> >> when
> >>   exists( $foo: Foo())
> >> then
> >>  System.out.println($foo);
> >> end
> >>
> >> Thanks in advance.
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/error-when-referening-LHS-%3Eexists-block-var-in-RHS-tp22063253p22063253.html
> >> Sent from the drools - user mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> >
> > --
> >  Edson Tirelli
> >  JBoss Drools Core Development
> >  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
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/error-when-referening-LHS-%3Eexists-block-var-in-RHS-tp22063253p22066856.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090217/d4717ea7/attachment.html 


More information about the rules-users mailing list