sliding window problems
by will_lauer
(reposting to a more appropriate list)
I'm starting to expirament with Drools and Drools Fusion and am running into
some problems using sliding windows. I'm using Drools 5.1.1 with a fairly
simple configuration. I have one rule:
package net.wlauer.DroolsEngine
import net.wlauer.DroolsEngine.Event
import java.util.ArrayList
declare Event
@role(event)
@expires(30s)
end
rule TestWindow
when
$up : Event (type == "linkup", $inf : extra)
$window : ArrayList () from collect (
Event (extra == $inf) over window:length(2))
$down : Event (type == "linkdown", this before $up) from
$window
then
channels["up"].send($up);
end
I expect this rule to fire whenever it sees a "linkup" event immediately
after a "linkdown" event for the same value of extra. (If you can suggest a
better way to write this, I would appreciate it). My sample program simply
inserts four Events, calling fireAllRules once all the inserts have been
completed.
What I'm seeing instead of my expected results is the exception:
Exception in thread "main" java.lang.ClassCastException:
org.drools.common.DefaultFactHandle cannot be cast to
org.drools.common.EventFactHandle
at
org.drools.base.evaluators.BeforeEvaluatorDefinition$BeforeEvaluator.evaluateCachedLeft(BeforeEvaluatorDefinition.java:333)
at
org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:110)
at
org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:115)
at
org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:142)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:274)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:138)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:64)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:662)
at
org.drools.reteoo.AccumulateNode.assertLeftTuple(AccumulateNode.java:181)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:138)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:148)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:368)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)
at
net.wlauer.DroolsEngine.NonSpringRulesEngine.main(NonSpringRulesEngine.java:71)
>From scanning the list, it looks like this implies that a non-event fact is
being treated as an event-type fact, but I don't see where that could be
happening. Am I doing something obviously wrong? I've tried marking
ArrayList as an event type, but that didn't change the behavior.
Any insight you can give me would be appreciated.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/sliding-window-proble...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Is it possible to use CEP features in Guvnor?
by John Peterson
I was wondering if it was possible to leverage the CEP features in
Guvnor. I am not sure how we'd set the "@role(event)" in Guvnor or
putting the "entry-point" in the rule unless you use DSL (embedding it
in the translation) or doing technical rules.
14 years, 2 months
Task persistence problem
by fuankarion
Hi, I'm not sure if this is the best place to ask this, I'll give it a try.
I'm building an application with drools, one of the features is that it
should keep a “TODO List”, this is given by the human tasks contained in
ruleflows, I've managed to set up drools persistence for workflows
kwnoeledge sessions and humans tasks (tricky but i got it working), however
it seems that I'm still missing something, when I try to start a workflow
with 2 human tasks and a script tasks, arranged like this
start >> human task 1 >> script task >> human tasks 2 >> end
its behavior is irregular.
A first review of this problem got me to the conclusion that the ruleflow
fails to register (with mina) the second human task about half the times
(first one is allways a success), interesting is that if you start the
ruleflow several times it shows a “pattern”, it registers the task once then
it does not, then it registers the task again and so on.
When it is unable to register the second task I don't get any exception
report (on the web interface) however after looking at the server logs I
found that every time the ruleflow fails to register the second task an
exception is thrown, it is
java.lang.IllegalArgumentException: attempt to create merge event
with null entity
followed by a
java.lang.NullPointerException
(I can provide the full stack trace or the log output of drools if you need
them, I'm trying to keep this post as readable as possible)
Digging deeper in this situation I noticed that some weird values are
getting inserted on the column workItemId on table Task (which I guess is
mapped from org.drools.task.Task), and sometimes the value 0 gets inserted
in this column (this colums right now looks looks like 22,0,24,25,0), so my
guess is that the human task is actually getting registered to mina but, it
is not registered in a “proper way” and those 0s are a sign of it.
Has any one any idea of what might be happening (what I might be missing),
any help will be appreciated.
By the way
I'm using drools 5.1
The database is a mysql database.
The persistence of the workflows and tasks is done in the same mysql server
but in different databases.
I'm using mina as task server and task client on the default port.
This whole thing is running inside a jboss 5.1 server on jdk 1.5.
I can provide more implementation details, logs or code if necessary
Thanks in advance
Fuanka
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Task-persistence-prob...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Re: [rules-users] Upating drl file without restarting the application
by devyani.sapre@wipro.com
Hi, I am using Drools version 4.x .
Also I am looking for an approach where manual updations to the .drl
file are
reflected in the application without restarting.
Thanks
Devyani
________________________________
From: DEVYANI SAPRE (WT01 - GMT-Global Comm Service Provider)
Sent: Monday, October 11, 2010 7:18 PM
To: 'rules-users(a)lists.jboss.org'
Subject: Upating drl file without restarting the application
Hi
How to achieve dynamic updation of rule file
(rules-added/deleted/modified) without the need for the application to
be restarted so as to load the rule file? Is there any property that can
be set to achieve this or do I need to run a thread to continuously
monitor the rule file for any change?
Thanks
Devyani
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
14 years, 2 months
Check if fact is subset of items in the rule
by Kumar Pandey
Posting a new thread for this specific problem that has been a head
scratcher for me for days now.
Here is the problem space.
I have a rule that can have a superset of elements such as say "String1",
"String2", "String3" , "String4". These are known in rule creation time.
Fact can have subset say "String1", "String4"
How can I form a drl to check to verify that fact is a subset of elements in
the rule?
I need to not fire the rule if fact is a subset but I should be able to add
a not if I can first figure out if it is a sub set.
Any help would be greatly appreciated.
Thanks
Kumar
14 years, 2 months
Get rid of redundant conditions in combined rules.
by Dominik Hüttner
Hello everyone,
Ive got a question. Im using drools-guvnor to execute some rule-scenarios.
I have to solve the following problem: I have an amount of objects in my
working memory and cant remove objects from the working memory in the
then-part of the rule. I want to combine two rules, the first rule selects
some objects and the second rule checks only these selected objects for
additional criteria. I have to use two rules, because I want to report the
objects selected in the first rule, too. Now I have implemented this with
two rules and in the second rule, the criterias of the first rule are copied
to the second rule, my question is, is there a way to get rid of this
redundandance?
I have tried this with a rule flow, but the problem is, this always works on
the whole working memory, but I cant remove the not used objects from
working memory for performance reasons. Is there another way to solve this
problem?
Here is an example for what I intend to do:
Rule1:
when
customer:Customer(town=="London")
then
System.out.println(customer.getLname() + " is inhabitant of
London");
Rule2:
when
customer:Customer(town=="London",job=="TEACHER")
then
System.out.println(customer.getLname() + " is a teacher");
This example illustrates, with the first rule I want to get to know, how
many customers are from London and in the second rule I want to know, how
many of the London customers are teachers. I want to create a kind of
statistics. I have quite a lot of conditions for the first rule, so I dont
want to have them redundantly.
Greetings, Dominik
14 years, 2 months
Approach for loading the rules| How to use MultithreadEvaluationOption.YES
by Harshit Bapna
Hi All,
1. Is it a good idea to categorize rules, place each category of rules in a
different drl file and load the different drls in a same knowledge base ?
Approaches to loading of rules in the knowledge base:
1. Load different drl files in a single knowledge builder and add the
package to a single knowledge base.
2. Load each drl file in a new knowlegeBuilder and then add the package to a
single knowledge base.
3. Load different knowledge bases for different drl files.
IMO, 1 is better. (Since none of the examples are using multiple drl files
so I asked this question)
2. My drools usage is for rules that requires stateless sessions
I was thinking of using Sequential Rete. (
http://blog.athico.com/2007/07/sequential-rete.html)
Apart from the below two lines of code is there anything which should be
taken care of ?
KnowledgeBaseConfiguration kbaseConf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbaseConf.setOption(SequentialOption.YES);//
http://blog.athico.com/2007/07/sequential-rete.html
// kbaseConf.setOption(MultithreadEvaluationOption.YES);
3. How to achieve Multi Threading in drools for stateless rules? Is there a
way where I can use the inbuilt parallelism (if it supports) ?
I found an option MultithreadEvaluationOption.YES in the knowledge base
configuration.
If any sample code or example for multi threaded usage of drools is
available it would be of good help..
--Harshit
14 years, 2 months
Using rule flow in Guvnor
by Dinesh kumar
Hi,
I am having an issue in implementing the rule flow in guvnor.
I created a simple rule flow using eclipse plug in.
http://drools-java-rules-engine.46999.n3.nabble.com/file/n1057004/rules.jpg
I checked the rule flow model in eclipse using the green tick mark and it
showed Drools flow model checked successfully. My .rf and .rfm files were
created.
But when I imported .rf file in my guvnor and build the package I am getting
the following error : Unable to parse xml
When i checked the server log, only this was printed :
(null: 1, 93): cvc-elt.1: Cannot find the declaration of element
'org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper'.
This is the source of the generated .rfm file
1
1
Start
1
ailmentreserves
2
AilmentReserves
1
benefitreserves
3
BenefitReserves
1
4
End
2
3
4
4
resistrationflow
RuleFlowTest
1.0
RuleFlow
HealthCareTest
Am I missing anything. Should the package name in the eclipse same as the
package I use in guvnor ?
I have only the rule flow file in Eclipse and remaining are written directly
in guvnor.
Any hint on this will be of great help.
Regards,
Dinesh
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Using-rule-flow-in-Gu...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Upating drl file without restarting the application
by devyani.sapre@wipro.com
Hi
How to achieve dynamic updation of rule file
(rules-added/deleted/modified) without the need for the application to
be restarted so as to load the rule file? Is there any property that can
be set to achieve this or do I need to run a thread to continuously
monitor the rule file for any change?
Thanks
Devyani
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
14 years, 2 months
Script Task BUG????
by Yaniv Itzhaki
Hi,
I am experiencing a strange bug (or feature???). I added a script task
(name="A") in my main process which just running System.out.println("Script
A");
I also added another script task (name="B") in my sub-process which is
running System.out.println("Script B");
But, when I am running the process I get the following output:
Script B
Script B
I continued to test this issue and added another script
task (name="C") with System.out.println("Script C"); in another sub-process
and I get:
Script C
Script C
Script C
If I add the line for every script System.out.println("Script X
"+context.getNodeInstance().getNodeName()) I get the following:
Script C A
Script C B
Script C C
Is it normal? how come I have this behavior???
Yaniv
14 years, 2 months