Re: [rules-users] Lots of org.drools.common.ScheduledAgendaItem instances in memory

2012-05-28 Thread Werner Stoop
Hi, thank you for your response.

We use Drools 5.3.1 through Maven. When I invoke Drools, for each event I
receive I do the following:

  ksession.insert(obj);
  ksession.fireAllRules();

where ksession was previously created through

  kbase = KnowledgeBaseFactory.newKnowledgeBase();
  kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
  ksession = kbase.newStatefulKnowledgeSession();

Yes, we do use timers. In one case we want to remove alarms that have been
cleared for more than an hour from the knowledgebase. We don't remove them
immediately because some alarms clear briefly and then come back. The rule
I've written to handle this situation is the following:

rule "Old Cleared Alarm?"
timer(int: 10m 10m)
salience -10
when
$a : Alarm(severity == "cleared")
then
double lastUpdate = minutesSince($a.getEventTime());
if(lastUpdate > 60) {
logger.debug("Alarm " + $a.getAlarmId() + " is old. Removing...");
retract($a);
}
end

Is there any other way to write this? I've found that I can't put the
minutesSince($a.getEventTime()) in the rule's when-clause.

Thank you,
Werner

On Tue, May 29, 2012 at 8:10 AM, Wolfgang Laun wrote:

> Just to make sure: How do you invoke the Engine? (I suppose you don't
> call with a limit for rule firings.)
>
> Unless it's a bug (BTW: your Drools version is?), it's due to one or
> more of your rules.
>
> Are you using timers? How?
>
> A detailed investigation of the whereabouts of these
> ScheduledAgendaItem objects might be done by investigating (via the
> unstable API) the Agenda and its various components.
>
> -W
>
> On 28/05/2012, Werner Stoop  wrote:
> > Hi,
> >
> > We're using Drools with a StatefulKnowledgeSession to process events
> coming
> > from equipment in our network. The system draws conclusions about the
> state
> > of the equipment and writes those conclusions to a table in our
> > database. All our rules work as we expected and the system produces the
> > correct results.
> >
> > However, the memory usage of the JVM steadily goes up when the system
> runs
> > for extended periods of time until we start getting OutOfMemoryExceptions
> > and the server has to be restarted. This is in spite of the fact that the
> > fact count reported by
> > the StatefulKnowledgeSession.getFactCount() stays reasonably stable,
> > with around 30 000 facts (give or take) at any point in time.
> >
> > I have run the Eclipse Memory Analyzer tool (http://www.eclipse.org/mat/
> )
> > against heap dumps from the JVM several times now, and every time it
> > reports more and more instances
> > of org.drools.common.ScheduledAgendaItem referenced from one instance of
> > java.lang.Object[]
> >
> > To be concrete, since this morning the uptime is more than 112 hours in
> > total, during which the system has processed little over 2 000 000 events
> > from the network. It has 29 000 facts in the knowledge session, yet in
> the
> > heap dump we see 829 632 instances of
> > org.drools.common.ScheduledAgendaItem.
> >
> > What is the ScheduledAgendaItem for? Is there something wrong with my
> rules
> > that causes this many instances to be held? Is there something I should
> do
> > to release these instances or the Object[] holding on to them?
> >
> > Thanks,
> > Werner Stoop
> >
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Fusion: expiration

2012-05-28 Thread Matteo Cusmai
So, from documentation, does the explicit expiration work when we don't use
time operator.

Thanks,

Matteo Cusmai
Il giorno 29/mag/2012 08:20, "Wolfgang Laun"  ha
scritto:

> This quote is from the current version of "Fusion":
>
> "The above example declares an expiration offset of 30 minutes for
> StockTick events. After that time, assuming no rule still needs the
> event, the engine will expire and remove the event from the session
> automatically."
>
> The catch is, as you may have noticed, the clause: "assuming no rule
> still needs the event". Whatever this means...
>
> An educated guess for interpretation for "a rule needs an event" would
> be "a partially or fully completed activation of a rule holds a
> reference to an event". But, since the author hasn't added this
> explanation, it might be something else.
>
> -W
>
>
> On 28/05/2012, Matteo Cusmai  wrote:
> > Hi all,
> > i have noticed a strange behavior, but i am not sure that i depend on
> > drools or depend by my bad knowledge of it.
> > I am using drools fusion and i have a lot of classes with role event. I
> > have put them the expiration value to 5 minutes.
> > >From my understanding, if i use explicit expiration, as i do, when it
> pass
> > 5 minutes and that event is out of scope of all my rules, that event is
> > deleted.
> > But, i noticed that the last event hasn't retracted after 5 minutes and
> > this behavior makes the system no stable, because it works differently
> > after some minutes.
> >
> > If i don't use explicit expiration, the system seems to work fine, so i
> am
> > however happy, but i would like to understand the issue.
> > Thanks a lot,
> > Matteo.
> >
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor decision tables as a storage.

