Extending the "validation of rules" functionality in Guvnor
by Premkumar Stephen
Hello everyone,
Currently, the validate functionality ensures that rules have proper
syntax.
it is possible to extend this functionality so that business use cases might
also be validated? Is there an API/examples to do that.
For eg, in our domain, an object X can be evaluated for 3 criteria ( a, b,
c )
However, we would need to prevent rules written which combine criteria b and
c
Rules can have the combinations ( a,b,c, ab, ac ). Combinations ( bc and abc
) should not be allowed.
Regards,
Prem
14 years, 8 months
Performance of compiler
by Christian Nedregård
Hi.
My environment: Win XP SP3, 2x2.13 GHz cpu, 3GB RAM, Drools 4.0.7, JDK
1.4.2_11, java compiler: JANINO, dialect: java.
We have about 850 drl's with 5 - 10 conditions in each. 0 -2 evals in each.
The drl's only contain one rule each.
We are using Drools programatically by compiling the drls using
PackageBuilder.addPackageFromDrl and adding them to a RuleBase using
RuleBase.addPackage(PackageBuilder.getPackage())
When we are building our rule base we are never able to compile more than 1
-2 rules per second, which means we need over 10 minutes (at 100% cpu) to
build our rulebase.
Profiling shows 68% cpu time in
org.drools.rule.builder.GroupElementBuilder.build and 18% cpu time in
org.codehaus.janino.Compiler.compile.
We have experimented by changing the compiler to ECLIPSE and the dialect to
mvel but the results are the same.
We have experimented using one PackageBuilder instance per drl or grouping
drls by package and sharing a builder per package. Same result in both
scenarios.
We have also expermimented with compiling concurrently in serveral threads.
Again, about the same result.
My question is: Is this the performance we can expect from the compiler or
are we doing something fundamentally wrong?
Below is an example of one of our drls. This one contains no evals, but
still takes more than 1 second to compile. If anyone can spot some issues
with the way we are doing things the feedback would be much apreciated :)
------------------------------------
package domain.core.productoffer.rules.subscriptiontype
import type.productoffer.ProductOfferRuleEvent
import domain.core.subscription.Subscription
import domain.core.subscription.SubscribedService
import type.subscription.ActionTypeEnum
import domain.core.productoffer.ProductOffer
import domain.rules.RuleEvent
global domain.core.productoffer.RuleValidationReport validationResult
rule "RequiredVProducts"
when
ProductOfferRuleEvent(id == '3')
ProductOffer(id.value == 31963)
$subscription:Subscription()
not ( SubscribedService(status != ActionTypeEnum.REMOVE_CANCEL &&
productId.value in (57, 69) ) from
$subscription.getAllChildSubscribedServices())
then
validationResult.addValidationMessage("2069", "For product offer
rule event with id '3' and product offer with id=31963 subscription must
have one of the following VProducts: 57, 69.");
end
------------------------------------
Regards
Christian Nedregård
14 years, 9 months
Re: [rules-users] Using work items in the Eclipse ruleflow editor
by Jeremy Ary
Mike,
I ran into a similar issue when I began working with ruleflows a few weeks ago. Some of this may not be necessary and it's certainly not all causal, but this was what I noted when working my issue out:
1) If you're working in JBoss Dev Studio, it's possible that you have a conflict between the code you added as a runtime and what's already there, so try the process with a fresh install of eclipse
2) Ensure that any projects you currently have open do not have build/lib/classpath issues (I had the drools projects checked out and open and build errors caused unnecessary complications for me)
3) Be sure that your project has a META-INF on the classpath and that it's set up correctly
4) Place your drools.rulebase.conf & custom definitions .conf that it looks for are both in your META-INF under resources (src/main/resources/META-INF )
5) Once you're sure this much is correct, give Eclipse a restart - my project did not pick up my custom WI's until I restarted
If you're still having issues, I'll be on the IRC channel for the next 5 hours or so as jary - feel free to reply here or look me up there.
(well, I'm heading to lunch very soon, so back in around an hour)
Jeremy
----- Original Message -----
From: "Mike Gill" <mgill(a)modusoperandi.com>
To: rules-users(a)lists.jboss.org
Sent: Monday, September 21, 2009 11:27:46 AM GMT -06:00 US/Canada Central
Subject: [rules-users] Using work items in the Eclipse ruleflow editor
I am using Eclipse to build my Drools rulefow file. I am trying to add custom work items, but I cannot seem to get anything (other than Email and Log) to show up in my Work Items palette.
Does anyone know how to get the existing work items (such as FileFinder or Exec) to show up on the palette in eclipse?
Eventually I will need to add custom work items to the flow, so this is make-or-break Drools functionality for my team.
In pursuit of a solution to this I have combed the documentation, this mailing list archive, as well as endless Google results to no avail. Any help would be very valuable!
Thanks,
Mike
_______________________________________________ rules-users mailing list rules-users(a)lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
14 years, 11 months
Problems with GWT WebProject and Drools5.0!
by vamshidhar reddy chitti
Hi All,
I have integrated drools rule engine 5.0 with GWT WebProject. When I try to call the rule engine from GWT Applicaiton Engine, I get following exception
java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\vamshidharc\drools.packagebuilder.conf read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:139)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.exists(File.java:731)
at org.drools.util.ChainedProperties.loadProperties(ChainedProperties.java:243)
at org.drools.util.ChainedProperties.<init>(ChainedProperties.java:69)
at org.drools.util.ChainedProperties.<init>(ChainedProperties.java:41)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:167)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:153)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:242)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:142)
at org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnowledgeBuilder(KnowledgeBuilderProviderImpl.java:29)
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)
at com.cura.test.server.RuleEngineInvoker.readKnowledgeBase(RuleEngineInvoker.java:72)
at com.cura.test.server.RuleEngineInvoker.invokeRuleEngine(RuleEngineInvoker.java:51)
at com.cura.test.server.GreetingServiceImpl.getDept(GreetingServiceImpl.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:121)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:54)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:313)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
does anyone hav idea?
tnx in advance
bye
vamshi
14 years, 11 months
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