Question about the FROM feature in RETE
by Felipe Piccolini
Hi all,
Has been so long since the last time I posted something in this email
list.... is nice to write again here, even if is a silly question.
Please if this question has being answered before don't be angry, and just
say so to make a better search, because looking for it in
the group gave me no results.
About the "from": If I have 2 rules containing a "from a list" sentence in
the LHS, and happens that the from is from the same list, will
RETE share that in the same node? I mean, will drools go through the list
once or twice? I wanna optimize the access to the list.
My first impression is that you guys made a great job and the "from ..."
should be treated as any other conditional item and share nodes...
but I just wanna be sure, because if not, then the best approach is to
extract all the elements in one rule and make the other rules
to just check for each element.
Thanks.
--
-----------------------------
Felipe Piccolini
felipe.piccolini(a)gmail.com
13 years, 12 months
Problem deploying Drools V5 as a webservice on Weblogic 10
by P-Yves G
Hello,
I am trying to migrate an application of my company from Drools V4.0.7 to
V5.1.1 (without actually using features brought by v5), and I am currently
experiencing a problem.
The application is called via an Axis web service deployed on a Weblogic 10
server, using JDK v1.5.0_14. I have two ways to test the application:
- A simple java class that sets the facts and calls directly the implemented
method of the web service
- Using soapUI, after having deployed the .war file of my web service on my
Weblogic server.
While in V4, everything works fine, java test and web service test (with
SoapUI) alike, I get the expected results. With V5, the Java test works as
expected, but the web service test fails (I get a
"java.lang.reflect.InvocationTargetException" without any StackTrace).
I put the server in debug mode and tried to narrow down the problem in
eclipse the best I could. The first difference I noticed, was that the
classloader was different between the two test methods:
- for the java test: Launcher$AppClassLoader
- for the WS test: ChangeAwareClassLoader
However, I don't really know how it affects the execution. After debugging
deeper into the code, I found out the difference: at some point (see stack
below) it seems to get the wrong "referent" from Reference.class. In the
java test, the referent is an "ObjectStreamClass", whereas in the web
service test, it becomes a "NoClassDefFoundError"...
Where could that come from ? Does it have something to do with the
ClassLoader (I admit this area is out of the bounds of my coding skills) ?
For more details, here is the stack from my java test (some lines excluded)
:
ObjectStreamClass.lookup(Class, boolean) line: 261
ObjectStreamClass.initNonProxy(ObjectStreamClass, Class,
ClassNotFoundException, ObjectStreamClass) line: 531
DroolsObjectInputStream(ObjectInputStream).readNonProxyDesc(boolean) line:
1552
DroolsObjectInputStream(ObjectInputStream).readClassDesc(boolean) line: 1466
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1699
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
HashMap<K,V>.readObject(ObjectInputStream) line: 1067
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 585
ObjectStreamClass.invokeReadObject(Object, ObjectInputStream) line: 946
DroolsObjectInputStream(ObjectInputStream).readSerialData(Object,
ObjectStreamClass) line: 1809
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1719
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
DialectRuntimeRegistry.readExternal(ObjectInput) line: 59
DroolsObjectInputStream(ObjectInputStream).readExternalData(Externalizable,
ObjectStreamClass) line: 1755
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1717
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
Package.readExternal(ObjectInput) line: 197
DroolsObjectInputStream(ObjectInputStream).readExternalData(Externalizable,
ObjectStreamClass) line: 1755
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1717
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
DroolsStreamUtils.streamIn(InputStream, ClassLoader, boolean) line: 205
DroolsStreamUtils.streamIn(InputStream) line: 174
FileScanner.readPackage(File) line: 147
FileScanner.getChangeSet() line: 97
FileScanner.loadPackageChanges() line: 72
DirectoryScanner.loadPackageChanges() line: 85
And here is the stack, at the same point, from my web service (difference in
bold) :
ObjectStreamClass.lookup(Class, boolean) line: 261
ObjectStreamClass.initNonProxy(ObjectStreamClass, Class,
ClassNotFoundException, ObjectStreamClass) line: 531
DroolsObjectInputStream(ObjectInputStream).readNonProxyDesc(boolean) line:
1552
DroolsObjectInputStream(ObjectInputStream).readClassDesc(boolean) line: 1466
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1699
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
HashMap<K,V>.readObject(ObjectInputStream) line: 1067
GeneratedMethodAccessor2.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 585
ObjectStreamClass.invokeReadObject(Object, ObjectInputStream) line: 946
DroolsObjectInputStream(ObjectInputStream).readSerialData(Object,
ObjectStreamClass) line: 1809
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1719
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
DialectRuntimeRegistry.readExternal(ObjectInput) line: 59
DroolsObjectInputStream(ObjectInputStream).readExternalData(Externalizable,
ObjectStreamClass) line: 1755
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1717
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
Package.readExternal(ObjectInput) line: 197
DroolsObjectInputStream(ObjectInputStream).readExternalData(Externalizable,
ObjectStreamClass) line: 1755
DroolsObjectInputStream(ObjectInputStream).readOrdinaryObject(boolean) line:
1717
DroolsObjectInputStream(ObjectInputStream).readObject0(boolean) line: 1305
DroolsObjectInputStream(ObjectInputStream).readObject() line: 348
DroolsStreamUtils.streamIn(InputStream, ClassLoader, boolean) line: 205
DroolsStreamUtils.streamIn(InputStream) line: 174
FileScanner.readPackage(File) line: 147
FileScanner.getChangeSet() line: 97
FileScanner.loadPackageChanges() line: 72
DirectoryScanner.loadPackageChanges() line: 85
I hope I made the situation as clear as I could. I'm available for further
details, and obviously, any help would be very appreciated :) .
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Problem-deploying-Dro...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 12 months
Question about collect and sliding windows
by Anais Martinez
Hello. I have two questions about collect and sliding windows. I have created
this rule:
rule "Active risk"
when
$n:Node()
$readings: ArrayList(size==80) from collect(
Reading( nodeID == $n.nodeID,
(signalType == SignalType.PLUVIOSITY && value >= 10)||
(signalType == SignalType.AIR_TEMPERATURE && value>=12)
) over window:time(10h))
then
System.out.println("Active risk in node "+ $n.getNodeID());
end
And the declarations are the following (Reading and Node are java classes):
declare Reading
@role(event)
@timestamp (timestamp)
end
declare Node
@role(fact)
end
Well, I have probe the rule. I have inserted 100 readings which satisfy the
conditions, in a single time but with different timestamp (I have simulated
that there are a pluviosity reading and a air_temperature reading each 15
minutes), that is, in main:
long init= 1290729600000L;
long interval = 1000*60*15;
for (int i=0; i<100; i++){
long fecha = init+i*interval;
Reading r1 = new Reading(SignalType.PLUVIOSITY, value1, node);
session.insert(r1);
Reading r2 = new Reading(SignalType.AIR_TEMPERATURE, value1, node);
session.insert(r2);
}
The message is not written (I have fired rules after insertions).
My questions:
Has drools any problem if I inserted all readings at same time? (Do I have
to use the pseudo-clock?)
My problem is that the readings will be sent from a server in real system,
and it's possible that the server will send all readings belonging to an
interval of one/two hour/s at same time.
Thanks.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Question-about-collec...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 12 months
Weird Problem: WorkItemManager seems to loose WorkItems
by helo
Hello everyone,
I am encountering weird issues with the DefaultWorkItemManager. It seems to
somehow "loose" WorkItems occasionally. I haven't completely figured out
what is happening exactly which also means I can't provide a testcase that
reliably reproduces my error.
Let me give you a short description of my usage scenario: I'm using Drools
5.1.1 on a Win7-x64 PC with a JDK1.6.0_22-x64 VM. I'm trying to run lots of
process instances at the same time, lets say 100 for now. These are either
started right after each other (for-loop calling startProcess() each time,
always in a new thread) or with a random delay of up to 2000ms. The ksession
is running in a separate thread with fireUntilHalt().
In the processes I use, I try to implement some rule-based runtime process
modifications. The idea is that the process stops at a certain node, inserts
a special event containing process instance information into the
WorkingMemory, the rule engine evaluates the event and decides what
modifications to execute. Once those modifications are finished, the process
instance is notified and continues.
To realise this functionality, I created a class that implements
ProcessEventListener, AgendaEventListener and WorkItemHandler interfaces at
the same time. An instance of that class is registered for those three types
at startup of my Drools application.
I use the beforeNodeTriggered() event to create my own special event, in
executeWorkItem() I save the WorkItem and corresponding WorkItemManager and
insert my special event into WorkingMemory, triggering the drools rule
engine to evaluate it and execute modifications accordingly.
I use afterActivationFired() to get notified about the rule engine finishing
the modifications (I listen for a certain rule being fired, because that
rule is always fired last, no matter if there were modifications or not). In
afterActivationFired() I complete the WorkItem I saved before, thus letting
the process instance continue.
And that's the point where something goes wrong from time to time. Every now
and then, the call of completeWorkItem() has no effect. I investigated using
the debugger and the WorkItem in question is not registered with the
WorkItemHandler right before the call of completeWorkItem(), so that this
call can't do anything. This causes the process instance that created the
"lost" WorkItem to hang at the WorkItemNode with no way to have it continue
execution. The "lost" WorkItem has status 0 even after calling
completeWorkItem().
I tried tracing the path of the WorkItem, but so far, all I can say is that
WorkItems are always registered with the WorkItemManager at
executeWorkItem(), but at afterActivationFired() sometimes they are not. So
it has to happen between those two points in the code. However, I could not
find any way to remove a WorkItem from the WorkItemManager without changing
its status, so I have no idea what could cause this.
Initially I suspected concurrency issues because I had some
ConcurrentModificationExceptions as well. But since then I synchronized all
crucial parts (i.e. all parts using WorkItems or changing the process in any
way) on the RuleFlowProcess object and on the ProcessInctance object. This
fixed the CMEs but the "lost" WorkItems still occur from time to time.
I've really run out of ideas by now. Since this bug only occurs seldomly, it
is really hard to reconstruct what's going on. I've tried to strip away as
much of my coding as possible to see if this also happens in standard
drools, but I couldn't reproduce it so far. I guess it may have something to
do with the amount of work I perform in the rule engine for my modifications
because "dummy" WorkItemHandlers that just complete a WorkItem right away
don't seem to cause errors like the one I'm encountering.
If anyone has any idea what could cause this, any help would be hugely
appreciated. Also, feel free to ask questions if you need further
information. However, I can't really share my code publicly for various
reasons, but I will try to extract meaningful parts if necessary.
Regards
Henning Losert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Weird-Problem-WorkIte...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 12 months
Re: [rules-users] @role( event ) in guvnor
by John Peterson
>Message: 3
>Date: Tue, 30 Nov 2010 02:16:05 -0800 (PST)
>From: Pankaj Khattar <pankaj.khattar1(a)alcatel-lucent.com>
>Subject: Re: [rules-users] @role( event ) in guvnor
>To: rules-users(a)lists.jboss.org
>Message-ID: <1291112165767-1991857.post(a)n3.nabble.com>
>Content-Type: text/plain; charset=us-ascii
>
>
>Thanks for the info.
>
>Is there any workaround for the same as i am migerating my existing drl
file
>to guvnor & the drl file contains
>@role( event ) & @expires( 5m )
>--
>View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/role-event-in-guvnor
-tp1991538p1991857.html
>Sent from the Drools - User mailing list archive at Nabble.com.
Pankaj,
Try this - go into Guvnor and create a technical rule. Clear out the
WHEN-THEN (i.e. make it blank). In the rule editor, type:
declare factName
@role(event)
@expires(5m)
end
It should validate without any problems. I think this might solve your
problem. The other thing I discovered is that the Guided Editor won't
support entry-points, but you can use the Technical Editor for it, or
you can try to put the verbiage in the DSL translations.
13 years, 12 months
Drools + Spring without internet
by Anderson Rocha
Hi all,
I realized that to use Drools with Spring I need to be conected to the
internet, but sometimes I am not. There is a way to download the tags of
Drools and configure the applicationContext.xml to seek for them localy?
Regards,
Anderson
13 years, 12 months
Rules not firing when facts asserted in a rule RHS in 5.0
by Chris Selwyn
I have been using the open source Drools 5.1 where I have been inserting
facts in the RHS of a rule and that has been causing subsequent rules to
fire just fine.
However, I am working at a customer that requires my to use a supported
product, so I have moved my rules over to JBoss Rules 5.0.2 and I find
that this does not work any more.
I have a declarative fact type as follows
declare QuestionValidation
question: String
state: String
mandatory: Boolean
type: String
end
I have an "init" rule with high salience that inserts a number of
QuestionValidations into the session.
In order to test what is going on, I created a rule:-
rule 'Test'
dialect 'mvel'
when
$qv: QuestionValidation()
then
System.out.println( "QuestionValidation found " + $qv.getQuestion()
+ "/" + $qv.getState() );
end
This rule never fires if I insert a QuestionValidation in the init rule!
I can see the facts being inserted in the log as follows
[#|2010-12-01T09:19:16.723+0000|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=70;_ThreadName=p:
thread-pool-1; w: 7;|
OBJECT ASSERTED value:QuestionValidation( mandatory=true, state=Closed,
question=B2B_METER_SERIAL_NUMBER, type=string ) factId: 39|#]
But I don't see any associated "ACTIVATION CREATED" for this object.
However, if I insert a QuestionValidation fact created in Java by using
kbase.getFactType("SWWB2BOutgoing", "QuestionValidation") then the Test
rule gets fired just fine.
Is there something I am missing? Do I need to to turn on rule chaining
or something like that? (Surely chaining is on by default).
Chris
13 years, 12 months
Reference a declared FactType from another rule file?
by Gerret Hansper
Hi all,
does anybody know whether it's possible to reference a FactType declared
in one rule file from another one? I'm developing rules with Eclipse
(using Drools 5.0.1) and the rules are spread over a couple of .drl
files. It would be nice to be able to declare a FactType in one file,
have a rule insert instances of it into working memory and have another
rule in another file (but the same package) use it in its LHS.
I've tried various import statements but the compiler doesn't seem to be
able to resolve the reference.
Thanks,
Gerret
13 years, 12 months
Opportunity
by Jonathan Becker
Hey everyone,
Sorry to post on this forum, but I've got to say, I'm have a bear of
time finding people skilled with either Drools or jRules. I have
multiple FTE/permanent opportunities for strong engineers in the greater
Seattle area. My client is profitable, privately-held, has zero debt
and is growing at a rate of 50%. If you're at all curious, please shoot
me an email for details. If you know someone who's interested, I pay a
substantial finder's fee if my client hires them. Thanks for your time
and sorry to interrupt!
Regards,
Jonathan Becker
Senior Account Manager
o: (425) 454-0282 ext 160 | f: (425) 454-5784
www.triadgroup.com | jonathanb(a)triadgroup.com
13 years, 12 months
Hi...
by Bennet Joseph
Hi All,
Please any one send me one very small application which persist the details.
org.drools.persistence.session.SessionInfo
org.drools.persistence.processinstance.ProcessInstanceInfo
org.drools.persistence.processinstance.ProcessInstanceEventInfo
org.drools.persistence.processinstance.WorkItemInfo
org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo
org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable
thanks,
Jose.
13 years, 12 months