Re: [rules-users] PatternBuilder createRestriction bug on Drools 5.1.1
, This is a bug: trying to create a restriction for an empty restriction list for field ' + fieldConstraintDescr.getFieldName() + ' in the rule ' + context.getRule().getName() + ' ) ); return null; } Kind regards, Manuel Ortiz. 2011/12/22 Wolfgang Laun wolfgang.l...@gmail.com Now would you mind posting an example reproducing this error... -W On 22/12/2011, Manuel Ortiz manuel.ortizra...@gmail.com wrote: Dear Sirs: I'm working on an application which writes a set of rules using information which is stored in BDD tables. This information can be 'wrong' concerning rule compilation, and I expect that Drools reports the corresponding compilation errors. I've found that PatternBuilder.createRestriction() fails to process composite restrictions when one of the single restrictions cannot be implemented. The problem is that although one of the sigle restrictions is returned null, the composite restriction array is succesfully returned, one of its elements being null, wich causes a NullPointerException when the composite restriction is processed in PatternBuilder.build(AbstractCompositeConstraint version) to obtain a MultiRestrictionFieldConstraint object. I would like to know if this bug has yet been reported and fixed in some Drools version beyond 5.1.1 Thank you very much for your time. Kind regards, Manuel Ortiz ___ 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] PatternBuilder createRestriction bug on Drools 5.1.1
Dear Wolfgang: Sorry, I don't understand your answer very well. The bug I report has to do with composite restrictions, not with static variable declarations. Maybe my bug description is not very good. I used Hello world example described at http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch08.html#d0e6981 changing the first single restriction to a composite restriction in which the second part of the restriction compares an int to a string literal to fire a wrong type rule compile error. But as this second restriction belongs to a composite restriction, the composite one is created with a null component, no compile error reported. I understand that Message.HELLO is correctly declared in the Hello World example project and that this static variable shouldn't be a problem at compiling. In fact, if you change the static variable by a literal number, the error would be the same. Sorry for my english. I hope this explanation helps to understand the bug. Kind regards, Manuel Ortiz. 2011/12/22 Wolfgang Laun wolfgang.l...@gmail.com Using an undeclared static variable (Message.HELLO) wasn't handled cleanly in 5.1.1. This has been fixed in 5.2.0. -W 2011/12/22 Manuel Ortiz manuel.ortizra...@gmail.com: Dear Wolfgang: Just change the Hello World rule in the Hello World example by this one... rule Hello World when m : Message( status == Message.HELLO || != WrongType, myMessage : message ) then System.out.println( myMessage ); m.setMessage( Goodbye cruel world ); m.setStatus( Message.GOODBYE ); update( m ); end ...and you will get the following building error: Description Resource Path Location Type Error: java.lang.NullPointerException Sample.drl /DroolsTest2/src/main/rules Unknown Drools Error This NullPointerException breaks the normal drools compiler execution flow. In contrast, if you use the following Hello World rule... rule Hello World when m : Message( status != WrongType, myMessage : message ) then System.out.println( myMessage ); m.setMessage( Goodbye cruel world ); m.setStatus( Message.GOODBYE ); update( m ); end ...then you get the following building errors: Description Resource Path Location Type BuildError: Unable to create a Field value of type 'ValueType = 'int'' and value 'WrongType' Sample.drl /DroolsTest2/src/main/rules Unknown Drools Error BuildError: Unable to create restriction '[LiteralRestriction: != WrongType]' for field 'status' in the rule 'Hello World' Sample.drl /DroolsTest2/src/main/rules line 7 Drools Error which don't break the drools compiler execution flow. I think this one should be the right output for the first example. Below you can find my fix to this problem, based on the assumption that createRestriction must return null if the restriction (neither composite nor simple) cannot be constructed. At PatternBuilder.java, substitute createRestriction by... private Restriction createRestriction(final RuleBuildContext context, final Pattern pattern, final FieldConstraintDescr fieldConstraintDescr, final RestrictionConnectiveDescr top, final InternalReadAccessor extractor) { Restriction[] restrictions = new Restriction[top.getRestrictions().size()]; int index = 0; for ( Iterator it = top.getRestrictions().iterator(); it.hasNext(); ) { RestrictionDescr restrictionDescr = (RestrictionDescr) it.next(); if ( restrictionDescr instanceof RestrictionConnectiveDescr ) { restrictions[index] = this.createRestriction( context, pattern, fieldConstraintDescr, (RestrictionConnectiveDescr) restrictionDescr, extractor ); } else { restrictions[index] = buildRestriction( context, pattern, extractor, fieldConstraintDescr, restrictionDescr ); if ( restrictions[index] == null ) { context.getErrors().add( new DescrBuildError( context.getParentDescr(), fieldConstraintDescr, null, Unable to create restriction ' + restrictionDescr.toString() + ' for field ' + fieldConstraintDescr.getFieldName() + ' in the rule ' + context.getRule().getName() + ' ) ); } } if(restrictions[index] == null) { index = 0; break; } else { index++; } } if(index == 0
Re: [rules-users] PatternBuilder createRestriction bug on Drools 5.1.1
Thank you very much Wolfgang. Then I understand that this composite restriction compiling error is fixed in 5.2.0. Isn't it? Thank you again for your time. Kind regards, Manuel Ortiz. 2011/12/22 Wolfgang Laun wolfgang.l...@gmail.com Sorry - I should have made it clear that it doesn't matter *why* one of the components of a composite restriction is in error. Either a missing declaration or a type incompatibility - it results in a null reference, and some agent processing this doesn't check. -W 2011/12/22 Manuel Ortiz manuel.ortizra...@gmail.com: Dear Wolfgang: Sorry, I don't understand your answer very well. The bug I report has to do with composite restrictions, not with static variable declarations. Maybe my bug description is not very good. I used Hello world example described at http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch08.html#d0e6981 changing the first single restriction to a composite restriction in which the second part of the restriction compares an int to a string literal to fire a wrong type rule compile error. But as this second restriction belongs to a composite restriction, the composite one is created with a null component, no compile error reported. I understand that Message.HELLO is correctly declared in the Hello World example project and that this static variable shouldn't be a problem at compiling. In fact, if you change the static variable by a literal number, the error would be the same. Sorry for my english. I hope this explanation helps to understand the bug. Kind regards, Manuel Ortiz. 2011/12/22 Wolfgang Laun wolfgang.l...@gmail.com Using an undeclared static variable (Message.HELLO) wasn't handled cleanly in 5.1.1. This has been fixed in 5.2.0. -W 2011/12/22 Manuel Ortiz manuel.ortizra...@gmail.com: Dear Wolfgang: Just change the Hello World rule in the Hello World example by this one... rule Hello World when m : Message( status == Message.HELLO || != WrongType, myMessage : message ) then System.out.println( myMessage ); m.setMessage( Goodbye cruel world ); m.setStatus( Message.GOODBYE ); update( m ); end ...and you will get the following building error: Description Resource Path Location Type Error: java.lang.NullPointerException Sample.drl /DroolsTest2/src/main/rules Unknown Drools Error This NullPointerException breaks the normal drools compiler execution flow. In contrast, if you use the following Hello World rule... rule Hello World when m : Message( status != WrongType, myMessage : message ) then System.out.println( myMessage ); m.setMessage( Goodbye cruel world ); m.setStatus( Message.GOODBYE ); update( m ); end ...then you get the following building errors: Description Resource Path Location Type BuildError: Unable to create a Field value of type 'ValueType = 'int'' and value 'WrongType' Sample.drl /DroolsTest2/src/main/rules Unknown Drools Error BuildError: Unable to create restriction '[LiteralRestriction: != WrongType]' for field 'status' in the rule 'Hello World' Sample.drl /DroolsTest2/src/main/rules line 7 Drools Error which don't break the drools compiler execution flow. I think this one should be the right output for the first example. Below you can find my fix to this problem, based on the assumption that createRestriction must return null if the restriction (neither composite nor simple) cannot be constructed. At PatternBuilder.java, substitute createRestriction by... private Restriction createRestriction(final RuleBuildContext context, final Pattern pattern, final FieldConstraintDescr fieldConstraintDescr, final RestrictionConnectiveDescr top, final InternalReadAccessor extractor) { Restriction[] restrictions = new Restriction[top.getRestrictions().size()]; int index = 0; for ( Iterator it = top.getRestrictions().iterator(); it.hasNext(); ) { RestrictionDescr restrictionDescr = (RestrictionDescr) it.next(); if ( restrictionDescr instanceof RestrictionConnectiveDescr ) { restrictions[index] = this.createRestriction( context, pattern, fieldConstraintDescr, (RestrictionConnectiveDescr) restrictionDescr, extractor ); } else { restrictions[index] = buildRestriction( context, pattern, extractor, fieldConstraintDescr, restrictionDescr ); if ( restrictions
[rules-users] PatternBuilder createRestriction bug on Drools 5.1.1
Dear Sirs: I'm working on an application which writes a set of rules using information which is stored in BDD tables. This information can be 'wrong' concerning rule compilation, and I expect that Drools reports the corresponding compilation errors. I've found that PatternBuilder.createRestriction() fails to process composite restrictions when one of the single restrictions cannot be implemented. The problem is that although one of the sigle restrictions is returned null, the composite restriction array is succesfully returned, one of its elements being null, wich causes a NullPointerException when the composite restriction is processed in PatternBuilder.build(AbstractCompositeConstraint version) to obtain a MultiRestrictionFieldConstraint object. I would like to know if this bug has yet been reported and fixed in some Drools version beyond 5.1.1 Thank you very much for your time. Kind regards, Manuel Ortiz ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] MUTEX, mutual exclusion in Drools?
Hello itchupe: I think you mean what in Drools is called SALIENCE. Look for that rule attribute in.. http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch04.html#d0e3573 Best regards, Manuel Ortiz. 2011/6/28 itchupe itch...@gmail.com Hello there I am new to all drools... How can I 'mutex' in drools? Or could you suggest a better concept for that? (i mean, when two rules would fire : rule1 and rule2 in agenda the mutex is checked and : mutex for this case is defined, rule1 = higher, rule2 = lower prio only the one rule with higher priority will be executed) Cheers. Please let me know if my question is understandable... -- View this message in context: http://drools.46999.n3.nabble.com/MUTEX-mutual-exclusion-in-Drools-tp3117430p3117430.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] Terminating service threads
Wolfgang Laun wolfgang.laun at gmail.com writes: Both ResourceChange... classes have a stop() method which ought to terminate the threads.-W 2011/6/9 Manuel Ortiz manuel.ortizramos at gmail.comHello everybody: I have a Drools based application which instantiates KnowledgeAgent and ResourceChangeNotifier and ResourceChangeScanner services, and see in Eclipse Debug Tab that these classes run three threads. When my own threads end, including main thread, these three threads keep running. How can I terminate these threads? Thank you very much in advance for your time. Kind regards, Manuel Ortiz. ___ rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users at lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users Dear Wolfgang: Thank you for your quick answer. I've tried ResourceChange...stop() method in the finalize() method of the context class that instantiates the rule engine classes, but threads doesn't stop. Maybe I'm not using the method correctly. Can you tell me something about terminating KnowledgeAgentImpl$ChangeSetNotificationDetector.run(), which seems a thread related to KnowledgeAgent? Thank you again for your time. Kind regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Terminating service threads
Manuel Ortiz manuel.ortizramos at gmail.com writes: Wolfgang Laun wolfgang.laun at gmail.com writes: Both ResourceChange... classes have a stop() method which ought to terminate the threads.-W 2011/6/9 Manuel Ortiz manuel.ortizramos at gmail.comHello everybody: I have a Drools based application which instantiates KnowledgeAgent and ResourceChangeNotifier and ResourceChangeScanner services, and see in Eclipse Debug Tab that these classes run three threads. When my own threads end, including main thread, these three threads keep running. How can I terminate these threads? Thank you very much in advance for your time. Kind regards, Manuel Ortiz. ___ rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users Dear Wolfgang: Finally I found the way to make these methods work, and the way to start/stop ChangeSetNotificationDetector. Thank you again for your help. Best regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Terminating service threads
Hello everybody: I have a Drools based application which instantiates KnowledgeAgent and ResourceChangeNotifier and ResourceChangeScanner services, and see in Eclipse Debug Tab that these classes run three threads. When my own threads end, including main thread, these three threads keep running. How can I terminate these threads? Thank you very much in advance for your time. Kind regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Avoiding log or error messages on console
Hi everybody: I'm developing a Drools based application which has to show no messages on console, but on log files or so. I've diverted these kind of messages to a log file, but there is one at the beginning of the application, when the change set is read... (null: 6, 188): cvc-elt.1: Cannot find the declaration of element 'change-set'. ... which still appears on console. I've read that this message doesn't affect rule engine behaviour, but I would like it not to be shown on console. Does anybody know how can I solve this problem? Thank you in advance. Best regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] New in Drools: Updating facts retrieved in queries
Hello everybody: I have two question related to queries: First one, the one in the subject, I have a query which retrieves facts which have to be modified and updated in working memory. I've seen that the StatefulKnowledgeSession.update() method has the fact handle as input. Is it possible to set the fact handle to null? If it isn't, how can I get the fact handle using the fact retrieved with the query? Second one, related to writing, I though of parameterizing the query using the fact pattern, something like this, query alarmExists (AlarmFact key) $alarm : AlarmFact(key1 == key.key1, key2 == key.key2, key3 == key.key3 ) end but the rule compiler doesn't accept this sintax. Is it a requirement that query parameters are basic java types or is there a way to write this query using more complex Object parameters? Thank you for your time. Best Regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] New in Drools: Updating facts retrieved in queries
Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 190 Drools Error BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup6 ]' for field 'strAgrup6' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 191 Drools Error BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup7 ]' for field 'strAgrup7' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 192 Drools Error BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup8 ]' for field 'strAgrup8' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 193 Drools Error BuildError: Unable to create restriction '[QualifiedIndentifierRestr: == referencia.strAgrup9 ]' for field 'strAgrup9' in the rule 'existe Alarma' AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules line 194 Drools Error Thank you very much for your time, Wolfgang. Best regards, Manuel Ortiz. 2011/4/29 Wolfgang Laun wolfgang.l...@gmail.com You can call FactHandle fh = kSession.getFactHandle( factObj ); query alarmExists (AlarmFact key) should work in 5.1.1 and 5.2. Did you import AlarmFact in the DRL? Otherwise, what message are you getting in which version? -W 2011/4/29 Manuel Ortiz manuel.ortizra...@gmail.com Hello everybody: I have two question related to queries: First one, the one in the subject, I have a query which retrieves facts which have to be modified and updated in working memory. I've seen that the StatefulKnowledgeSession.update() method has the fact handle as input. Is it possible to set the fact handle to null? If it isn't, how can I get the fact handle using the fact retrieved with the query? Second one, related to writing, I though of parameterizing the query using the fact pattern, something like this, query alarmExists (AlarmFact key) $alarm : AlarmFact(key1 == key.key1, key2 == key.key2, key3 == key.key3 ) end but the rule compiler doesn't accept this sintax. Is it a requirement that query parameters are basic java types or is there a way to write this query using more complex Object parameters? Thank you for your time. Best Regards, Manuel Ortiz. ___ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] New in Drools: Updating facts retrieved in queries
Hi Wolfgang: Thank you very much for the explanation. Now everyting works fine. Best regards, Manuel Ortiz. 2011/4/29 Wolfgang Laun wolfgang.l...@gmail.com 2011/4/29 Manuel Ortiz manuel.ortizra...@gmail.com import es.simcasva.alarmas.src.MDSVHechoAlarma; query existe Alarma (MDSVHechoAlarma referencia) $alarma : MDSVHechoAlarma( iIdAlarma == referencia.iIdAlarma, The reported errors are: Description Resource Path Location Type BuildError: Not possible to directly access the property 'iIdAlarma' of declaration 'referencia' since it is not a pattern AlarmaReglasGenerales.drl /aitor/es/simcasva/alarmas/rules Unknown Drools Error referencia is a query parameter (and not a variable bound to a fact); to access any of its fields or methods you must use Java notation, requiring you to use a return value restriction, hence the parentheses: $alarma : MDSVHechoAlarma( iIdAlarma == ( referencia.getIIdAlarma() ), ___ 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
[rules-users] Trying to compare int and String objects
Hello everybody: I'm trying to write rules in which fact int attributes and fact String attributes should be compared in condition elements. When I compare them, let's say from int to String, rule when Fact1($intAttr : attrInt1) Fact2(attrString == $intAttr) the rule seems to behave OK, whereas when I compare them from String to int, rule when Fact1($stringAttr : attrString1) Fact2(attrInt == $stringAttr) I get a RuntimeDroolsException( Conversion to long not supported from java.lang.String). I've taken a look at the code which throws the exception, BaseObjectClassField.getLongValue() and found that it only accepts Number and Date objects to be converted to long. ... if ( value instanceof Number ) { return ((Number) value).longValue(); } else if ( value instanceof Date ) { return ((Date) value).getTime(); } ... Is it possible to add String to long conversion via Long.parseLong(str) or is there any reason not to allow this conversion?. Thank you again for your time. Best regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Manuel's Analysis of JBRULES-2887 (NPE in AccumulateNode.java:967)
Hi again: Just to inform I've made slight modifications to JoinNode code locally that seems to solve the SampleAlarmRules problem and any other problem (up to now) in my application rule set related to JoinNodes whose sink is composite. If anyone needs these modifications while the corrected release version comes up, just tell me. Best regards, Manuel Ortiz. 2011/4/4 Manuel Ortiz manuel.ortizra...@gmail.com Hi Edson, Wolfgang: Is there a downloadable Drools Release, beta or whatever, in which this problem is fixed? I think it may be the cause of some other problems I'm suffering (sometimes, some restrictions in the Condition Element seems to be badly evaluated and I think this may arise from bad tuple connections too). I would like to discard this possible cause before diving in Drools code again. Thank you for your time. Kind regards, Manuel Ortiz. 2011/4/4 Edson Tirelli ed.tire...@gmail.com Manuel, Thanks for your detailed analysis. I believe this was fixed in trunk a few weeks ago. Edson 2011/4/3 Manuel Ortiz manuel.ortizra...@gmail.com Hi again: I've been thinking about a possible solution to the SampleAlarmRules scenario related problem and would suggest that every sink modify function which returns a child tuple to be reAddLeft'ed or reAddRight'ed (at least there is one which is LeftTupleSinkPropagator.propagateModifyChildLeftTuple) returns an array of tuples instead of only one tuple, to take into account that the sink can be a composite sink which processes several child tuples, and reAddLeft or reAddRight all the tuples of the array to maintain tuple connection coherence. Best regards, Manuel Ortiz. 2011/4/3 Wolfgang Laun wolfgang.l...@gmail.com Thanks a lot, and I've added your analysis as a comment to JBRULES-2887. Wolfgang 2011/4/3 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wolfgang: I write to you concerning JIRA https://issues.jboss.org/browse/JBRULES-2887, which the SampleAlarmRules scenario which was attached to this discussion was added in. I've executed several times the SampleAlarmRules scenario and found that the problem in that scenario is the existence of a JoinNode (Node 18) which feeds two nodes, a JoinNode (Node 20) and an AccumlateNode (Node 25, the one in which NPE occurs). I've seen that the child tuples of a join node are interconnected via pointers and that those connections must be updated every time a parent tuple of the join node is modified, via reAddLeft and reAddRight tuple methods. When a JoinNode feeds two or more nodes, the child tuples are interconnected in a ordered way that mixes tuples with different sinks. In the SampleAlarmRules scenario, when JoinNode18 is right modified, the CompositeLeftTupleSinkAdapter processes several child tuples, but only the last one is returned and reAddLeft'ed, hence breaking the child tuple relations which it seems necessary to keep rete coherence. After this right modify, the next left modify fails because a child tuple related to one node of the composite sink is used to check the next operation to do in another sink node different from the first one. This leads to a chain of incorrect assertions which ends in the AccumulateNode NPE. I've rewriten my rules in order to JoinNode18 feeds only AccumulateNode25 thus avoiding the NPE and returning to my user role. However I am not sure if any CompositeSink starting at a JoinNode will have this or other problems when being left or right modified. I hope this information helps to solve this problem. Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com 2011/3/31 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wofgang: Thank youvery much for your response. I was replaying to Mauricio when your email has arrived. I hope the test case is useful. Thanks. Files are attached to the JIRA and JIRA is now at critical. -W Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com Manuel, I have reported this (or a very similar) problem https://issues.jboss.org/browse/JBRULES-2887 with a small example to reproduce. The stack trace is not identical, so please try to reproduce this with a small test case; it is bound to happen with a rule (Test Negativo Alarma Acceso Portal Ubicacion UM) that modifies some fact that is used in an accumulate phrase, (If this pattern is different from the one I gave, I'll raise the issue priority to critical.) Cheers Wolfgang 2011/3/30 Manuel Ortiz manuel.ortizra...@gmail.com Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException
Re: [rules-users] Manuel's Analysis of JBRULES-2887 (NPE in AccumulateNode.java:967)
Hi Edson, Wolfgang: Is there a downloadable Drools Release, beta or whatever, in which this problem is fixed? I think it may be the cause of some other problems I'm suffering (sometimes, some restrictions in the Condition Element seems to be badly evaluated and I think this may arise from bad tuple connections too). I would like to discard this possible cause before diving in Drools code again. Thank you for your time. Kind regards, Manuel Ortiz. 2011/4/4 Edson Tirelli ed.tire...@gmail.com Manuel, Thanks for your detailed analysis. I believe this was fixed in trunk a few weeks ago. Edson 2011/4/3 Manuel Ortiz manuel.ortizra...@gmail.com Hi again: I've been thinking about a possible solution to the SampleAlarmRules scenario related problem and would suggest that every sink modify function which returns a child tuple to be reAddLeft'ed or reAddRight'ed (at least there is one which is LeftTupleSinkPropagator.propagateModifyChildLeftTuple) returns an array of tuples instead of only one tuple, to take into account that the sink can be a composite sink which processes several child tuples, and reAddLeft or reAddRight all the tuples of the array to maintain tuple connection coherence. Best regards, Manuel Ortiz. 2011/4/3 Wolfgang Laun wolfgang.l...@gmail.com Thanks a lot, and I've added your analysis as a comment to JBRULES-2887. Wolfgang 2011/4/3 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wolfgang: I write to you concerning JIRA https://issues.jboss.org/browse/JBRULES-2887, which the SampleAlarmRules scenario which was attached to this discussion was added in. I've executed several times the SampleAlarmRules scenario and found that the problem in that scenario is the existence of a JoinNode (Node 18) which feeds two nodes, a JoinNode (Node 20) and an AccumlateNode (Node 25, the one in which NPE occurs). I've seen that the child tuples of a join node are interconnected via pointers and that those connections must be updated every time a parent tuple of the join node is modified, via reAddLeft and reAddRight tuple methods. When a JoinNode feeds two or more nodes, the child tuples are interconnected in a ordered way that mixes tuples with different sinks. In the SampleAlarmRules scenario, when JoinNode18 is right modified, the CompositeLeftTupleSinkAdapter processes several child tuples, but only the last one is returned and reAddLeft'ed, hence breaking the child tuple relations which it seems necessary to keep rete coherence. After this right modify, the next left modify fails because a child tuple related to one node of the composite sink is used to check the next operation to do in another sink node different from the first one. This leads to a chain of incorrect assertions which ends in the AccumulateNode NPE. I've rewriten my rules in order to JoinNode18 feeds only AccumulateNode25 thus avoiding the NPE and returning to my user role. However I am not sure if any CompositeSink starting at a JoinNode will have this or other problems when being left or right modified. I hope this information helps to solve this problem. Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com 2011/3/31 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wofgang: Thank youvery much for your response. I was replaying to Mauricio when your email has arrived. I hope the test case is useful. Thanks. Files are attached to the JIRA and JIRA is now at critical. -W Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com Manuel, I have reported this (or a very similar) problem https://issues.jboss.org/browse/JBRULES-2887 with a small example to reproduce. The stack trace is not identical, so please try to reproduce this with a small test case; it is bound to happen with a rule (Test Negativo Alarma Acceso Portal Ubicacion UM) that modifies some fact that is used in an accumulate phrase, (If this pattern is different from the one I gave, I'll raise the issue priority to critical.) Cheers Wolfgang 2011/3/30 Manuel Ortiz manuel.ortizra...@gmail.com Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967) at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270
Re: [rules-users] Manuel's Analysis of JBRULES-2887 (NPE in AccumulateNode.java:967)
Thanks to you for developing and maintaining this helpful application! Best regards, Manuel Ortiz. 2011/4/3 Wolfgang Laun wolfgang.l...@gmail.com Thanks a lot, and I've added your analysis as a comment to JBRULES-2887. Wolfgang 2011/4/3 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wolfgang: I write to you concerning JIRA https://issues.jboss.org/browse/JBRULES-2887, which the SampleAlarmRules scenario which was attached to this discussion was added in. I've executed several times the SampleAlarmRules scenario and found that the problem in that scenario is the existence of a JoinNode (Node 18) which feeds two nodes, a JoinNode (Node 20) and an AccumlateNode (Node 25, the one in which NPE occurs). I've seen that the child tuples of a join node are interconnected via pointers and that those connections must be updated every time a parent tuple of the join node is modified, via reAddLeft and reAddRight tuple methods. When a JoinNode feeds two or more nodes, the child tuples are interconnected in a ordered way that mixes tuples with different sinks. In the SampleAlarmRules scenario, when JoinNode18 is right modified, the CompositeLeftTupleSinkAdapter processes several child tuples, but only the last one is returned and reAddLeft'ed, hence breaking the child tuple relations which it seems necessary to keep rete coherence. After this right modify, the next left modify fails because a child tuple related to one node of the composite sink is used to check the next operation to do in another sink node different from the first one. This leads to a chain of incorrect assertions which ends in the AccumulateNode NPE. I've rewriten my rules in order to JoinNode18 feeds only AccumulateNode25 thus avoiding the NPE and returning to my user role. However I am not sure if any CompositeSink starting at a JoinNode will have this or other problems when being left or right modified. I hope this information helps to solve this problem. Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com 2011/3/31 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wofgang: Thank youvery much for your response. I was replaying to Mauricio when your email has arrived. I hope the test case is useful. Thanks. Files are attached to the JIRA and JIRA is now at critical. -W Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com Manuel, I have reported this (or a very similar) problem https://issues.jboss.org/browse/JBRULES-2887 with a small example to reproduce. The stack trace is not identical, so please try to reproduce this with a small test case; it is bound to happen with a rule (Test Negativo Alarma Acceso Portal Ubicacion UM) that modifies some fact that is used in an accumulate phrase, (If this pattern is different from the one I gave, I'll raise the issue priority to critical.) Cheers Wolfgang 2011/3/30 Manuel Ortiz manuel.ortizra...@gmail.com Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967) at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270) at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:312) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:160) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:263) at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:172) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1442) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1349) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.defaultConsequence
Re: [rules-users] Manuel's Analysis of JBRULES-2887 (NPE in AccumulateNode.java:967)
Hi again: I've been thinking about a possible solution to the SampleAlarmRules scenario related problem and would suggest that every sink modify function which returns a child tuple to be reAddLeft'ed or reAddRight'ed (at least there is one which is LeftTupleSinkPropagator.propagateModifyChildLeftTuple) returns an array of tuples instead of only one tuple, to take into account that the sink can be a composite sink which processes several child tuples, and reAddLeft or reAddRight all the tuples of the array to maintain tuple connection coherence. Best regards, Manuel Ortiz. 2011/4/3 Wolfgang Laun wolfgang.l...@gmail.com Thanks a lot, and I've added your analysis as a comment to JBRULES-2887. Wolfgang 2011/4/3 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wolfgang: I write to you concerning JIRA https://issues.jboss.org/browse/JBRULES-2887, which the SampleAlarmRules scenario which was attached to this discussion was added in. I've executed several times the SampleAlarmRules scenario and found that the problem in that scenario is the existence of a JoinNode (Node 18) which feeds two nodes, a JoinNode (Node 20) and an AccumlateNode (Node 25, the one in which NPE occurs). I've seen that the child tuples of a join node are interconnected via pointers and that those connections must be updated every time a parent tuple of the join node is modified, via reAddLeft and reAddRight tuple methods. When a JoinNode feeds two or more nodes, the child tuples are interconnected in a ordered way that mixes tuples with different sinks. In the SampleAlarmRules scenario, when JoinNode18 is right modified, the CompositeLeftTupleSinkAdapter processes several child tuples, but only the last one is returned and reAddLeft'ed, hence breaking the child tuple relations which it seems necessary to keep rete coherence. After this right modify, the next left modify fails because a child tuple related to one node of the composite sink is used to check the next operation to do in another sink node different from the first one. This leads to a chain of incorrect assertions which ends in the AccumulateNode NPE. I've rewriten my rules in order to JoinNode18 feeds only AccumulateNode25 thus avoiding the NPE and returning to my user role. However I am not sure if any CompositeSink starting at a JoinNode will have this or other problems when being left or right modified. I hope this information helps to solve this problem. Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com 2011/3/31 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wofgang: Thank youvery much for your response. I was replaying to Mauricio when your email has arrived. I hope the test case is useful. Thanks. Files are attached to the JIRA and JIRA is now at critical. -W Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com Manuel, I have reported this (or a very similar) problem https://issues.jboss.org/browse/JBRULES-2887 with a small example to reproduce. The stack trace is not identical, so please try to reproduce this with a small test case; it is bound to happen with a rule (Test Negativo Alarma Acceso Portal Ubicacion UM) that modifies some fact that is used in an accumulate phrase, (If this pattern is different from the one I gave, I'll raise the issue priority to critical.) Cheers Wolfgang 2011/3/30 Manuel Ortiz manuel.ortizra...@gmail.com Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967) at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270) at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:312) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:160) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:263
Re: [rules-users] New in Drools, java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
Hi Wolfgang: I write to you concerning JIRA https://issues.jboss.org/browse/JBRULES-2887, which the SampleAlarmRules scenario which was attached to this discussion was added in. I've executed several times the SampleAlarmRules scenario and found that the problem in that scenario is the existence of a JoinNode (Node 18) which feeds two nodes, a JoinNode (Node 20) and an AccumlateNode (Node 25, the one in which NPE occurs). I've seen that the child tuples of a join node are interconnected via pointers and that those connections must be updated every time a parent tuple of the join node is modified, via reAddLeft and reAddRight tuple methods. When a JoinNode feeds two or more nodes, the child tuples are interconnected in a ordered way that mixes tuples with different sinks. In the SampleAlarmRules scenario, when JoinNode18 is right modified, the CompositeLeftTupleSinkAdapter processes several child tuples, but only the last one is returned and reAddLeft'ed, hence breaking the child tuple relations which it seems necessary to keep rete coherence. After this right modify, the next left modify fails because a child tuple related to one node of the composite sink is used to check the next operation to do in another sink node different from the first one. This leads to a chain of incorrect assertions which ends in the AccumulateNode NPE. I've rewriten my rules in order to JoinNode18 feeds only AccumulateNode25 thus avoiding the NPE and returning to my user role. However I am not sure if any CompositeSink starting at a JoinNode will have this or other problems when being left or right modified. I hope this information helps to solve this problem. Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com 2011/3/31 Manuel Ortiz manuel.ortizra...@gmail.com Hi Wofgang: Thank youvery much for your response. I was replaying to Mauricio when your email has arrived. I hope the test case is useful. Thanks. Files are attached to the JIRA and JIRA is now at critical. -W Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com Manuel, I have reported this (or a very similar) problem https://issues.jboss.org/browse/JBRULES-2887 with a small example to reproduce. The stack trace is not identical, so please try to reproduce this with a small test case; it is bound to happen with a rule (Test Negativo Alarma Acceso Portal Ubicacion UM) that modifies some fact that is used in an accumulate phrase, (If this pattern is different from the one I gave, I'll raise the issue priority to critical.) Cheers Wolfgang 2011/3/30 Manuel Ortiz manuel.ortizra...@gmail.com Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967) at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270) at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:312) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:160) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:263) at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:172) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1442) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1349) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.defaultConsequence(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.java:18) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.evaluate(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.java:44) at org.drools.common.DefaultAgenda.fireActivation
Re: [rules-users] New in Drools, java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
Hello, Mauricio: I've been trying to reduce the set of rules and facts as well as the condition elements to provide you a manageable example and this is the minimal set of rules that still shows the NullPointerException behaviour. I also attach a basic DroolsTest.java class which can be executed with these rules. I'm using Drools 5.1.1. The strange interaction is as follows: - As Rule 5 is not fired, everything is OK. - After Rule 5 firing, the next Rule 4 firing which leads to a new Rule 5 activation fails with NullPointerException in AccumulateNode. - If Rule 6 is not included in the rule set, Rule 5 is activated and fired OK for every occassion. Thank you very much for your time. Best Regards, Manuel Ortiz. 2011/3/31 Mauricio Salatino sala...@gmail.com can you share your rules, so we can take a look at what is happening? The stack trace doesn't offer too much information to be able to analyze what happen. 2011/3/30 Manuel Ortiz manuel.ortizra...@gmail.com Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967) at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270) at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:312) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:160) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:263) at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:172) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1442) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1349) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.defaultConsequence(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.java:18) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.evaluate(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.java:44) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218) I've been trying to find the problem, and found a strange interaction between three rules that makes the null pointer to appear. The alarm system has many rules now and it is difficult to simplify the scenario, so I just would like to know what is the funcion of AccumulateNode object in order to have an idea of the NullPointerException possible cause. Can anyone help me? Thank you in advance for your time. Regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - DroolsTest.java Description: Binary data SampleAlarmRules.drl Description: Binary data ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] New in Drools, java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
Hi Wofgang: Thank youvery much for your response. I was replaying to Mauricio when your email has arrived. I hope the test case is useful. Best regards, Manuel Ortiz. 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com Manuel, I have reported this (or a very similar) problem https://issues.jboss.org/browse/JBRULES-2887 with a small example to reproduce. The stack trace is not identical, so please try to reproduce this with a small test case; it is bound to happen with a rule (Test Negativo Alarma Acceso Portal Ubicacion UM) that modifies some fact that is used in an accumulate phrase, (If this pattern is different from the one I gave, I'll raise the issue priority to critical.) Cheers Wolfgang 2011/3/30 Manuel Ortiz manuel.ortizra...@gmail.com Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967) at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270) at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:312) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:160) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:263) at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:172) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1442) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1349) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.defaultConsequence(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.java:18) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.evaluate(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.java:44) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218) I've been trying to find the problem, and found a strange interaction between three rules that makes the null pointer to appear. The alarm system has many rules now and it is difficult to simplify the scenario, so I just would like to know what is the funcion of AccumulateNode object in order to have an idea of the NullPointerException possible cause. Can anyone help me? Thank you in advance for your time. Regards, Manuel Ortiz. ___ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] New in Drools, java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
Hello all! I am new in Drools but day by day, test by test, I think I get a bit more knowledge of how the rule engine works from user point of view. I've been adding rules to an alarm system, increasing the complexity and functionality in several steps. Unfortunately in the last step I found the following NullPointerException inside the rule engine... java.lang.NullPointerException at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967) at org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:329) at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:239) at org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:640) at org.drools.reteoo.AccumulateNode.assertObject(AccumulateNode.java:270) at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:312) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:160) at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:460) at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:428) at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:263) at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:172) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1442) at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1349) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183) at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.defaultConsequence(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0.java:18) at es.simcasva.alarmas.rules.Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.evaluate(Rule_Test_Negativo_Alarma_Acceso_Portal_Ubicacion_UM_0DefaultConsequenceInvoker.java:44) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218) I've been trying to find the problem, and found a strange interaction between three rules that makes the null pointer to appear. The alarm system has many rules now and it is difficult to simplify the scenario, so I just would like to know what is the funcion of AccumulateNode object in order to have an idea of the NullPointerException possible cause. Can anyone help me? Thank you in advance for your time. Regards, Manuel Ortiz. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] New to Drools. Is it possible to test inverse conditions?
- Dear all: My name is Manuel Ortiz, a very beginner in Drools, and have a question related to Multi Restriction on Condition Elements. In http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch04.html#RuleLanguage-ConditionalElements, it can be found the following example: *Example 4.52. Multi Restriction* // Simple multi restriction using a single Person( age 30 40 ) // Complex multi restriction using groupings of multi restrictions Person( age ( ( 30 40) || ( 20 25) ) ) // Mixing muti restrictions with constraint connectives Person( age 30 40 || location == london ) I need to test a multi restriction in a rule and the opposite restriction in another. The multi restriction will be given by the user, and the application will build rules which test both the original restriction and the opposite. I would like to know if it is possible to write a Drools rule which evals the opposite conditions based on the original, something like Person( !(age 30 40) ) or I have to rebuild the multi restriction, something like Person( age = 30 || = 40 ) Thank you in advance for your time. Kind regards, Manuel Ortiz ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] New to Drools. Is it possible to test inverse conditions?
Dear Mauricio: Thank you very much for your quick response. If I understood Drools rules documentation, not(Person(age 30)) means There is no Person fact in working memory with age 30. Isn't it? I would like to write in DRL Retrieve Person facts in working memory with age not greater than 30, not as Person (age = 30), but using age 30 as this is the string that the user will provide. I think it should be some way to do this in DRL. If not, I will have to implement some kind of inverse condition translator, which converts restrictions to their opposites, something like invertContition(age 30) returns age = 30. I would like not to write this kind of translator. Thank you again for your time. Regards, Manuel Ortiz -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/New-to-Drools-Is-it-possible-to-test-inverse-conditions-tp2659708p2660170.html Sent from the Drools - User mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users