mve bugs
by Mark Proctor
We've found a number of MVEL bugs in both the language and the IDE
integration, we are busy working on these now. So please be aware of
that if you are using the MVEL dialect.
Mark
17 years, 3 months
Release status on website?
by Scott Reed
I looked around the web site and don't see where there is an announcement or release schedule for
the final release of 4.0. Please tell me where I can track Drools release status on the web site.
Thanks,
Scott
17 years, 3 months
Optimization Problem - fat expressions vs ceating additional objects
by Arjun Dhar
I have a rule:
SOLUTION 1
===========
when
cntct: Contact(initialized==true)
rel: Relation(contact==cntct, active:active == $1)
then
…
end
For this to run, it requires the "Relation" object asserted into working memory;
so I'd have to forcefully assert (Relation object with active = false), even if
no relation exists.
An alternative solution is to write the rule like this:
SOLUTION 2
==========
when
cntct: Contact(initialized==true)
rel: Relation(contact==cntct, active:active == $1
or (eval(false==false) and not relation())
then
…
end
#Note: The eval is for decision table since the same cell can be true or false,
and this part of condition should be active only when the cell = false.
Now, Soltuion 2 is a better way to represent the functionlaity and also saved
creation of addtional/redundant objects but introduces an eval() and a not.
>From a perfromance perspective, which solution is more optimized?
If it helps, imagine this used for millions of facts.
At a more granular level, does a Java New() cost more than an eval(false==false)
<-- trivial comparion, but uses the forbidden eval() and then a 'not'
please let me know your views!
Thanks,
Arjun
17 years, 3 months
variables in rules
by Arsalan S. Zaidi
Hi.
Two questions:
1. Is it possible to use a variable in a IN(...) ?
E.g.
when
$someVar : SomeObj()
("pqr" in ("abc", $someVar))
then
...
2. Can I use strings in an eval() to dynamically generate rules?
E.g.
when
eval("$aaa == 0")
then
...
Thanks in advance!
--Arsalan
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
17 years, 3 months
if statement in MVEL consequence
by mark.mcnally@comcast.net
Hello,
I would like to conditionally attempt logging in the consequence of each rule but it does not like the 'if' statement.
Without the 'if', it works fine. It appears to work fine for the java dialect as well - only complains for MVEL dialect.
It does not appear to be related to the logger instance because even "if (true)" causes similar Exception.
I also tried with and without the curly braces.
global org.apache.commons.logging.Log logger
rule Language
dialect "mvel"
salience 800
when
$pd : ParticipantDetails( $ptLanguage : participant.languagePreferenceCD )
$nd : NurseDetails( languages not contains $ptLanguage )
then
if (logger.isDebugEnabled())
logger.debug("LanguageMismatch - ptId: " + $pd.participant.id + ", Lang: " + $ptLanguage + ", staffId: " + $nd.staffId );
[...]
end
* (1,28) unable to resolve method using strict-mode: java.lang.Object.if(...)
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'primaryNurseAssignmentService' defined in class path resource
[...]
nested exception is org.drools.rule.InvalidRulePackage: Unable to build expression for 'consequence' '
if (logger.isDebugEnabled())
logger.debug("LanguageMismatch - ptId: " + $pd.participant.id + ", Lang: " + $ptLanguage + ", staffId: " + $nd.staffId );
Should what I am attempting work?
Thanks,
Mark
17 years, 3 months
RuntimePermission - createClassLoader
by Smitha B
Hi,
My J2EE application uses DROOLS 3.0.6 libraries for rules and runs on SUN JES 2005 Q4 server.
I am getting the exception :
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)
Currently I have granted RunTimePermission for "createClassLoader" in the global area (i.e for all jars) of server.policy and the application works fine.
But I want to specify the permissions for "only" drools and the dependent jars.
Please let me know the list of jars which requires createClassLoader - RunTimePermission .
The complete stack trace is given below:
Regards
Smitha
--------------------------------------------------------------------------------------------------------------
(java.lang.RuntimePermission createClassLoader)
at com.abc.rules.jboss.DroolsContainer.buildRuleBase(DroolsContainer.java:217)
at com.abc.rules.jboss.DroolsContainer.init(DroolsContainer.java:91)
at com.abc.rules.EnvironmentManager.initContainer(EnvironmentManager.java:252)
at com.abc.rules.EnvironmentManager.init(EnvironmentManager.java:158)
at com.abc.rules.PDMImpl.ejbCreate(PDMImpl.java:224)
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:585)
at
com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:4
10)
at
com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:75)
at
com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContai
ner.java:597)
at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:168)
at
com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:359)
at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1072)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:772)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:1
26)
at com.abc.sms.SendSmsImpl.sendSms(SendSmsImpl.java:654)
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:585)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at
com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:95
0)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:158)
at
com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:116)
at $Proxy34.sendSms(Unknown Source)
at
com.sun.enterprise.webservice.EjbWebServiceDispatcher.handlePost(EjbWebServiceDispatcher.java:140)
at
com.sun.enterprise.webservice.EjbWebServiceDispatcher.invoke(EjbWebServiceDispatcher.java:79)
at
com.sun.enterprise.webservice.EjbWebServiceValve.dispatchToEjbEndpoint(EjbWebServiceValve.java:187)
at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:131)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:542)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
at
com.sun.enterprise.web.connector.httpservice.HttpServiceProcessor.process(HttpServiceProcessor.java:
226)
at com.sun.enterprise.web.HttpServiceWebContainer.service(HttpServiceWebContainer.java:2071)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission
createClassLoader)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:594)
at java.lang.ClassLoader.<init>(ClassLoader.java:201)
at org.drools.rule.PackageCompilationData$PackageClassLoader.<init>(Unknown Source)
at org.drools.rule.PackageCompilationData.init(Unknown Source)
at org.drools.rule.PackageCompilationData.<init>(Unknown Source)
at org.drools.rule.Package.<init>(Unknown Source)
at org.drools.compiler.PackageBuilder.newPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown Source)
at com.abc.rules.jboss.DroolsContainer.buildRuleBase(DroolsContainer.java:204)
... 41 more
---------------------------------
Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get online.
17 years, 3 months
rule validation
by hypnosat7
Hi,
I have some rules written in a dsl in a data base and I need to validate
those rule so I used a PackageBuilder instance and a PackageBuilderErrors
but it's a bit akward to manage with the subclasses of DroolsError. What I
need is to get the line number of the error in my drl file (the DroolsError
).
How can I proceed ?
thanks
This is what I tried to do :
PackageBuilderErrors pkgBuilderErrors = builder.getErrors();
DroolsError[] droolsErrors = pkgBuilderErrors.getErrors();
List<DroolsError> errorList = new
ArrayList<DroolsError>(Arrays.asList(droolsErrors));
for (DroolsError droolsError : errorList)
{
if (droolsError instanceof ParserError)
{ ...
--
View this message in context: http://www.nabble.com/rule-validation-tf4268341.html#a12147869
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Test for null object, not null property
by Stuart Moffatt
The incoming building was initialized like this:
Building building = null;
FactHandle buildingFact = businessRuleSession.insert( building );
businessRuleSession.setFocus("validate delete or get building");
businessRuleSession.fireAllRules();
Can drools test for this null building?
What should the rule look like?
rule "building is null"
agenda-group "validate delete or get building"
salience 10
when
boException : BOException()
Building() == null /* this is the problem here -- not sure what
this should look like */
then
boException.setCode("BO-0008");
end
17 years, 3 months