2012-05-28 Thread bharadwaj2012
Hi, In guvnor u can insert or update or delete the rows same operations u
can't do it from java application rather u can retriew and display them.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-decision-tables-as-a-storage-tp4017615p4017617.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools Fusion: expiration

2012-05-28 Thread Wolfgang Laun
This quote is from the current version of "Fusion":

"The above example declares an expiration offset of 30 minutes for
StockTick events. After that time, assuming no rule still needs the
event, the engine will expire and remove the event from the session
automatically."

The catch is, as you may have noticed, the clause: "assuming no rule
still needs the event". Whatever this means...

An educated guess for interpretation for "a rule needs an event" would
be "a partially or fully completed activation of a rule holds a
reference to an event". But, since the author hasn't added this
explanation, it might be something else.

-W


On 28/05/2012, Matteo Cusmai  wrote:
> Hi all,
> i have noticed a strange behavior, but i am not sure that i depend on
> drools or depend by my bad knowledge of it.
> I am using drools fusion and i have a lot of classes with role event. I
> have put them the expiration value to 5 minutes.
> >From my understanding, if i use explicit expiration, as i do, when it pass
> 5 minutes and that event is out of scope of all my rules, that event is
> deleted.
> But, i noticed that the last event hasn't retracted after 5 minutes and
> this behavior makes the system no stable, because it works differently
> after some minutes.
>
> If i don't use explicit expiration, the system seems to work fine, so i am
> however happy, but i would like to understand the issue.
> Thanks a lot,
> Matteo.
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Guvnor decision tables as a storage.

2012-05-28 Thread Manasi
Hi,

I have a requirement where in i need to save data in guvnor decision
table(web-guided) instead of data base.

And these guvnor decision tables will act as a database tables where we can
store and retrive data rows.

Is it possible to insert data rows in guvnor deciosn table(web-guided) from
external java application?

Thanks.
Manasi.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-decision-tables-as-a-storage-tp4017615.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Lots of org.drools.common.ScheduledAgendaItem instances in memory

2012-05-28 Thread Wolfgang Laun
Just to make sure: How do you invoke the Engine? (I suppose you don't
call with a limit for rule firings.)

Unless it's a bug (BTW: your Drools version is?), it's due to one or
more of your rules.

Are you using timers? How?

A detailed investigation of the whereabouts of these
ScheduledAgendaItem objects might be done by investigating (via the
unstable API) the Agenda and its various components.

-W

On 28/05/2012, Werner Stoop  wrote:
> Hi,
>
> We're using Drools with a StatefulKnowledgeSession to process events coming
> from equipment in our network. The system draws conclusions about the state
> of the equipment and writes those conclusions to a table in our
> database. All our rules work as we expected and the system produces the
> correct results.
>
> However, the memory usage of the JVM steadily goes up when the system runs
> for extended periods of time until we start getting OutOfMemoryExceptions
> and the server has to be restarted. This is in spite of the fact that the
> fact count reported by
> the StatefulKnowledgeSession.getFactCount() stays reasonably stable,
> with around 30 000 facts (give or take) at any point in time.
>
> I have run the Eclipse Memory Analyzer tool (http://www.eclipse.org/mat/)
> against heap dumps from the JVM several times now, and every time it
> reports more and more instances
> of org.drools.common.ScheduledAgendaItem referenced from one instance of
> java.lang.Object[]
>
> To be concrete, since this morning the uptime is more than 112 hours in
> total, during which the system has processed little over 2 000 000 events
> from the network. It has 29 000 facts in the knowledge session, yet in the
> heap dump we see 829 632 instances of
> org.drools.common.ScheduledAgendaItem.
>
> What is the ScheduledAgendaItem for? Is there something wrong with my rules
> that causes this many instances to be held? Is there something I should do
> to release these instances or the Object[] holding on to them?
>
> Thanks,
> Werner Stoop
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] need help or any links customizing guvnor

