Backward chaining in drools 5?
by Alberto Cabas Vidani
I read the information available about drools 5, but support to backward
chaining is never mentioned. Since in the documentation of Drools 4 it's
said that it will be supported in the next major release I'm wondering
wether it will be present in release 5. Does anyone know something about it?
Alberto
15 years, 8 months
ClassCastException when firing rules
by seemamani
hi,
We are using Drools 4.0.7 in a web application deployed in WebSphere 6.1.
Occasionally, we have rule engine failure caused by RuntimeDroolsException
(whose root cause is shown as ClassCastException) when firing rules. Other
times, the rules are executing without errors. Here is the stack trace of
the exception. What are the possible reasons?
Thanks,
Seema
org.drools.RuntimeDroolsException: Exception executing predicate eval(
inventory.leaseInformation != null )
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:911)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)
at
com.adesa.business.framework.rules.process.drools.ManagedStatefulSession.init(ManagedStatefulSession.java:87)
at
com.adesa.business.framework.rules.process.drools.ManagedStatefulSession.fireAllRules(ManagedStatefulSession.java:100)
at
com.adesa.business.framework.rules.process.drools.RuleEngineImpl.execute(RuleEngineImpl.java:60)
at
com.adesa.business.framework.rules.interceptor.RulesInterceptor.applyAnnotedRules(RulesInterceptor.java:109)
at
com.adesa.business.framework.rules.interceptor.RulesInterceptor.applyRules(RulesInterceptor.java:80)
at sun.reflect.GeneratedMethodAccessor575.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:597)
at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:583)
at
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:60)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
at
com.adesa.business.rules.RuleHandler$$EnhancerByCGLIB$$3ab6eda.fireUpdatePricing(<generated>)
at
com.adesa.business.auction.manager.SaleEventManagerImpl.updatePricing(SaleEventManagerImpl.java:2599)
at
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfAuction(SaleEventManagerImpl.java:1993)
at
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGroundingSaleEventForHyundai(SaleEventManagerImpl.java:1783)
at
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGroundingSaleEvent(SaleEventManagerImpl.java:1180)
at
com.adesa.business.auction.manager.SaleEventManagerImpl.cascadeAtEndOfGroundingSaleEvent(SaleEventManagerImpl.java:1134)
at
com.adesa.business.auction.service.AuctionServiceImpl.cascadeAtEndOfGroundingSaleEvent(AuctionServiceImpl.java:766)
at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
at
com.adesa.business.framework.logging.LoggingInterceptor.profileLog(LoggingInterceptor.java:136)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:597)
at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:583)
at
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:60)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:54)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:54)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy58.cascadeAtEndOfGroundingSaleEvent(Unknown Source)
at
com.adesa.business.pricing.ejb.PricingBean.updateMBPPrice(PricingBean.java:112)
at
com.adesa.business.pricing.ejb.EJSRemoteStatelessPricing_a0966b04.updateMBPPrice(EJSRemoteStatelessPricing_a0966b04.java:183)
at
com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie.updateMBPPrice(_EJSRemoteStatelessPricing_a0966b04_Tie.java:243)
at
com.adesa.business.pricing.ejb._EJSRemoteStatelessPricing_a0966b04_Tie._invoke(_EJSRemoteStatelessPricing_a0966b04_Tie.java:108)
at
com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2701)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2575)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by:
java.lang.ClassCastException: com.adesa.data.grounding.pojo.Inventory
incompatible with
com.adesa.data.grounding.pojo.Inventory$$EnhancerByCGLIB$$de81aab3
at ASMAccessorImpl_11448003161226563261710.getValue(Unknown Source)
at
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
at
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
at
org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:45)
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:209)
--
View this message in context: http://www.nabble.com/ClassCastException-when-firing-rules-tp20694738p206...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 9 months
JBoss Rules as a Daemon Service
by Arjun Dhar
Hi,
I uploaded the JBoss Rules 4 WAR; I saw the repository options but no admin
console to run a service. Maybe I'm missing something?!?!
Q) Being under the cover of the JBoss server am sure there must be some
fascility to run this as a daemon service 'out of the box'! Right?? <--
Important
(posted this 3 days ago but it got lost somwhere; prob deleted the approval
mail; FYI not being impatient :o) but its important so would like to know)
Thanks!
15 years, 9 months
using BigDecimal in rules
by Marina
Hi,
I'm getting unexpected results when when using BigDecimal objects for matching in rules.
I'm generating DRL in my code, using freemaker.
I have a RuleEngineNumericFact object which has two attributes:
String propertyName
BigDecimal propertyValue
Below is an example of a rule where I try to match a RuleEngineNumericFact object based on the two attributes:
rule "aaa"
agenda-group "r1"
dialect "java"
when
(RuleEngineNumericFact( propertyName == "somename" , propertyValue == 10.8 ))
then
String ruleId = drools.getRule().getName();
firedRuleIDs.add(ruleId);
end
Then I create a new RuleEngineNumericFact object and set its propertyValue as following:
String stringValue = "10.8";
BigDecimal propertyValue = new BigDecimal(stringValue, new MathContext(10));
(I also tried to use default precision settings by creating the BigDecimal value as:
BigDecimal propertyValue = new BigDecimal(stringValue);
)
When I insert this fact into the rule engine - the rule does not get fired, so the fact does not match.
One note: if the values are integeres (like, propertyValue == 100) - the rule gets fired. So, it is only the floating point numbers that do not match.
I generate the DRL in my Java code, using freemaker, and I specify the
value that will be used in the rule for matching by calling toString()
method on a BigDecimal object that I get from my business code. The toString() representation ends up to be the "10.8" value (for example).
According to the BigDecimal documentation, marshalling from/to the same string representation shoudl still produce BigDecimal objects that will return TRUE from the equals() method when compared.
any ideas why this is not working here?
How does Drools compare values of objects like BigDecimal?
thanks,
Marina
15 years, 9 months
Localization in DSL
by Shigeaki Wakizaka
Hello.
I'd like to use Japanese in DSL.
Is it possible?
Do you have a plan to do the localize-thing with DSL and
brand-new BRMS?
Thanks in advance
Shige
15 years, 9 months
RuleAgent question
by J Michael Dean
Two questions. I am interested in using RuleAgent but with the file
or dir property rather than the URL. However, it is not clear to me
where the directories or files must actually be located. If I use
dir=/
then the DirectoryScanner is invoked and claims to have found some
number of files, but I have no idea WHERE it is scanning. If I add
anything like dir=/foo then I get an invalid directory exception.
If I try file=/foo.pkg then I get exception that this is invalid file.
Question 1 - is there an example somewhere that can help me understand
where I am going off the track? I am working Eclipse environment.
Question 2 - if using the BRMS and URL, can there be a backup dir,
file, or cache option that is in the classpath rather than a specific
directory? I would like to distribute an Eclipse application that has
a rule package deployed, but that overrides this with the URL if
available.
Thanks.
- Mike
15 years, 9 months
StatefulKnowledgeSession insert Fact using Dynamic option ?
by Remi Barraquand
Hi everyone,
Well i'm trying to upgrade my project to use the last Drools 5.0 API
(5.0.0.M4) and i don't understand something, where is the insert(Object
object, boolean dynamic) method gone ?
In the project i'm working on, one important aspect is to be able to change
the properties of a fact both from Java side and from Drools side. That is
calling
myFact.setPropertyName(theValue);
on the java side should modify the fact in the working memory and of course
doing
modify( $myFact ) {
property = theValue
}
in a rule should modify the value of that fact on the java side.
In the 4.0.7 version of drools i was using firePropertyChange in each setter
to propagate the change, and i inserted each fact in the working memory
using the insert(myFact, true) method. However in the new 5.0 API this
function is gone from the StatefulKnowledgeSession class
(WorkingMemoryEntryPoint).
How could i use dynamic fact using Drools 5.0 ? what should i need to
change, or what i did i miss ? :)
Thanks a lot for any help.
Rémi
-----
________________________________________
Rémi Barraquand, PhD I.N.P.G
Projet PRIMA - Laboratoire LIG
INRIA Grenoble Rhones-Alpes Research Centre
655 Ave de l'Europe
38330 Montbonnot, France
http://barraquand.fr Barraquand
http://bois-chauffage.fr Bois de Chauffage
http://ecoboisenergie.fr Eco Bois Energie
http://venteboisdechauffage.com Vente Bois de Chauffage
--
View this message in context: http://www.nabble.com/StatefulKnowledgeSession-insert-Fact-using-Dynamic-...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 10 months
Combining JSP pages and Drools 5
by Femke De Backere
Hi!
Is there any possibility to combine the use of JSP pages, or another
webtechnology and Drools 5 Ruleflow? I'm really stuck on the human
tasks and I wanted to try it in another way. Or where can I find a
specific example of a ruleflow with human tasks included?
Thx!
Femke
15 years, 10 months
Drools Community Clinic Feb 4th 5PM GMT
by Mark Proctor
I'm going to try an informal experiment for the 4th of February at 5PM
GMT (Date/Time subject to change), we will run an online Drools Clinic
in the form of a Webinar. So the idea here isn't of a 60 minute
presentation, but really more of a 60 minute interactive Q&A where we
will use the desktop to assist in some explanations talking through code
or examples. What do people think?
Ideally we would have a set of pre-determined questions, with some adhoc
ones on the day too. Feel free to start listing your Qs here. I want to
avoid "What's WorkingMemory" type questions, but other than that,
anything is game. Also if anyone has anything cool they would like to
discuss about how they have used Drools, or just general interesting AI
ideas, then that's fine too - happy for this just to turn into a fun
geek chat too.
Mark
15 years, 10 months
RE: [rules-users] Parsing XML using Drools
by Anstis, Michael (M.)
I am not sure on what you are trying to achieve.
Drools is a Rule Engine and not a XML parser; the nearest I could find
to what you are reporting ("I know XML Streaming is possible in Drools")
is the following.
http://netzooid.com/blog/2007/03/16/sxc-simple-xml-compiler-jaxb-runtime
-streaming-xpath-implementation-and-more/
Can you enlighten me with your knowledge of XML Streaming in Drools?
________________________________
From: Gupta, Ankit (Ankit) [mailto:gupta11@avaya.com]
Sent: 29 January 2009 10:04
To: Anstis, Michael (M.)
Subject: RE: [rules-users] Parsing XML using Drools
Hi Mike,
Thanks for prompt reply ,
Actually right now I am streaming the xml
<BenchmarkResultsFor>
<Benchmark>DataProcessing</Benchmark>
<Workload>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16</Workload>
<Memory>4, 4, 4, 8, 8, 12, 12, 16, 24, 24, 24, 24, 24, 24,
24, 24</Memory>
</BenchmarkResultsFor>
here we are using apache math api for interpolation
public MemoryBenchmarkResult(String name, double[] x, double[]
y) {
this.hostFunction = name;
// Create the interpolation function
SplineInterpolator i1 = new SplineInterpolator();
this.workload = x;
this.memory = y;
this.interpolator = i1.interpolate(this.workload, this.memory);
}
here we are passing the values of X Axis (Workload) and we get
the values of Y Axis (Memory ). Reading or Streaming of this XML are
doing using SAX .
This thing I want to do with Drools ...... as I know XML
Streaming is possible in Drools .
Regards
Ankit
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Thursday, January 29, 2009 2:48 PM
To: Rules Users List
Subject: RE: [rules-users] Parsing XML using Drools
It is not clear how you want to use the XML?
If the XML represents Facts then you could use a worker Fact and
"FROM" to deserialise them and make them available to WM. For example:-
rule "get some XML facts"
when
$w : Worker()
Cheese( ) from $w.getCheesesFromXML();
then
//Do something with cheese
end
Obviously the XML need not be true serialised objects (in a JAXB
sense) but simply the properties that "getCheeseFromXML" rehydrates.
Drools is not exposing any of the XML libraries; they are merely
used by your code. The above would be (partially) equivalent to:-
Worker w = new Worker();
List<Cheese> cheeses = w.getCheesesFromXML();
for(Cheese c : cheeses) {
wm.insert(c);
}
rule "Cheese pre-loaded"
when
Cheese( )
then
//Do something with cheese
end
Partially equivalent as you could retract Cheese( ) in the
second way which would affect truth maintenance whereas the first way
would (I believe) not.
With kind regards,
Mike
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Gupta, Ankit
(Ankit)
Sent: 29 January 2009 07:22
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Parsing XML using Drools
Hi All,
How can we read and parse a XML file using
drools ?
Does Drools support the SAX or DOM parsing .
Regards
Ankit
15 years, 11 months