Upgrade to Drools 5 - loss of performance
by Scott Reed
I just upgraded our app from Drools 4 to 5 libraries. We just use the
rules engine with DRL. The performance of the engine on our rulebase is
unacceptably slow. I assume there is something we need to do to our
rules or the way we are configuring the engine to fix this. I don't see
anything in the release notes about backwards compatibility issues. I
would very much appreciate it if someone would direct me to any
documentation that explains what needs to be done so our 4.0 rules
perform at least as well as they did before the upgrade?
Thanks,
Scott
14 years, 11 months
drl to pkg
by Perumaal Krishnaraj
Hello Everybody,
I'm a newbie to Drools, so please excuse me, if question is very
fundamental.
I'm not using drools with eclipse or brms.
I would like to convert the drl file which I had created using a text editor
to the binary form ie. in pkg format (serialized), which can be used im my
Java application.
Is there a tool, or a code snippet which gives me an idea as to how this is
done.
Regards,
kp
15 years
functions
by Chris Richmond
Ok.I am trying to build a function library in my .drl file and I added this
one test function
function String outputString(String sData){
return sData;
}
And no matter where I place this in my .drl file, I get an exception one way
or the other with compiling when I try instaniate and fire my rules. The
.drl file works exactly as expected if I remove this function declaration,
and when I *do* try to add it, I do not actually call it anywhere.but get
those errors.
So my question is, where exactly do I need to place function declarations..
Thanks,
Chris
15 years
Re: [rules-users] Need help related to collection of data accessing in rule file.
by prasad raju sagi
Hi ,
I am trying to create rule on a fact , which contains arraylist of collection and the object in the collection internally contains an arraylist of another collection of objects.
This looks like object A contains collection of objects B and B contains collection object C
A -> blist ( Arraylist<B> )
B -> clist (ArrayList<C> )
C-> dlist( ArrayList<D>)
D-> type ( string)
I am inseting A as fact to the working memory.
I am in confusion state like how to write the rule to place conditions on collection C.
Can I use from in the form of nested from in rule statment.
Thanks
Prasad Raju Sagi
Mobile: 847-644-4103
________________________________
From: Aziz Boxwala <boxwala(a)yahoo.com>
To: rules-users(a)lists.jboss.org
Sent: Thursday, June 11, 2009 1:58:28 PM
Subject: [rules-users] process order example not working fully
I am trying to execute a ruleflow and use rules to assign tasks within the ruleflow in Drools 5.0.1. I have a drl file included in my knowledge base that tries to assign a task to a user when a new human task is created. This is based on the example in org.drools.example.process.order. I can't get my code to work. I don't the rules in the example are working either (dslr for the task assignment or the drl for dynamic logging). After some attempts, I found that this condition
WorkItemNodeInstance()
does not evaluate to true ever.
Do I have to do anything special to make the WorkItemNodeInstance appear in working memory?
Thanks for any help.
--Aziz
15 years
Flow (human task) and web apps
by Rodrigo
Just a newbie question...
To use drools flow with human tasks in a Seam application for example, i
will need to start a mina server in another thread (and interact by a mina
client), like documentation suggest?
Anyone have a sample web app that use this approach, drools flow + human
task + webapps.
Thanks in advance.
Rodrigo Valério.
15 years, 1 month
WG: Serialization of packages: InvalidClassException / serialVersionUID
by Bernd Rücker
The exception of the KnowledgePackage serialization (by the way, this is
described in the docs, that you can serialize the KnowledgePackages!):
/home/bruecker/workspace/1/iKS2/iks_drools_rules/drools-rules.pkg
Exception in thread "main" java.io.NotSerializableException:
org.drools.definitions.impl.KnowledgePackageImp
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at
org.drools.util.DroolsStreamUtils.streamOut(DroolsStreamUtils.java:79)
at
org.drools.util.DroolsStreamUtils.streamOut(DroolsStreamUtils.java:61)
So this doesnt work either
(http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht
ml_single/index.html#d0e992):
3.2.4. Building and Deployment in Separate Processes
Both the KnowledgeBase and the KnowledgePackage are units of deployment
and serializable. This means you can have one machine do any necessary
building, requiring drools-compiler.jar, and have another machine deploy
and execute everything, needing only drools-core.jar.
Although serialization is standard Java, we present an example of how one
machine might write out the deployment unit and how another machine might
read in and use that deployment unit.
Example 3.15. Writing the KnowledgePackage to an OutputStream
ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream(
fileName ) );
out.writeObject( kpkgs );
out.close();
Example 3.16. Reading the KnowledgePackage from an InputStream
ObjectInputStream in = new ObjectInputStream( new FileInputStream(
fileName ) );
// The input stream might contain an individual
// package or a collection.
@SuppressWarnings( "unchecked" )
Collection<KnowledgePackage> kpkgs =
()in.readObject( Collection<KnowledgePackage> );
in.close();
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kpkgs );
The KnowledgeBase is also serializable and some people may prefer to build
and then store the KnowledgeBase itself, instead of the Knowledge
Packages.
Drools Guvnor, our server side management system, uses this deployment
approach. After Guvnor has compiled and published serialized Knowledge
Packages on a URL, Drools can use the URL resource type to load them.
Von: Bernd Rücker [mailto:bernd.ruecker@camunda.com]
Gesendet: Dienstag, 1. September 2009 17:21
An: 'rules-users(a)lists.jboss.org'
Betreff: Serialization of packages: InvalidClassException /
serialVersionUID
Hi!
I really struggled some time with serialization issues: I want to create a
pkg and package that with the jar. From there I want to read it during
runtime.
Easy I thought. Drools 5 way should be to serialize the KnowledgeBase,
right? At least, this is what the AntTask does.
If I try to serialize the KnowledgePackage I get an excpetion anyway:
Okay. Back to the KnowledgeBase. Serialized with Drools 5.0.0.M4 and try
to read it with 5.0.0.M5:
Caused by: java.io.InvalidClassException:
org.drools.impl.KnowledgeBaseImpl;
local class incompatible: stream classdesc serialVersionUID =
-4540376767025107954,
local class serialVersionUID = -3186110098262381425
So it seems Drools Packages are NOT compatible between minor versions?
This would be a disaster for deployment. Or do I serialize the wrong
thing? Unfortunately I didnt find anything in the docs about it.
Then I tried to do it the old Drools 4 way and serialize Package
objects, but same problem with a different serialVersionUID!
Why do these important classes dont have a serialVersionUID? Or how
should that be loaded? Must be a big issue with Govner, so I think there
must be a solution already?
Thanks for any help!
Cheers
Bernd
15 years, 2 months
Drools as Lexer / Parser (sequential data processing)
by André Thieme
Hello group, I recently had the idea:
"A rule system (like Drools) is ideal for making programs with complex
rules simpler. Writing a lexer or parser can be non-trivial. So, is it
possible and also meaningful to express such a task with rules?"
Anyone here who maybe tried that already?
The two big questions for me are:
1) how easy is it to express a lexer with rules?
2) how bad (good?) will it perform?
If you happen to have a good idea of how to do it, could you please give
me an example for a simple lexer?
Let's say it will get natural language (a string, such as this email) as
input and should return a sequence (say, ArrayList) of Tokens, which may
look like this:
public class Token {
public String value;
public String category;
Token(String value, String category) {
this.value = value;
this.category = category;
}
}
We could have three categories:
"word", "numeric" and "whitespace".
An input String could be:
"We can see 500 cars"
And it should produce an ArrayList with the contents:
[
Token("We", "word"),
Token(" ", "whitespace"),
Token("can", "word"),
Token(" ", "whitespace"),
Token("see", "word"),
Token(" ", "whitespace"),
Token("500", "numeric"),
Token(" ", "whitespace"),
Token("cars", "word")
]
At the moment I have difficulties to see if/how this could be achieved.
If you find this easy, please post a solution.
I am aware that JavaCC is really good for such tasks and will also
perform extremly well.
Greetings,
André
15 years, 2 months
retrieving streams/entry points from java api
by Chris Richmond
Hello,
I am trying to determine, iterate the working memory streams within my rule
by doing the following:
for(WorkingMemoryEntryPoint entry :
session.getWorkingMemoryEntryPoints()){
System.err.println("entry point stream:
" + entry.toString());
}
But I can find no method/way to finid the actual text name of the entry
point(what is written in the rule as from entry-point "xxxx").
Is there a way to do this? To list the readable names of the entry points
from your session? I would like to list those entry points in a drop down
as application profiles, so if they have one selected, one entry point of
rules will be inserted to and so on..
Thanks,
Chris
15 years, 2 months
Re: [rules-users] unable to determine value type class *** URGENT***
by Corneil du Plessis
Srithu wrote:
>
> I have a wired behavior..
>
> I have a set of rules and i have used drools-guvnor to packaging them...
> It is working in windows machines where i have jboss which is running on
> IBM java 5 and 6..
>
> When i connect the same from jboss Which is running on 64 bit IBM java 6
> on linux is not working...
> The same is working If i used 64 bit IBM java 5 on linux.....
>
>
> I getting following exception...
>
>
>
> Please help....
>
>>> [2009-02-11 12:30:29,697] [705980] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - org.drools.RuntimeDroolsException: unable to determine
>>> ValueType for Class [class java.lang.Object]
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at
>>> org.drools.base.ValueType.determineValueType(ValueType.java:193)
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at
>>> org.drools.base.ValueType.readResolve(ValueType.java:125)
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at
>>> sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source)
>
>>> [2009 -02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12]
>>> [ERROR] [STDERR ] - at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>
>>> [2009-02-11 12:30:29,698] [705981] [http-0.0.0.0-8080-12] [ERROR]
>>> [STDERR ] - at java.lang.reflect.Method.invoke(Method.java:599)
>
> [deleted stacktrace]
>
>
We are experiencing same issue on WebSphere 6.1 FP 23 on Linux and AIX.
Has anyone found a resolution?
Regards
Corneil
--
View this message in context: http://www.nabble.com/unable-to-determine-value-type-class--***-URGENT***...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 2 months
Conversion from Normal Decision Tables to Web-Based Tables and vice-versa
by Vikrant Yagnick
Hi All,
I am wondering if anyone has had a requirement where they would need to convert their normal decision tables into web-based decision tables(or vice-versa).
If someone has already done this, can they share either some code or pointers to how this can be done? (I guess it will involving parsing the Excel and creating the XML for the decision table).
Will this be a useful feature to have?
Cheers,
Vikrant
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 years, 2 months