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
16 years, 2 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
16 years, 2 months
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
16 years, 2 months
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
16 years, 3 months
unable to resolve Type Declaration class
by richarda
So, my code is doing this:
KnowledgeBaseConfiguration conf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
conf.setOption(EventProcessingOption.STREAM);
KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
try {
File f = new File("/tmp/my.pkg");
InputStream stream = new FileInputStream(f);
if (stream == null) {
jlog.fatal("Unable to find rule pkg");
} else {
jlog.info("adding pkg");
builder.add(ResourceFactory.newInputStreamResource(stream),
ResourceType.PKG);
}
} catch (Exception e) {
e.printStackTrace();
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase(conf);
kbase.addKnowledgePackages(builder.getKnowledgePackages());
jlog.info("setup creating knowledge session");
ksession = kbase.newStatefulKnowledgeSession();
jlog.info(" setup ksession created");
The pkg was created from Guvnor.
If in the package declaration area in Guvnor, (where you put the import
statements)
If I put
declare Signature
@role ( event )
end
then build the package, save it to disk /tmp/my.pkg
on startup I get:
[#|2009-11-24T14:50:38.944+0000|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
unable to resolve Type Declaration class 'Signature'
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
I need to declare 'Signature' as an 'event'
Am I doing this wrong?
If I do this all in Eclipse and load the DRL files manually it all works.
--
View this message in context: http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 3 months
How to store the rules data into RDBMS, like mysql, oracle
by Sinboy Zhang
Hi,all:
Guvnor is a BRMS,it can manage the rules through Jackrabbit
Repository.The default,Guvnor work well with derby database.But i want it
work with my database,just like MySQL.
My step is :
1.Run Guvnor with default,and generate the repository.xml and repository
dictionary at JBOSS_HOME\bin dictionary
2.delete repository dictionary and edit repository.xml,only replace the
content in <PersistenceManage> label ,just like this:
<PersistenceManager
class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
<param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://localhost:3306/guvnor_db"/>
<param name="user" value="root" />
<param name="password" value="a123456" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
<param name="externalBLOBs" value="false"/>
</PersistenceManager>
3.install Mysql database,and create the guvnor_db database instance,and
copy mysql driver to JBOSS_HOME\server\deploy\lib
4.Restart the JBoss ,i get the exception:
org.drools.repository.RulesRepositoryException:
javax.jcr.RepositoryException: Invalid repository configuration:
repository.xml: Replacement not found for ${wsp.name}.: Replacement not
found for ${wsp.name}.
Why?Please help me,thanks!
16 years, 3 months
Drools with Web Application
by Sahid Khan (সাহিদ)
Hello,
Drools is very new to me. So please excuse me if this question sounds too naive.
Basically my requirement is: I have a web based (3-tier j2ee)
application which is
deployed in JBoss AS. Now I want to incorporate some business rule
implementations with this application so that end users, who are not
very technical, can add/modify the rules according to their need. I
suppose Drools Guvnor will be the front end and rules repository and
Drools Expert will be
the back end for such requirements. Please correct me if I am wrong.
I had gone through the drools documentation. That talks about
stand-alone application for guvnor itself, but I want to use Guvnor
inside my existing application itself, preferably by using some Guvnor API.
Can some one please provide some insight on how to do this. Also, I'll
appreciate if some one can point me to some getting started/best
practice documents for these stuffs?
Many thanks in advance,
--
Sahid
Argue with idiots, and you become an idiot. - PG
16 years, 3 months
Import and Export at Package level
by krishna.cj
Hi,
We are running Guvnor on two machines, out of which one is used for
developing and testing rules, say test environment, and another is
used for providing rules for production application. Our test
environment typically contains more than one package and each in turn
contains multiple snapshots. When we use Export and Import to
provide updated rules to production environment, all the packages and
snapshots are imported to the production environment.
Is there any way to use Export and Import at package level so that we
can export only the package we want and no other package or snapshot?
Any help would be a great help to us..
Best Regards,
Chaitanya.
16 years, 3 months
Stateful session and non-existence of Facts
by Leonardo Gomes
Hi Guys,
I have the following situation while running a stateful session with Drools
4.0.7:
- I want to test that a fact with a given state doesn't exist;
- It works fine
- At a certain point I have to retract all facts and reinsert them at the
stateful session - some of them actually changed and I don't want to
recreate the session b/c it's expensive
- Again the fact that didn't exist when I first created the session still
doesn't exist
** Problem: This time the rule that verified the non-existence is not fired
because I didn't insert any fact that would retrigger it.
Rule example:
rule "022"
when
SiteLanguage(language : languageCode)
t : SiteSpecialServiceType(type : specialServiceType)
not SiteLanguageSpecialServiceType(specialServiceType == type, languageCode
== language)
then
<<consequence>>
end
How could I solve or workaround that?
Thanks in advance,
Leo.
16 years, 3 months