2012-05-28 Thread Bharadwaj N
Refer this blog http://bharadwaj-bobby.blogspot.in/ u'll get to know how to
create rules in guvnor gui.
On Tue, May 29, 2012 at 12:29 AM, Michael Anstis
wrote:

> Do you want to add a new editor to Guvnor, or use a Guvnor editor in your
> own application?
>
>
> On 28 May 2012 19:51, Abdullah Shaikh  wrote:
>
>> Hi,
>>
>> I am new to drools & guvnor. I was able to create simple drl file and
>> run from classpath and from guvnor too using url.
>>
>> I saw that we can create rules in guvnor but I want to know if we can
>> provide UI for creating rules ? I am not sure but I think what I want
>> is guided editor ?
>>
>>
>> Thanks,
>> Abdullah
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools5.3 can't support double * int?

2012-05-28 Thread smartyang
it is a very simple pojo java class.

two method return different type numeric value can't use  symbol such as
"*","+", and so on.

a method and a constant value can work, such as a.getAge() + 2.0, and the
getAge() method return a integer.

so I resolve this problem by use 1*a.getAge() + a.getIncome(), that
expression work correctly.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools5-3-can-t-support-double-int-tp4000193p4017612.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor 5.3 Dependency with antlr 3.3 POM.XML issue.

2012-05-28 Thread ge0ffrey
Antlr is special because version 3 depende on version 2. For more info look
for the jira in our issue tracker. It works though.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-5-3-Dependency-with-antlr-3-3-POM-XML-issue-tp3968780p4017611.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] need help or any links customizing guvnor

2012-05-28 Thread Michael Anstis
Do you want to add a new editor to Guvnor, or use a Guvnor editor in your
own application?

On 28 May 2012 19:51, Abdullah Shaikh  wrote:

> Hi,
>
> I am new to drools & guvnor. I was able to create simple drl file and
> run from classpath and from guvnor too using url.
>
> I saw that we can create rules in guvnor but I want to know if we can
> provide UI for creating rules ? I am not sure but I think what I want
> is guided editor ?
>
>
> Thanks,
> Abdullah
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] need help or any links customizing guvnor

2012-05-28 Thread Abdullah Shaikh
Hi,

I am new to drools & guvnor. I was able to create simple drl file and
run from classpath and from guvnor too using url.

I saw that we can create rules in guvnor but I want to know if we can
provide UI for creating rules ? I am not sure but I think what I want
is guided editor ?


Thanks,
Abdullah
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Time Sliding Window Question

2012-05-28 Thread Wolfgang Laun
On 28 May 2012 19:30, Bernhard Unger  wrote:

> Hello Wolfgang,
>
> thanks for the answer.
> Does that mean the description on page 32 of the Drools Fusion User Guide
> is
> not correct?
>

No, but possibly easy to misunderstand.


> "...
> 2.6.1. Sliding Time Windows
> Sliding Time Windows allow the user to write rules that will only match
> events occurring in the
> last X time units.
> For instance, if the user wants to consider only the Stock Ticks that
> happened in the last 2 minutes,
> the pattern would look like this:
> StockTick() over window:time( 2m )
> Drools uses the "over" keyword to associate windows to patterns.
> ..."
>

The window:time() must be understood as something hooked on "now", as it is
understood by
the Engine, and it is evaluated once, at the time a fact/event is inserted.




> Do you know a way for my simulation to get only the latest events in
> between
> 10 minutes?
> Do I need an additional constraint for the rule?
>

Event processing in real time should either be done with an Engine being run
by a thread executing "fireUntilHalt()", which needn't ever be called, or by
calling fireAllRules() from the same thread doing the insertions.

The simple rule you posted isn't different from the same rule
without "over window:time(x)", because both are instantaneously fulfilled
due to an insert.

-W



