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

Edson Tirelli tirelli at post.com
Fri Feb 20 16:22:29 EST 2009


   Temporal reasoning was added to Drools 5 as part of the Fusion module.
Not available in Drools 4.

   Regarding #2, yes, you can. When I say that you need to define "how
close" I meant Drools core does not support uncertainty reasoning out of the
box, although there are some experimental research done by Davide on that.

   []s
   Edson

2009/2/20 techy <techluver007 at gmail.com>

>
> Thanks Edson.
> 1.I use drools 4.X and. for  following condition, drools gives compilation
> error. I'm not sure what i do wrong. Some working example would help.
> "ArrayList() from collect( Ticker( price == 20.00, timeInMillsec
> before[1ms,10m] 1000000 ))"
>
> 2.If I just to want to find "close" ticker for given timestamp without
> having "how close", I can think of writing some utility function in java
> class and use it in drools. any other idea here?
>
> Thanks again!
>
>
> Edson Tirelli-3 wrote:
> >
> >       As long as you can say "how close" you want using an absolute
> > number,
> > it is possible: let's say you want all tickers that happened up to 10
> > minutes before a given timestamp:
> >
> > rule "Pseudo rule"
> > when
> >  ArrayList() from collect( Ticker( price == 20.00, timeInMillsec
> > before[1ms,10m] 1000000 ))
> > then
> > //do conseq
> > end
> >
> >     You can replace your timestamp (1000000) above with a Date variable
> or
> > something like it.
> >
> >     []s
> >     Edson
> >
> > 2009/2/17 techy <techluver007 at gmail.com>
> >
> >>
> >> I think I better more accurate info for my requirement.
> >>
> >> Is there way to get list of ( or single) Ticker that is close to given
> >> timeInMillSec and exact price value ?
> >>
> >> Class Male
> >> {
> >>  long timeInMillsec;
> >>  float price;
> >>  String symbol
> >> }
> >>
> >> rule "Pseudo rule"
> >> when
> >>  ArrayList() from collect( Ticker( price == 20.00 && timeInMillsec is
> >> close
> >> to 1000000 ))
> >> then
> >> //do conseq
> >> end
> >>
> >>
> >> Thanks.
> >>
> >>
> >> techy 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-tp22063253p22067020.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-tp22063253p22128632.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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090220/124be0f9/attachment.html 


More information about the rules-users mailing list