[rules-users] Declaring events programmatically

Wolfgang Laun wolfgang.laun at gmail.com
Tue Oct 26 04:00:33 EDT 2010


On 26 October 2010 09:33, Samuli Saarinen <samuli.saarinen at remion.com> wrote:
>
> OK, just wanted to make sure.
>
> Is my understanding correct that if I want to use temporal constraints
> in some rules I can declare a fact as an event but I can still use it as
> a plain fact in other rules?

Certainly, an Event is nothing but a POJO with additional fields in
the EventHandle wrapping it.

>
> From what I understand after reading the
> documentation is that the event declaration applies to the whole
> knowledge base?

Yes, but htis shouldn't matter, except for automatic Event retraction.
Please read
   2.8. Memory Management for Events
in the Fusion manual.

-W



>
> Cheers,
>
> Samuli
>
>
> On 26.10.2010 10:14, Wolfgang Laun wrote:
> > This only makes sense if your rules use constraints with temporal operators,
> > so you'll have to know at "rule writing time". So, I don't quite see why
> > you'd
> > want or need to do that.
> >
> > The information from a declare is stored by the compiler; this API (even if
> > exposed) would not help you, as you'd have to access it during the
> > compilation,
> > or do all that what needs to be done while compiling a declare. Creating a
> > text and compiling this as a .DRL is much simpler.
> >
> > -W
> >
> > On 26 October 2010 09:07, Samuli Saarinen <samuli.saarinen at remion.com
> > <mailto:samuli.saarinen at remion.com>> wrote:
> >
> >     Hi,
> >
> >     I'm aware of that but was looking for a way to do it using some API. I
> >     am inserting some objects to the engine and would like to declare them
> >     as events "automatically" before inserting. I could generate the snippet
> >     shown in the doc and add it to the knowledge base but was wondering if
> >     the same thing could be accomplished using existing API.
> >
> >     Cheers,
> >
> >     Samuli
> >
> >     On 26.10.2010 9:51, Greg Barton wrote:
> >      >
> >     http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-fusion/html/ch02.html#d0e241
> >      >
> >      > Use type declaration and @role(event)
> >      >
> >      > --- On Tue, 10/26/10, Samuli Saarinen<samuli.saarinen at remion.com
> >     <mailto:samuli.saarinen at remion.com>>  wrote:
> >      >>
> >      >> I'm looking for a way to declare facts as events using an
> >      >> API. Would
> >      >> anyone happen to know if such an API exists in drools?
> >      >>
> >      >> Cheers,
> >      >>
> >      >> Samuli
> >
> >
> >
> >
> >     --
> >     Remion Oy           Etävalvontajärjestelmät liiketoiminnan
> >     Samuli Saarinen           tehostamiseen
> >     gsm +358 (0)50 3560075
> >     fax +358 (0)3 2125064 www.remion.com <http://www.remion.com>
> >     _______________________________________________
> >     rules-users mailing list
> >     rules-users at lists.jboss.org <mailto: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
>
>
>
> --
> Remion Oy           Etävalvontajärjestelmät liiketoiminnan
> Samuli Saarinen           tehostamiseen
> gsm +358 (0)50 3560075
> fax +358 (0)3 2125064       www.remion.com
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list