>
> Thanks,
>
> Bernhard
>
> -Ursprüngliche Nachricht-
> Von: rules-users-boun...@lists.jboss.org
> [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun
> Gesendet: Montag, 28. Mai 2012 15:11
> An: Rules Users List
> Betreff: Re: [rules-users] Time Sliding Window Question
>
>
> Whenever you insert an event, a simple rule like
>  ruel x when Event() over window:time(x) then...end
> immediately results in an activation. Your for loop merely postpones
> firings.
>
> A selection of an event due to a window:time() is different from a
> selection due to a constraint. The latter may result in cancelling the
> activation if the fact is modified accordingly. But there's no
> reevaluation due to the passage of time.
>
> -W
>
>
> On 28/05/2012, Bernhard Unger  wrote:
> > Hello,
> >
> > I am fairly new to Drools and tried my first steps with Drools Fusion and
> > was running into the following problem:
> >
> > According to the Drools Fusion User Guide Version 5.4.0.Final on page 32
> > the
> > following pattern should work and select events in between the last 10
> > minutes:
> > ...
> > StockTick() over window:time( 2m )
> > ...
> > I tried the following example, simulating RHQ EventComposite Events with
> a
> > simple Junit test:
> >
> > ...
> > KnowledgeBuilder kbuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder();
> > kbuilder.add(new ClassPathResource("rhqrules.drl", getClass()),
> > ResourceType.DRL);
> > KnowledgeBaseConfiguration config =
> > KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> > config.setOption(EventProcessingOption.STREAM);
> > nowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
> > kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
> > KnowledgeSessionConfiguration conf =
> > KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> > conf.setOption(ClockTypeOption.get("pseudo"));
> > ksession = kbase.newStatefulKnowledgeSession(conf, null);
> > ...
> > inside the test method:
> > ...
> > For-Loop inserts new Events and increases the pseudo clock in one minute
> > steps:
> > ...
> > for (int i = 0; i < 100; i++) {
> >   timestamp = clock.advanceTime(1, TimeUnit.MINUTES);
> >   ksession.insert(new EventComposite("EventDetail" + i, resourceId,
> >   "resourceName" + i, "resourceAncestry" + i, resourceTypeId,
> >   eventId, severity, "sourceLocation" + i, timestamp));
> > }
> > ...
> > ksession.fireAllRules();
> > ...
> >
> > The .drl definition should fire only events of the last 10 minutes,
> however
> > all inserted 100 events are fired:
> > declare EventComposite
> > @role( event )
> > end
> > rule "Rule1 events in between last 10 minutes"
> > when
> >$event : EventComposite() over window:time( 10m )
> > then
> > System.out.println("Event in between the last 10 minutes:: " +
> $event);
> > end
> >
> > On the other hand this rule works as expected and selects only events
> older
> > than 10 minutes:
> >
> > rule "Rule2 events not in between the last 10 minutes"
> > when
> >   $eventA : EventComposite(  )
> >   not EventComposite( this.resourceId == $eventA.resourceId  ) over
> > window:time( 10m )
> >
> > then
> > System.out.println("Event not in between the last 10 minutes: " +
> > $eventA);
> > end
> >
> >
> > My question is:
> > What did I wrong in the definition of Rule-1, what is the correct
> statement
> > for finding the last 10 minutes events?
> >
> > Background information:
> > I am doing some research on implementing using the drools framework
> inside
> > the RHQ framework for complex event processing. I would like to show that
> > this is possible and could be uses reaso

Re: [rules-users] Time Sliding Window Question

2012-05-28 Thread Bernhard Unger
Hello Wolfgang,

thanks for the answer.
Does that mean the description on page 32 of the Drools Fusion User Guide is
not correct?
"...
2.6.1. Sliding Time Windows
Sliding Time Windows allow the user to write rules that will only match
events occurring in the
last X time units.
For instance, if the user wants to consider only the Stock Ticks that
happened in the last 2 minutes,
the pattern would look like this:
StockTick() over window:time( 2m )
Drools uses the "over" keyword to associate windows to patterns.
..."
Do you know a way for my simulation to get only the latest events in between
10 minutes?
Do I need an additional constraint for the rule?

Thanks,

Bernhard

-Ursprüngliche Nachricht-
Von: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun
Gesendet: Montag, 28. Mai 2012 15:11
An: Rules Users List
Betreff: Re: [rules-users] Time Sliding Window Question


Whenever you insert an event, a simple rule like
  ruel x when Event() over window:time(x) then...end
immediately results in an activation. Your for loop merely postpones
firings.

A selection of an event due to a window:time() is different from a
selection due to a constraint. The latter may result in cancelling the
activation if the fact is modified accordingly. But there's no
reevaluation due to the passage of time.

-W


On 28/05/2012, Bernhard Unger  wrote:
> Hello,
>
> I am fairly new to Drools and tried my first steps with Drools Fusion and
> was running into the following problem:
>
> According to the Drools Fusion User Guide Version 5.4.0.Final on page 32
> the
> following pattern should work and select events in between the last 10
> minutes:
> ...
> StockTick() over window:time( 2m )
> ...
> I tried the following example, simulating RHQ EventComposite Events with a
> simple Junit test:
>
> ...
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add(new ClassPathResource("rhqrules.drl", getClass()),
> ResourceType.DRL);
> KnowledgeBaseConfiguration config =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> config.setOption(EventProcessingOption.STREAM);
> nowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
> kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
> KnowledgeSessionConfiguration conf =
> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> conf.setOption(ClockTypeOption.get("pseudo"));
> ksession = kbase.newStatefulKnowledgeSession(conf, null);
> ...
> inside the test method:
> ...
> For-Loop inserts new Events and increases the pseudo clock in one minute
> steps:
> ...
> for (int i = 0; i < 100; i++) {
>   timestamp = clock.advanceTime(1, TimeUnit.MINUTES);
>   ksession.insert(new EventComposite("EventDetail" + i, resourceId,
>   "resourceName" + i, "resourceAncestry" + i, resourceTypeId,
>   eventId, severity, "sourceLocation" + i, timestamp));
> }
> ...
> ksession.fireAllRules();
> ...
>
> The .drl definition should fire only events of the last 10 minutes,
however
> all inserted 100 events are fired:
> declare EventComposite
> @role( event )
> end
> rule "Rule1 events in between last 10 minutes"
> when
>$event : EventComposite() over window:time( 10m )
> then
> System.out.println("Event in between the last 10 minutes:: " +
$event);
> end
>
> On the other hand this rule works as expected and selects only events
older
> than 10 minutes:
>
> rule "Rule2 events not in between the last 10 minutes"
> when
>   $eventA : EventComposite(  )
>   not EventComposite( this.resourceId == $eventA.resourceId  ) over
> window:time( 10m )
>   
> then
> System.out.println("Event not in between the last 10 minutes: " +
> $eventA);
> end
>
>
> My question is:
> What did I wrong in the definition of Rule-1, what is the correct
statement
> for finding the last 10 minutes events?
>
> Background information:
> I am doing some research on implementing using the drools framework inside
> the RHQ framework for complex event processing. I would like to show that
> this is possible and could be uses reasonable for RHQ event processing.
>
> Any help is highly appreceated!
>
> Thanks and kind regards
>
> Bernhard
>
>
>
>
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Prevent saving the resource when using guvnorEditorObjRef, in case if validation fails.

2012-05-28 Thread worldofprasanna
Thanks Esteban for the info. And yes, I will log a feature request ... 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Prevent-saving-the-resource-when-using-guvnorEditorObjRef-in-case-if-validation-fails-tp4017580p4017605.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Getting error in my Decision Table

2012-05-28 Thread zeeshan
Thanks Mike n Bharadwaj...its working now..I gave 6,99...

--
View this message in context: 
http://drools.46999.n3.nabble.com/Getting-error-in-my-Decision-Table-tp4017588p4017604.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] KnowledgeAgent dispose - KnowledgeBase dispose

2012-05-28 Thread bharadwaj2012
You just use kSession.dispose(); 

--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeAgent-dispose-KnowledgeBase-dispose-tp3931731p4017603.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Can Drools be used with Stand Alone Java application

2012-05-28 Thread bharadwaj2012
Yes, you can do it by stand alone for that u need to create manual drl's and
decision tables and execute them via java code.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Can-Drools-be-used-with-Stand-Alone-Java-application-tp3943666p4017602.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Data type and Date format vlidation

2012-05-28 Thread bharadwaj2012
This u can do it from front end or java code it's self why do want to do in
drool file?
 coz that is easy and looks good.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Data-type-and-Date-format-vlidation-tp3950113p4017600.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools Fusion: expiration

2012-05-28 Thread Matteo Cusmai
Hi all,
i have noticed a strange behavior, but i am not sure that i depend on
drools or depend by my bad knowledge of it.
I am using drools fusion and i have a lot of classes with role event. I
have put them the expiration value to 5 minutes.
>From my understanding, if i use explicit expiration, as i do, when it pass
5 minutes and that event is out of scope of all my rules, that event is
deleted.
But, i noticed that the last event hasn't retracted after 5 minutes and
this behavior makes the system no stable, because it works differently
after some minutes.

If i don't use explicit expiration, the system seems to work fine, so i am
however happy, but i would like to understand the issue.
Thanks a lot,
Matteo.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Time Sliding Window Question

2012-05-28 Thread Wolfgang Laun
Whenever you insert an event, a simple rule like
  ruel x when Event() over window:time(x) then...end
immediately results in an activation. Your for loop merely postpones firings.

A selection of an event due to a window:time() is different from a
selection due to a constraint. The latter may result in cancelling the
activation if the fact is modified accordingly. But there's no
reevaluation due to the passage of time.

-W


On 28/05/2012, Bernhard Unger  wrote:
> Hello,
>
> I am fairly new to Drools and tried my first steps with Drools Fusion and
> was running into the following problem:
>
> According to the Drools Fusion User Guide Version 5.4.0.Final on page 32
> the
> following pattern should work and select events in between the last 10
> minutes:
> ...
> StockTick() over window:time( 2m )
> ...
> I tried the following example, simulating RHQ EventComposite Events with a
> simple Junit test:
>
> ...
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add(new ClassPathResource("rhqrules.drl", getClass()),
> ResourceType.DRL);
> KnowledgeBaseConfiguration config =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> config.setOption(EventProcessingOption.STREAM);
> nowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
> kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
> KnowledgeSessionConfiguration conf =
> KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
> conf.setOption(ClockTypeOption.get("pseudo"));
> ksession = kbase.newStatefulKnowledgeSession(conf, null);
> ...
> inside the test method:
> ...
> For-Loop inserts new Events and increases the pseudo clock in one minute
> steps:
> ...
> for (int i = 0; i < 100; i++) {
>   timestamp = clock.advanceTime(1, TimeUnit.MINUTES);
>   ksession.insert(new EventComposite("EventDetail" + i, resourceId,
>   "resourceName" + i, "resourceAncestry" + i, resourceTypeId,
>   eventId, severity, "sourceLocation" + i, timestamp));
> }
> ...
> ksession.fireAllRules();
> ...
>
> The .drl definition should fire only events of the last 10 minutes, however
> all inserted 100 events are fired:
> declare EventComposite
> @role( event )
> end
> rule "Rule1 events in between last 10 minutes"
> when
>$event : EventComposite() over window:time( 10m )
> then
> System.out.println("Event in between the last 10 minutes:: " + $event);
> end
>
> On the other hand this rule works as expected and selects only events older
> than 10 minutes:
>
> rule "Rule2 events not in between the last 10 minutes"
> when
>   $eventA : EventComposite(  )
>   not EventComposite( this.resourceId == $eventA.resourceId  ) over
> window:time( 10m )
>   
> then
> System.out.println("Event not in between the last 10 minutes: " +
> $eventA);
> end
>
>
> My question is:
> What did I wrong in the definition of Rule-1, what is the correct statement
> for finding the last 10 minutes events?
>
> Background information:
> I am doing some research on implementing using the drools framework inside
> the RHQ framework for complex event processing. I would like to show that
> this is possible and could be uses reasonable for RHQ event processing.
>
> Any help is highly appreceated!
>
> Thanks and kind regards
>
> Bernhard
>
>
>
>
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] NullPointerException while loading pkg by KnowledgeAgent

