Why is a flat object recommended?
by Christie, Blair
In the documents this is dicussed briefly:
"). Object models can often have complex relationships and hierarchies
in them - for rules you will want to simplify and flatten the model
where possible, and let the rule engine infer relationships (as it
provides future flexibility."
What does it mean that the rule engine can infer relationships?
Are there performance reasons for having a flat model?
Cheers,
Blair
15 years, 3 months
CEP functionality
by David Boaz
Dear all,
We posted this question two weeks ago, but with no replies. please forgive
me for posting it again.
In our business, most of the facts have time-stamp attributes. For example,
each laboratory test (a fact) has the time stamp when the sample was taken,
and when the machine produced the result value. In our business-logic, we
often analyze the relation between facts using these attributes.
For example:
1) finding two adjacent labResults with an increasing value
2) checking whether 3 facts are consecutive
3) counting the number of facts fulfilling a specific constraint within a
specific time window.
We were happy to read (in the blog) about the new CEP feature which is about
to be added to drools 5.0.
* Where can we find a more detailed description of CEP functionality in
drools?
* Is it a good idea to use CEP for analyzing historic data (retrieved from
the database)? or is it best for online data.
* Can we use CEP in a stateless session?
* As we understand, CEP attaches to each fact a temporal attribute of the
assertion time. Can we define that a particular attribute (e.g.,
LabResult.samplingDate) will be used as the time stamp? Or, should we assert
the facts by their temporal order, and advance the session-clock
appropriately?
* Can we use CEP to analyze the data in the examples above?
Many thanks for the help, David
--
View this message in context: http://www.nabble.com/CEP-functionality-tp19020709p19020709.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
Stateless session and rule flows
by Yoni Mazar
Hi Guys,
We are trying to work with drools with stateless session (Sequential) and to
apply rule flows.
we use the following code:
//define diagnosis and patient here
...
StatelessSession session = ruleBase.newStatelessSession();
//Here we would like to use: session.startProcess("ruleflow id") but this is
a method which belongs to
//StatefullSession only.
session.execute(new Object[] {diagnosis, patient});
How can we do that in steteless mode?
Thanks,
Yoni
--
View this message in context: http://www.nabble.com/Stateless-session-and-rule-flows-tp17863849p1786384...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
problem escaping quote in eval
by samlotti
Hello,
I'm trying to construct a rule in drool V4 that contains and eval and a
literal string that may contain quotes. I've tried escaping the quote but
get the error below. The \" works outside an eval.
rule "evalList2"
when
Var( eval( "tt".equals("t\"t")))
then
System.out.println( "evalList2" );
end
Error:
java.lang.NullPointerException:
at
org.drools.rule.PredicateConstraint.createContextEntry(PredicateConstraint.java:201)
at org.drools.reteoo.AlphaNode.createMemory(AlphaNode.java:230)
...
It looks like a change was made to V3 to fix this but doesnt appear to work
in V4, does anyone know how to construct this type of rule?
Thanks
Sam
--
View this message in context: http://www.nabble.com/problem-escaping-quote-in-eval-tp19186015p19186015....
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
Drools 4.0.7 - Rules not fired
by Benoit VILLAUMIE
Hello,
I am using Drools engine 4.0.7 and Eclipse 3.3 drools plugin.
I have a very basic/dumb problem but I do not understand where my error is :
I have 2 rules
---------------------------------
package poc
import poc.FlashFact;
*rule "HP one"*
when
FlashFact( homepage == "one");
then
System.out.println("*** HP one");
end
*rule "HP commons"*
when
FlashFact();
then
System.out.println("*** HP commons ");
end
----------------------------------
I insert a FlashFact which homepage is set with "one" value.
In my understanding, both rules "HP one" and "HP commons" should be
fired. Instead, only "HP commons" is launched. I have compared with the
Drools State example (which works fine), but I do not notice nothing.
Thanks for your help.
The code of the FlashFact class
---------------------------------
package poc;
public class FlashFact {
public FlashFact() {
this(null);
}
public FlashFact(String homepage) {
this.setHomepage(homepage);
}
private String homepage;
/**
* @return the homepage
*/
public final String getHomepage() {
return this.homepage;
}
/**
* @param homepage the homepage to set
*/
public final void setHomepage(String homepage) {
this.homepage = homepage;
}
}
---------------------------------
The code of the launcher
---------------------------------
package poc;
import java.io.InputStreamReader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.audit.WorkingMemoryFileLogger;
import org.drools.compiler.PackageBuilder;
public class FlashUndeployedRulesMain {
public static void main(String[] args) throws Exception {
StatefulSession session = null;
WorkingMemoryFileLogger logger = null;
try {
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(
FlashUndeployedRulesMain.class.getClassLoader()
.getResourceAsStream(RULE)));
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
session = ruleBase.newStatefulSession();
logger = new WorkingMemoryFileLogger(
session);
logger.setFileName("log/flash");
// inserting facts
FlashFact HPFrance = new FlashFact("one");
session.insert(HPFrance);
session.fireAllRules();
} finally {
if(session != null) {session.dispose();}
if(logger != null) {logger.writeToDisk();}
}
}
private static final String RULE = "poc/Flash.drl";
---------------------------------
15 years, 7 months
using matches in a collection
by ygaurav
Hi All
i am new to drools and I am hoping that some body can help me out here.
I data in string array and I would like to check if one of the entry starts
with the string I have. How can check it ?
Code is shown below
@java
class ABC {
String[] array = new String[]{"abcdef","ghijkl","mnopqrst"}
}
@drools
rule "check something"
when
$abc : ( ABC.array contains a single entry which start with "abc" )
Is there a way I can do it ? If it is not possible what is way I can achive
it
Thanks
--
View this message in context: http://www.nabble.com/using-matches-in-a-collection-tp18115893p18115893.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 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, 8 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, 8 months