Re: [rules-users] Planner and domain modeling
by ge0ffrey
Yes, you're right: it's because of performance reasons during incremental
score calculation.
If a CloudComputer changes during planning too, it should be set as dirty in
Drools by Planner calling (workingMemory.modify(computer)). If the whole
computer is made dirty, that has a serious effect on incremental score
calculation. However, since recently drools supports making individual
fields dirty, so there is definitely room for innovation there.
I 've been thinking about supporting bi-directional planning variables in
Planner (think JPA mappedBy), but haven't gotten around to it yet.
Now, currently, that doesn't mean you can't model CloudComputer with a
getProcessList, it just means you can't use CloudComputer.getProcessList()
in the score rules or custom planner code (if any) currently (until
bi-directional planning variables are supported). Also, you might need to
take the getBestSolution() and refresh all it's computer's
getProcessList()'s before sending it to your other systems.
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-and-domain-modeling-tp4018117p4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Drools Number to String Coercion Issue
by gqmulligan
Is there any way to let Drools handle a String, Number comparison without
having to manually do type conversions?
I am having trouble comparing a string to an integer in a rule. The rule can
be simplified to the following where fields is just a
The problem is that given this rule, even when a = "10", the consequence is
never fired. According to the documentation at section 4.8.3.3.3 "Coercion
is always in favor of the field type and not the value type". So this rule
seems like the 10 should be coerced to "10" and then this comparison should
return true, but it doesn't.
If a change the 10 to "10" the rule succeeds. Also if I do
Integer.parseInt(fields["a"]) the rule succeeds.
The more interesting part is if I change the operator to > or < and change
the value of fields["a"] appropriately the rule still succeeds! Is this
because > and < aren't technically valid operators on Strings so the two
operands are converted to numeric values and compared?
I just noticed if I change the dialect to "java" then everything works as I
want. However, I still do not understand why it didn't work at first or if
it is safe to count on a different dialect to fix the issue.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Number-to-String-Coercion-Issue-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Please I can I do this???
by paco
I want to detect the conflict between the rules with Drools Verifier. For
example the first condition of the second rule is present in the first rule
and the actions to perform are the same in both rules as they demonstrate in
the following case. It works very well when these rules belong to the same
drl file.
--------- fichier a.drl---------------------------
rule "a"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0
then
Action1
end
rule "b"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0 && B==1
then
Action1
end
The problem arises when I separated its rules and that I have to put each in
its own file
---------------- a.drl----------------
rule "a"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0
then
Action1
end
------------------b.drl--------------------
rule "b"
no-loop true
ruleflow-group "group1"
dialect "mvel"
when
A==0 && B==1
then
Action1
end
I can no longer detect this problem with Drools Verifier.
Does anyone ever encountered this problem?
How can I do to write a small program to audit if this case?
--
View this message in context: http://drools.46999.n3.nabble.com/Please-I-can-I-do-this-tp4018135.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Not able to debug Drools Rules
by Annie
Hi,
I am using 'drools-distribution-5.4.0.Final' and 'eclipse helios 3.6.2' . I
have created a simple example using rules, it runs correctly but when trying
to debug it as drools application I got the following error in 'error log' :
Plug-in 'com.google.gwt.eclipse.core' contributed an invalid Menu Extension
(Path:
'com.google.gdt.eclipse.suite.popupMenu.file' is invalid):
com.google.gwt.eclipse.core.actions.AddResourcesToClientBundleAction
Can anyone help me to identify the problem?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Not-able-to-debug-Drools-Rules-tp401813...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
issue with date comparison
by sumatheja
Hi,
I've a fact which is retrieved from database using hibernate. The date
format that comes in is "yyyy-mm-dd", java.util.Date. The fact has two
variables *startDate* and *endDate. *I want to check if the the *current
date* lies between these two. Since the current date is not constant I'm
trying to use a global variable, which I would setbefore firing the rules.
My question is what should be the datatype of this global variable. If I
use Date the format is completely different. If I use String it says that
date can't be compared with string.
However if I hard code the value of current date in "*dd-MMM-yyyy*"
rule fire fine. Can someone please suggest me a way to achieve this. Thanks
in advance.
--
cheers
Sumatheja Dasararaju
12 years, 5 months
Odd rules execution for expired events
by sopel39
Hi,
I have declared two types:
declare Motion
@role( event )
@expires( 5s )
@timestamp( eventTime )
eventTime : long
end
declare Recording
end
and following rules:
rule "StartRecording"
when
Motion()
not Recording()
then
insert(new Recording())
end
the problem is that when I put a lot of "motions", sleep (so "motions"
become expired) and then do fireAllRules(), I got "StartRecording" executed
multiple times (and not only once), event though Recording is inserted every
time.
It seems that inserting new recording does not cancel expired activations.
Is that correct? How to handle such situation correctly?
--
View this message in context: http://drools.46999.n3.nabble.com/Odd-rules-execution-for-expired-events-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
java.lang.NullPointerException at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:291)
by prem.kishore
Hi ,
I've below rule set up in Guvnor . This rule works fine when other java
application starts up and fetched the rule from Guvnor using knowledge Agent
.
rule "EL-AH-RESTRICT-LOGIN"
no-loop true
dialect "mvel"
when
lcki : LoginChallengeKI( eval( (lcki.getWS_RiskScore() >=
790 && (lcki.getWS_RiskScore() - lcki.getAvgRiskScore()) >= 500) ||
(lcki.getWS_RiskScore() >= 750 && ((lcki.getWS_RiskScore() -
lcki.getWS_RiskScore())/lcki.getWS_RiskScore()) >= 4) ||
(lcki.getWS_RiskScore() >= 750 && lcki.getWS_RiskScore() <= 350 ) ),
userEquityBalance >= 40 , hadPreviousChallenge == false , eval(
!lcki.getValidCookies().contains(lcki.getWS_Cookie()) &&
!lcki.getValidCookies().contains(lcki.getWS_FlashCookie()) ), eval(
lcki.getWS_IPAddr() != lcki.getIpAddr1() && lcki.getWS_IPAddr() !=
lcki.getIpAddr2() ), eval( lcki.getWS_Cookie() != lcki.getCookie1() &&
lcki.getWS_Cookie() != lcki.getCookie2() ), eval( lcki.getWS_FlashCookie()
!= lcki.getFlashCookie1() && lcki.getWS_FlashCookie() !=
lcki.getFlashCookie2() ), eval( lcki.getWS_GeoCity() != lcki.getGeoCity1()
&& lcki.getWS_GeoCity() != lcki.getGeoCity2() ), eval(
CheckAfterHour(lcki.WS_EventTimeStamp) ))
then
lcki.setRuleIDMapValue("ACT03","EL-AH-RESTRICT-LOGIN");
lcki.setChallenge(true);
lcki.setGenerateAlert(true);
end
But if i make any change in the in the guvnor and build the pkg then other
application throws below exception
org.drools.RuntimeDroolsException: Exception executing predicate
(lcki.getWS_RiskScore() >= 790 && (lcki.getWS_RiskScore() -
lcki.getAvgRiskScore()) >= 500) || (lcki.getWS_RiskScore() >= 750 &&
((lcki.getWS_RiskScore() - lcki.getWS_RiskScore())/lcki.getWS_RiskScore())
>= 4) || (lcki.getWS_RiskScore() >= 750 && lcki.getWS_RiskScore() <= 350 )
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:193)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:191)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:332)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:293)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:905)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at
com.etrade.jws.actimize.rule.RuleServiceImpl.applyLoginRules(RuleServiceImpl.java:38)
at
com.etrade.jws.actimize.service.LoginChallengeImpl.getLoginChallengeDecision(LoginChallengeImpl.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:60)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:244)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:291)
... 48 more
org.drools.RuntimeDroolsException: Exception executing predicate
(lcki.getWS_RiskScore() >= 790 && (lcki.getWS_RiskScore() -
lcki.getAvgRiskScore()) >= 500) || (lcki.getWS_RiskScore() >= 750 &&
((lcki.getWS_RiskScore() - lcki.getWS_RiskScore())/lcki.getWS_RiskScore())
>= 4) || (lcki.getWS_RiskScore() >= 750 && lcki.getWS_RiskScore() <= 350 )
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:193)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:191)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:332)
at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:293)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:905)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at
com.etrade.jws.actimize.rule.RuleServiceImpl.applyLoginRules(RuleServiceImpl.java:38)
at
com.etrade.jws.actimize.service.LoginChallengeImpl.getLoginChallengeDecision(LoginChallengeImpl.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:60)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:244)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:178)
at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:291)
... 48 more
--
View this message in context: http://drools.46999.n3.nabble.com/java-lang-NullPointerException-at-org-d...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months