2012-05-28 Thread bharadwaj2012
can u share chageset.xml

--
View this message in context: 
http://drools.46999.n3.nabble.com/NullPointerException-while-loading-pkg-by-KnowledgeAgent-tp3959482p4017598.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor 5.3 Dependency with antlr 3.3 POM.XML issue.

2012-05-28 Thread bharadwaj2012
Add dependency antlr3.3 to your pom ,if u have already  older version of
antlr in your pom just remove it.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-5-3-Dependency-with-antlr-3-3-POM-XML-issue-tp3968780p4017597.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Hi people im a drools newbie i get this error trying to run the hello world example plz help

2012-05-28 Thread bharadwaj2012
This usually indicates incompatible versions of two libraries. Get the most
up-to-date jars of drools and try again. Also make sure you don't have
multiple versions on the classpath

--
View this message in context: 
http://drools.46999.n3.nabble.com/Hi-people-im-a-drools-newbie-i-get-this-error-trying-to-run-the-hello-world-example-plz-help-tp3977393p4017596.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to set drools.dialect.mvel.strict = on Guvnor concole

2012-05-28 Thread bharadwaj2012
This drools.dialect.mvel.strict mode on or off u can do it from java code
only and u can't chage it in guvnor

drools.dialect.mvel.strict set this method to false. in java code

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-set-drools-dialect-mvel-strict-true-false-on-Guvnor-concole-tp3969067p4017595.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Getting error in my Decision Table

