Re: [rules-users] Duration attritube and Temporal Operators
Pretty sure I am correct, think the devs are at a conference this week in London. http://blog.athico.com/ 1)Start time , point time interval. 2)Don't know exactly, I think the documentation is just showing what is meant. But it does say you need to set at least the start time and duration. If you don't set the time stamp , it gets a timestamp of the time it was inserting into working memory and duration 0. 3)timestamp is the same as start time. if no duration is set In our rule set , I set a timestamp attribute, duration and also a endtimestamp. You can also do items like this , but reading the docs I am double checking timeEndMs after[-120s,120s] AND0.timeMs , More is in the http://docs.jboss.org/drools/release/5.4.0.Beta2/drools-fusion-docs/html/ch02.html#d0e289 I think the start and endtime time stamp statements in the documentation is for clarity. When working with the rules we have , reading the documentation let me know if the temporal operators is what I needed. On Mar 8, 2012 11:55 AM, mind gil.vegli...@gmail.com wrote: Hello everybody, I recently started using Drools (with C#) and I have some problems in understanding how temporal operators work with the duration field. According to the documentation, the temporal operators work with startTimestamp and endTimestamp of events, the semantics being defined with inequalities. In order to work, temporal operator requires the duration field to be declared. Now the questions: 1. What does @timeStamp stay for? The start or the end timestamp? 2. Does Drools calculate startTimestamp and endTimestamp if I set @timeStamp and @duration attribute from my C# code? If not how can I set them? (like shall I declare like @startTimeStamp(sth) and set from the C# code?) 3. Do temporal operators work if I do not set explicitly the start and end timestamps but just @timeStamp and @duration attributes? In particular, I have this drl file (%VAR% are replaced by other code): declare IntensionalEvent @role(event) @timeStamp(timeStamp) @duration(duration) end rule Expression (%EVENTNAME1%, %OPERATOR%, %EVENTNAME2%, %TIMESPAN%, %TIMEVAR%) dialect mvel when $eventA : IntensionalEvent( name == '%EVENTNAME2%' ) $eventB : IntensionalEvent( this %OPERATOR% $eventA, name == '%EVENTNAME1%' ) over window:time( %TIMESPAN% ) then blah blah... create an IntensionalEvent and set timestamp and duration end Thanks everybody, Gil -- View this message in context: http://drools.46999.n3.nabble.com/Duration-attritube-and-Temporal-Operators-tp3810201p3810201.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.ArrayIndexOutOfBoundsException thrown in mvel2's compiler when running drools5.3 final.
I am no drools expert but I am working a few mvel bugs in free time. I am still sorting through the code. I will try to work in test case but I don't know where the line Helper.containsAny(offerSubject, ((Set)colMap.get(_set_212))) is coming from. This isn't in one of your rules is it? The index out of bounds is from the mvel code. Pretty sure one of the project maintainers will give us more to go with. 2012/3/6 Miles Wen miles.w...@gmail.com: hi all, the exception below is usually thrown when the system is busy(usually 9-10 am everyday); The rules runs perfectly when unit test or any other time when the system is not very busy(like 22:00 - 4:00 every day); Our system processes 1300 pieces of data each day, with 4-5 java.lang.ArrayIndexOutOfBoundsException thrown on average.It's not very often but doubtful. The logs are shown below: 2012-03-07 10:10:33,683 [] ERROR ruleservice.RuleServiceImpl - Error occurred while invoking business filter! java.lang.reflect.InvocationTargetException at com.alibaba.china.avatar.offer.rulematch.OfferMatchFilter$$FastClassByCGLIB$$18f6f037.invoke(generated) at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) at com.alibaba.china.ruleservice.RuleServiceImpl.bindParamAndInvoke(RuleServiceImpl.java:264) at com.alibaba.china.ruleservice.RuleServiceImpl.match(RuleServiceImpl.java:82) at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at com.alibaba.china.avatar.interceptor.KeyDataLoggingAfterThrowingInterceptor.invoke(KeyDataLoggingAfterThrowingInterceptor.java:24) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at com.alibaba.dragoon.patrol.spring.DragoonMethodInterceptor.invoke(DragoonMethodInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy16.match(Unknown Source) at com.alibaba.china.avatar.offer.decode.OfferMessageAction.run(OfferMessageAction.java:39) at com.alibaba.china.rialto.core.module.DefaultActionModule.doWork(DefaultActionModule.java:375) at com.alibaba.china.rialto.core.module.DefaultActionModule.runModule(DefaultActionModule.java:252) at com.alibaba.china.rialto.core.module.ModuleRunner.run(ModuleRunner.java:31) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: org.drools.RuntimeDroolsException: Exception executing predicate Helper.containsAny(offerSubject, ((Set)colMap.get(_set_212))) 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:458) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215) at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845) at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255) at com.alibaba.china.ruleservice.session.impl.drools5.TransientDrools5Session.insertFact(TransientDrools5Session.java:100) at com.alibaba.china.avatar.offer.rulematch.OfferMatchFilter.doFilter(OfferMatchFilter.java:57) ... 23 more Caused by: [Error: unexpected end of statement] [Near : {... Helper.containsAny(offerSubject, ((Set)colMap.get(_set_212))) }] ^ [Line: 1, Column: 39] at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1215) at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128) at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2090) at org.mvel2.ast.Substatement.init(Substatement.java:37) at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1062) at
Re: [rules-users] java.lang.ArrayIndexOutOfBoundsException thrown in mvel2's compiler when running drools5.3 final.
Anyway to get a scrubbed rule ? I will throw it through a debug instance. Also what jdk/jre are you running on? On Tue, Mar 6, 2012 at 10:50 PM, pf_miles miles.w...@gmail.com wrote: Yes, the line: Helper.containsAny(offerSubject, ((Set)colMap.get(_set_212))) is part of my rule's LHS code. It acts as a normal predicate: Caused by: org.drools.RuntimeDroolsException: Exception executing predicate Helper.containsAny(offerSubject, ((Set)colMap.get(_set_35))) 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:458) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:386) at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:215) at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:244) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:330) at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:291) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886) at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:845) at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255) at com.alibaba.china.ruleservice.session.impl.drools5.TransientDrools5Session.insertFact(TransientDrools5Session.java:100) at com.alibaba.china.avatar.offer.rulematch.OfferMatchFilter.doFilter(OfferMatchFilter.java:57) ... 23 more Caused by: [Error: unexpected end of statement] [Near : {... Helper.containsAny(offerSubject, ((Set)colMap.get(_set_35))) }] ^ [Line: 1, Column: 39] at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1215) at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128) at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2090) at org.mvel2.ast.Substatement.init(Substatement.java:37) at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1062) at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128) at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62) at org.mvel2.MVEL.analyze(MVEL.java:680) at org.mvel2.compiler.PropertyVerifier.getMethod(PropertyVerifier.java:469) at org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:120) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:404) at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:141) at org.mvel2.ast.ASTNode.optimize(ASTNode.java:157) at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:113) at org.mvel2.MVELRuntime.execute(MVELRuntime.java:87) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122) at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:115) at org.mvel2.MVEL.executeExpression(MVEL.java:930) at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:100) at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:291) ... 35 more Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at org.mvel2.compiler.PropertyVerifier.getMethod(PropertyVerifier.java:565) at org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:120) at org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:381) at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:273) at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2090) at org.mvel2.ast.TypeCast.init(TypeCast.java:43) at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1047) ... 54 more -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-java-lang-ArrayIndexOutOfBoundsException-thrown-in-mvel2-s-compiler-when-running-drools5-tp3805739p3805889.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https
Re: [rules-users] 5.4.0.Beta2 parse error in consequence /* in string
Got permission from my company. Digging around think , correct me if I am wrong. The bug is actually most likely in the mvel project. I checked out the mvel project. In the mvel project there is method call skipWhiteSpace() . This method skips different types of comments. It is a minor issue. Just going to try start with something small. On Tue, Feb 28, 2012 at 9:45 AM, Benjamin Bennett benbenn...@gmail.com wrote: Working on the sign contributer agreement. Have to fill out the permission slip at the company I work for to contribute back in my free time. I submitted at merge request https://github.com/droolsjbpm/drools/pull/102 If the commit looks fine but just waiting on the Contributor Agreement . If there is something I did wrong in the commit or comment just looking for feedback. Just going to add the // /* to the array to test it. Yeah I didn't test the // with 5.3.0 but I am pretty sure it happens in latest master . I was going to use the commit https://github.com/benbennett/drools/commit/d5325b93589aafdfaeb1f45077eb4da3a8970a2f . And add // and /* to the array to cycle through. 2012/2/28 Mark Proctor mproc...@codehaus.org On 27/02/2012 15:44, Benjamin Bennett wrote: I had created issue JBRULES-3399 for the issue. I tracked it a bit , it is any comment. // or /* , think the lexar expression for comment isn't correct . I am working towards a fix but not a antlr expert. I have used yacc. just a reminder to read this page, on how to correctly comment your commits, how to submit pull requests etc: http://www.athico.com/Getting_Involved/gettinginvolved.html Mark On Mon, Feb 27, 2012 at 1:38 AM, Wolfgang Laun wolfgang.l...@gmail.com wrote: Submitted: JBRULES-3401. -W On 24/02/2012, Benjamin Bennett benbenn...@gmail.com wrote: Just passing on I am using the drools 5.4.0Beta2 The following doesn't compile using the mvel dialect . rule some rule when fact: Fact() then BasicFact fault= new BasicFact( /*); end but rule some rule when fact: Fact() then BasicFact fault= new BasicFact( / *); end does compile some how /* is being parsed as an expression I think and not a string literal. Thanks, Ben ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 5.4.0.Beta2 parse error in consequence /* in string
Working on the sign contributer agreement. Have to fill out the permission slip at the company I work for to contribute back in my free time. I submitted at merge request https://github.com/droolsjbpm/drools/pull/102 If the commit looks fine but just waiting on the Contributor Agreementhttp://www.athico.com/Getting_Involved/gettinginvolved.html#d0e319. If there is something I did wrong in the commit or comment just looking for feedback. Just going to add the // /* to the array to test it. Yeah I didn't test the // with 5.3.0 but I am pretty sure it happens in latest master . I was going to use the commit https://github.com/benbennett/drools/commit/d5325b93589aafdfaeb1f45077eb4da3a8970a2f. And add // and /* to the array to cycle through. 2012/2/28 Mark Proctor mproc...@codehaus.org On 27/02/2012 15:44, Benjamin Bennett wrote: I had created issue JBRULES-3399 for the issue. I tracked it a bit , it is any comment. // or /* , think the lexar expression for comment isn't correct . I am working towards a fix but not a antlr expert. I have used yacc. just a reminder to read this page, on how to correctly comment your commits, how to submit pull requests etc: http://www.athico.com/Getting_Involved/gettinginvolved.html Mark On Mon, Feb 27, 2012 at 1:38 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Submitted: JBRULES-3401. -W On 24/02/2012, Benjamin Bennett benbenn...@gmail.com wrote: Just passing on I am using the drools 5.4.0Beta2 The following doesn't compile using the mvel dialect . rule some rule when fact: Fact() then BasicFact fault= new BasicFact( /*); end but rule some rule when fact: Fact() then BasicFact fault= new BasicFact( / *); end does compile some how /* is being parsed as an expression I think and not a string literal. Thanks, Ben ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] 5.4.0.Beta2 parse error in consequence /* in string
I had created issue JBRULES-3399 for the issue. I tracked it a bit , it is any comment. // or /* , think the lexar expression for comment isn't correct . I am working towards a fix but not a antlr expert. I have used yacc. On Mon, Feb 27, 2012 at 1:38 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Submitted: JBRULES-3401. -W On 24/02/2012, Benjamin Bennett benbenn...@gmail.com wrote: Just passing on I am using the drools 5.4.0Beta2 The following doesn't compile using the mvel dialect . rule some rule when fact: Fact() then BasicFact fault= new BasicFact( /*); end but rule some rule when fact: Fact() then BasicFact fault= new BasicFact( / *); end does compile some how /* is being parsed as an expression I think and not a string literal. Thanks, Ben ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Removing many facts have invalid timestamp
It isn't duplicates but corrupted data coming off an vehicle. There is bug in the vehicle code that isn't zeroing out memory, or updating a time value during reset procedure which causes a bunch of facts to have the same end time stamp. We cannot really change the vehicle code because it was certified by the government and it is going to be a while before another one is certified. On Sat, Feb 25, 2012 at 1:00 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote: Would you please define unambiguously what constitutes an invalid time? From your code it would appear that one time has to occur fivefold or more often to be invalid. In case any duplicates should be removed a simple high-priority rule is sufficient: rule killDuplicate salience 1000 when $f1: Fact() $f2 :Fact( endTime == $f1.endTime ) then retract( $f2 ); end -W On 24/02/2012, Benjamin Bennett benbenn...@gmail.com wrote: Trying to figure out if it can be done in a rule almost some sort of pre rule before other rules are triggered. The current rule I have is rule RemoveInvalidEndTimestamps salience 100 when $factN : Fact() $factsToRemove : ArrayList(size=5) from collect( Fact(endTime==$factN.endTime)) then List newFactsToRemove = new ArrayList(); newFactsToRemove.addAll($factsToRemove); for(Fact n : newFactsToRemove ){ retract(n); } end I am using a cloud based process . I could sort the facts and stream them in. Just in a few test cases there are many facts with invalid times , which kills the speed . From the log I think that each collection of size=5 , is triggered which means triggered for 5,6,7, etc. Just wondering if there is way to say before doing any other rules collect up all these invalid times and remove them. I was just going to write up a some java code and filter before feeding facts into drools but I find the rule syntax is much easier to read for the non software developers in my group. -- Thanks, Benjamin Bennett benbenn...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Sincerely, Benjamin Bennett 314.246.0645 benbenn...@gmail.com For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. Richard Feynman ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Removing many facts have invalid timestamp
Trying to figure out if it can be done in a rule almost some sort of pre rule before other rules are triggered. The current rule I have is rule RemoveInvalidEndTimestamps salience 100 when $factN : Fact() $factsToRemove : ArrayList(size=5) from collect( Fact(endTime==$factN.endTime)) then List newFactsToRemove = new ArrayList(); newFactsToRemove.addAll($factsToRemove); for(Fact n : newFactsToRemove ){ retract(n); } end I am using a cloud based process . I could sort the facts and stream them in. Just in a few test cases there are many facts with invalid times , which kills the speed . From the log I think that each collection of size=5 , is triggered which means triggered for 5,6,7, etc. Just wondering if there is way to say before doing any other rules collect up all these invalid times and remove them. I was just going to write up a some java code and filter before feeding facts into drools but I find the rule syntax is much easier to read for the non software developers in my group. -- Thanks, Benjamin Bennett benbenn...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] 5.4.0.Beta2 parse error in consequence /* in string
Just passing on I am using the drools 5.4.0Beta2 The following doesn't compile using the mvel dialect . rule some rule when fact: Fact() then BasicFact fault= new BasicFact( /*); end but rule some rule when fact: Fact() then BasicFact fault= new BasicFact( / *); end does compile some how /* is being parsed as an expression I think and not a string literal. Thanks, Ben ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users