2012-05-28 Thread bharadwaj2012
I could see first codition says policyYear == $param (here in this case it
will accept only numaric values)
but u r trying to pass value as [6;99] which throws u an exception.
Remove the values and give in numeric.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Getting-error-in-my-Decision-Table-tp4017588p4017594.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Changing rules at runtime through a GUI

2012-05-28 Thread bharadwaj2012
For those operations u can use guvnor gui,no need to go for another tool.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Changing-rules-at-runtime-through-a-GUI-tp3999690p4017591.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Getting error in my Decision Table

2012-05-28 Thread Michael Anstis
It's because rows 31-34 contain "[6;99]" whereas your condition just shows
"policyYear == $param" so you're getting DRL like "Commission( policyTear
== [6;99] )"

On 28 May 2012 13:27, zeeshan  wrote:

> Hi !
>
> I am getting error in my decision tableplease verify it...I am
> attaching
> my file http://drools.46999.n3.nabble.com/file/n4017588/111.png
> http://drools.46999.n3.nabble.com/file/n4017588/Distribution_Cost.xls
> Distribution_Cost.xls
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Getting-error-in-my-Decision-Table-tp4017588.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools5.3 can't support double * int?

2012-05-28 Thread bharadwaj2012
Can share code  ur drl file and test class that going to execite drl file.so
that it would be very easy to trace it out.

Here u r getting nullpointer exception when u trying to get some value from
getter method 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools5-3-can-t-support-double-int-tp4000193p4017589.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Getting error in my Decision Table

2012-05-28 Thread zeeshan
Hi !

I am getting error in my decision tableplease verify it...I am attaching
my file http://drools.46999.n3.nabble.com/file/n4017588/111.png 
http://drools.46999.n3.nabble.com/file/n4017588/Distribution_Cost.xls
Distribution_Cost.xls 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Getting-error-in-my-Decision-Table-tp4017588.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule flow on two package

2012-05-28 Thread bharadwaj2012
Yes, U can do that navigate to the rule flow file which u want to set it as
global.
Go to Edit- choose option called "promote to global"

--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-flow-on-two-package-tp3998808p4017587.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] who can help me solve the http 401 error

2012-05-28 Thread bharadwaj2012
First let me see you code how u r accessing the binary file url.

Here i could see u r missing something ResourceFactory.newUrlResource(Uri
uri) after this u have to pass one more param like type as "package"

--
View this message in context: 
http://drools.46999.n3.nabble.com/who-can-help-me-solve-the-http-401-error-tp4006186p4017586.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] strict-mode and nested object property access in drools 5.4.0.Final - can i cast?

2012-05-28 Thread radai rosenblatt
doh.
thank you very much lhorton and Wolfgang.

--
View this message in context: 
http://drools.46999.n3.nabble.com/strict-mode-and-nested-object-property-access-in-drools-5-4-0-Final-can-i-cast-tp4013373p4017584.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Time Sliding Window Question

2012-05-28 Thread Bernhard Unger
Hello,

I am fairly new to Drools and tried my first steps with Drools Fusion and
was running into the following problem:

According to the Drools Fusion User Guide Version 5.4.0.Final on page 32 the
following pattern should work and select events in between the last 10
minutes:
...
StockTick() over window:time( 2m )
...
I tried the following example, simulating RHQ EventComposite Events with a
simple Junit test:

...
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(new ClassPathResource("rhqrules.drl", getClass()),
ResourceType.DRL);
KnowledgeBaseConfiguration config =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);
nowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
KnowledgeSessionConfiguration conf =
KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
conf.setOption(ClockTypeOption.get("pseudo"));
ksession = kbase.newStatefulKnowledgeSession(conf, null);
...
inside the test method:
...
For-Loop inserts new Events and increases the pseudo clock in one minute
steps:
...
for (int i = 0; i < 100; i++) {
  timestamp = clock.advanceTime(1, TimeUnit.MINUTES);
  ksession.insert(new EventComposite("EventDetail" + i, resourceId,
  "resourceName" + i, "resourceAncestry" + i, resourceTypeId,
  eventId, severity, "sourceLocation" + i, timestamp));
}
...
ksession.fireAllRules();
...

The .drl definition should fire only events of the last 10 minutes, however
all inserted 100 events are fired:
declare EventComposite
@role( event )
end
rule "Rule1 events in between last 10 minutes"
when
   $event : EventComposite() over window:time( 10m ) 
then
System.out.println("Event in between the last 10 minutes:: " + $event);
end

On the other hand this rule works as expected and selects only events older
than 10 minutes:

rule "Rule2 events not in between the last 10 minutes"
when
$eventA : EventComposite(  ) 
not EventComposite( this.resourceId == $eventA.resourceId  ) over
window:time( 10m )

then
System.out.println("Event not in between the last 10 minutes: " +
$eventA);
end


My question is:
What did I wrong in the definition of Rule-1, what is the correct statement
for finding the last 10 minutes events?

Background information:
I am doing some research on implementing using the drools framework inside
the RHQ framework for complex event processing. I would like to show that
this is possible and could be uses reasonable for RHQ event processing.

Any help is highly appreceated!

Thanks and kind regards 

Bernhard





 


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Lots of org.drools.common.ScheduledAgendaItem instances in memory

2012-05-28 Thread Werner Stoop
Hi,

We're using Drools with a StatefulKnowledgeSession to process events coming
from equipment in our network. The system draws conclusions about the state
of the equipment and writes those conclusions to a table in our
database. All our rules work as we expected and the system produces the
correct results.

However, the memory usage of the JVM steadily goes up when the system runs
for extended periods of time until we start getting OutOfMemoryExceptions
and the server has to be restarted. This is in spite of the fact that the
fact count reported by
the StatefulKnowledgeSession.getFactCount() stays reasonably stable,
with around 30 000 facts (give or take) at any point in time.

I have run the Eclipse Memory Analyzer tool (http://www.eclipse.org/mat/)
against heap dumps from the JVM several times now, and every time it
reports more and more instances
of org.drools.common.ScheduledAgendaItem referenced from one instance of
java.lang.Object[]

To be concrete, since this morning the uptime is more than 112 hours in
total, during which the system has processed little over 2 000 000 events
from the network. It has 29 000 facts in the knowledge session, yet in the
heap dump we see 829 632 instances of org.drools.common.ScheduledAgendaItem.

What is the ScheduledAgendaItem for? Is there something wrong with my rules
that causes this many instances to be held? Is there something I should do
to release these instances or the Object[] holding on to them?

Thanks,
Werner Stoop
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Prevent saving the resource when using guvnorEditorObjRef, in case if validation fails.

2012-05-28 Thread Esteban Aliverti
AFAIK, there is no way to do what you have described.
Feel free to file a new feature request in jira about this.

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Mon, May 28, 2012 at 8:44 AM, worldofprasanna
wrote:

> Hi All,
>
> We have embedded the Guvnor decision table asset into our html page and
> obtained the guvnorEditorObjRef to validate the new rule which is added. We
> wrote our business logic within the function,
>
> guvnorEditorObjRef.registerBeforeSaveAllButtonCallbackFunction()
>
>
> And it works fine. But the problem is when we find the business validation
> got failed, we couldn t stop the resource from saving. Check In dialog box
> opens and we couldn t find a way to prevent it from saving.
>
> Is there anyway to prevent the asset from Saving in case, if the validation
> failed ?
>
> Thanks,
> Prasanna Venkataraman.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Prevent-saving-the-resource-when-using-guvnorEditorObjRef-in-case-if-validation-fails-tp4017580.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users