[rules-users] Drools Ruleflow: java.lang.OutOfMemoryError!
Hi folks, I am getting java.lang.OutOfMemoryError while running very simple process containing just one HumanTask node. I cannot get what I am doing wrong. I've setup everything according the docs (http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-flow/html/ch06.html) My setup is: JBoss 4.2.3.GA Hibernate 3.2.4.sp1 JBoss Seam 2.2.0.GA Drools 5.1.1 MySQL 5.1.41 / mysql-connector 5.0.7 Drools Ruleflow persistence: JPAKnowledgeService, MySQL, JBossTransactionManager The stacktrace is as follows: javax.persistence.PersistenceException: java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:527) at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114) at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247) at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86) at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177) at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389) at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135) at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87) at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140) at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52) at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:613) at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:604) at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:345) at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:245) at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196) at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.jav
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
laune wrote > > A virtual ("pseudo") clock is indicated. The timestamp of the facts > should control the advancement of the clock. > When the window is moved, does Drools consider all the intermediate positions? (Since my rule considers events depending only if they are included or not in the window, obviously it's not needed to consider all the infinite positions, but only those that affect the rule activation) What about my third point? -- MM -- View this message in context: http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3566708.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
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
On 07/12/2011, MarcoMojana wrote: > > laune wrote >> >> A virtual ("pseudo") clock is indicated. The timestamp of the facts >> should control the advancement of the clock. >> > > When the window is moved, does Drools consider all the intermediate > positions? (Since my rule considers events depending only if they are > included or not in the window, obviously it's not needed to consider all the > infinite positions, but only those that affect the rule activation) It should work if you fireAllRules() after each nudge of the clock and insertion of the next fact. > > What about my third point? Does it still happen when you use a pseudo clock? -W > > -- > MM > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3566708.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] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?
Op 07-12-11 02:18, Patrik Dufresne schreef: I'm still experimenting with Drools Planner and I also have the exact same issue : java.lang.IllegalStateException: The presumedScore (0hard/-1soft) is corrupted because it is not the realScore (0hard/0soft). Presumed workingMemory: Score rule (soft-ReduceNullAssignment) has count (1) and weight total (1). Real workingMemory: at org.drools.planner.core.solution.director.DefaultSolutionDirector.assertWorkingScore(DefaultSolutionDirector.java:157) at org.drools.planner.core.solver.DefaultSolverScope.assertWorkingScore(DefaultSolverScope.java:105) at org.drools.planner.core.phase.AbstractSolverPhaseScope.assertWorkingScore(AbstractSolverPhaseScope.java:132) at org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:69) at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:166) at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:138) ... I've read this (https://issues.jboss.org/browse/JBRULES-3301), but it didn't help : * I'm using IntConstraintOccurrence * I double check the soft constraint named "soft-ReduceNullAssignment" -- it's include all the cause. * I'm using Drools 5.3 After more digging, I think something is missing in DefaultSolutionDirector.java:153. The facts are added, but the planningEntity are not added. They are added: for (Object fact : getWorkingFacts()) { tmpWorkingMemory.insert(fact); } public Collection getWorkingFacts() { return solutionDescriptor.getAllFacts(workingSolution); // returns the problem facts + the initiliazed planningEntity's } So when the score calculation is running, there is two different result. I'v place a breakpoint at DefaultSolutionDirector.java:157 and looking in tmpWorkingMemory->defaultEntryPoint->objectStore->identifyMap->table, I don't see the planningEntity. That's weird. Could you try this with the latest drools-planner-core 5.4.0.SNAPSHOT from the jboss nexus repository too? You'll have to branch and upgrade your local code: https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-distribution/src/main/assembly/filtered-resources/UpgradeFromPreviousVersionRecipe.txt As a side affect, you'll notice that the exception message will be much much clearer too, which will help in discovering the problem. Here is the my rule : rule "soft-ReduceNullAssignment" when $planif : PlanifEventAssignment( employee == null ) then insertLogical(new IntConstraintOccurrence("soft-ReduceNullAssignment", ConstraintType.NEGATIVE_SOFT, 1, $planif)); end Thanks On Tue, Dec 6, 2011 at 11:12 AM, Geoffrey De Smet mailto:ge0ffrey.s...@gmail.com>> wrote: Op 06-12-11 05:38, guyramirez schreef: > Still the same issue, starting with the construction heuristic phase. Please > let me know if you need more explanations in what I am trying to do. > > Here is the error. Please note that there is only one planning entity > (ShiftAssignment) object instance in this test. > > Total Staffing required: 8 > 2011-12-05 22:21:49,627 [main] INFO Solver started: time spend (0), score > (null), new best score (null), random seed (0). > ShiftAssignment: emp. id: 10 [st: 100, dur: 3] > ShiftAssignment: emp. id: 10 [st: 100, dur: 2] > ShiftAssignment: emp. id: 10 [st: 100, dur: 4] > ShiftAssignment: emp. id: 10 [st: 100, dur: 1] > 2011-12-05 22:21:49,678 [main] TRACE Building ConstraintOccurrence summary > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: > 101, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st: > 100, dur: 1]]]=1) > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: > 103, position id: 1, staffingRequired: 2, []]=2) > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: > 102, position id: 1, staffingRequired: 2, []]=2) > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: > 100, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st: > 100, dur: 1], ShiftAssignment: emp. id: 10 [st: 100, dur: 1]]]=0) > 2011-12-05 22:21:49,678 [main] TRACE Building ConstraintOccurrence summary > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence > (intervalRequirementCovered/NEGA
Re: [rules-users] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?
Op 07-12-11 05:50, guyramirez schreef: > Patrik: thx for your feedback. Did you get the chance to run your rule using > Expert only without Planner? I just did that (wrote a test program to change > my planning entity values and update the StatefulKnowledgeSession few times > in row) and I came up with the same currupted result. Patrik's problem maybe won't apply on you: Notice how the count is the same, just the weight is different: Presumed workingMemory: Score rule (intervalRequirementCovered) has count (4) and weight total (5). Real workingMemory: Score rule (intervalRequirementCovered) has count (4) and weight total (7). That means that the planning entities envolved is maybe the same. I presume that going from solution A to solution B, the same IntervalRequirement is still broken, but $matchingShiftAssignmentSize changes (and that change isn't forward chained somehow). The Planner examples do this all the time (although it was an issue before drools 5.1, it's been fixed for ages). Because IntConstraintOccurrence also adds the weight to the equals and hashcode functions, that change should be done. > Geoffrey: thx for looking at my stuff. I still have the same issue with the > rule modified not to use collect (that's how it was actually written > originally. I later used Collect to be able to add the collection itself as > a cause to the logical insert, thinking that would solve my issue). > > I am still wondering: the nurse example is far more complicated that what I > am trying to accomplish with my simple test case, and still it runs fine. Yes, it doesn't make sense. All the other examples work without problems in environmentMode DEBUG, we even got tests on hudson running them. Try to break any of those. > -- > View this message in context: > http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corrupted-when-using-update-on-the-rules-working-memory-tp3546932p3566474.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 > -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
I have set the session clock type to pseudo, the processing mode is still stream and I have added the following rule: rule "SingleEvent" dialect "mvel" when $e0 : TriggerEvent() over window:time(1h) from entry-point EventStream then System.err.println("SingleEvent " + $e0); end And I have changed the code in the following way: eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 0, 0).getTime())); eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 13, 0, 0).getTime())); eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 0, 0).getTime())); eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 10, 0).getTime())); EventFactHandle lastEventHandle = (EventFactHandle) eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 20, 0).getTime())); System.err.println("The session clock is set to: " + new Date(pseudoClock.getCurrentTime())); ksession.fireAllRules(); System.err.println("The session clock is set to: " + new Date(pseudoClock.getCurrentTime())); It prints: The session clock is set to: Thu Jan 01 01:00:00 CET 1970 SingleEvent TriggerEvent [timestamp=Tue Dec 06 14:10:00 CET 2011] SingleEvent TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] The session clock is set to: Thu Jan 01 01:00:00 CET 1970 This means that, with a pseudo clock, even if you don't update it, drools will consider also the events happening after it (The events are inserted in the entry-point, not as facts). In my opinion this doesn't make any sense. Adding others fireAllRules() and clock updates doesn't change the output. What am I doing wrong? Now I would like to trigger also the "EventNotInhibited" rule. I have defined a method that updates the session clock in one big step: private static void advanceSessionClock(StatefulKnowledgeSession ksession, long time) { final SessionPseudoClock pseudoClock = ksession.getSessionClock(); final long advance = time - pseudoClock.getCurrentTime(); if(advance > 0) pseudoClock.advanceTime(advance, TimeUnit.MILLISECONDS); ksession.fireAllRules(); } The event insertion is done like this: lastEventHandle = (EventFactHandle) eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 0, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 13, 0, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 0, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 10, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 20, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); This works as expected, but the rule is triggered after inserting the event at 13:00:00, so it could also be that drools has already removed the event at 12:00:00 (the 1h window is strict) and it triggers the event, so I have modified the timestamps like this: lastEventHandle = (EventFactHandle) eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 10, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 13, 0, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 13, 50, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 0, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); lastEventHandle = (EventFactHandle) eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 10, 0).getTime())); advanceSessionClock(ksession, lastEventHandle.getStartTimestamp()); The rule should still be triggered, for example considering a 1h window betweeen 12:30:00 and 13:30:00. It is not, even changing the clock update method as follows: private static void advanceSessionClock(StatefulKnowledgeSessi
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
See below. On 07/12/2011, MarcoMojana wrote: > I have set the session clock type to pseudo, the processing mode is still > stream and I have added the following rule: > > rule "SingleEvent" > dialect "mvel" > when > $e0 : TriggerEvent() over window:time(1h) from entry-point > EventStream > then > System.err.println("SingleEvent " + $e0); > end > > And I have changed the code in the following way: > > eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, > Calendar.DECEMBER, 6, 12, 0, 0).getTime())); > eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, > Calendar.DECEMBER, 6, 13, 0, 0).getTime())); > eventStream.insert(new InhibitEvent(new GregorianCalendar(2011, > Calendar.DECEMBER, 6, 14, 0, 0).getTime())); > eventStream.insert(new TriggerEvent(new GregorianCalendar(2011, > Calendar.DECEMBER, 6, 14, 10, 0).getTime())); > EventFactHandle lastEventHandle = (EventFactHandle) eventStream.insert(new > InhibitEvent(new GregorianCalendar(2011, Calendar.DECEMBER, 6, 14, 20, > 0).getTime())); > > System.err.println("The session clock is set to: " + new > Date(pseudoClock.getCurrentTime())); > ksession.fireAllRules(); > System.err.println("The session clock is set to: " + new > Date(pseudoClock.getCurrentTime())); > > It prints: > > The session clock is set to: Thu Jan 01 01:00:00 CET 1970 > SingleEvent TriggerEvent [timestamp=Tue Dec 06 14:10:00 CET 2011] > SingleEvent TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] > The session clock is set to: Thu Jan 01 01:00:00 CET 1970 > > This means that, with a pseudo clock, even if you don't update it, > drools will consider also the events happening after it (The events are > inserted in the entry-point, not as facts). In my opinion this doesn't > make any sense. With the pseudo clock set to the begin of the epoch you run Drools as if we had 1970. Drools refuses to believe that it is fed events that are in the future; asking it to locate events that have happened not earlier than one hour ago includes those with a timestamp that is in the future. > > Adding others fireAllRules() and clock updates doesn't change the output. > What am I doing wrong? Do you really set the pseudo clock to the values in the timestamps? set the clock insert the event fire all rules > > Now I would like to trigger also the "EventNotInhibited" rule. I have > defined a method that updates the session clock in one big step: > > private static void advanceSessionClock(StatefulKnowledgeSession ksession, > long time) { > > final SessionPseudoClock pseudoClock = ksession.getSessionClock(); > > final long advance = time - pseudoClock.getCurrentTime(); > if(advance > 0) > pseudoClock.advanceTime(advance, TimeUnit.MILLISECONDS); > ksession.fireAllRules(); > I would not call fireAllRules here - see the pseudo-code above. The arrival of an event with timestamp T should happen when the clock points at T. -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
laune wrote > > Do you really set the pseudo clock to the values in the timestamps? > set the clock > insert the event > fire all rules > Now, if I do: set the clock fire all rules insert the event i.e., something like this: nextEventTime = new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 10, 0).getTime(); advanceSessionClock(ksession, nextEventTime.getTime()); System.err.println("Firing rules"); ksession.fireAllRules(); System.err.println("Inserting event"); eventStream.insert(new InhibitEvent(nextEventTime)); everything works unexpectedly correctly. It works even when the clock is updated in one single step (instead of once per second). Doing the three steps in the sequence you suggested, i.e. nextEventTime = new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 10, 0).getTime(); advanceSessionClock(ksession, nextEventTime.getTime()); System.err.println("Inserting event"); eventStream.insert(new InhibitEvent(nextEventTime)); System.err.println("Firing rules"); ksession.fireAllRules(); never triggers the rule. Have you an idea why this happens? Does it exists a configuration option that implicitly updates the session clock with that of the last inserted event if the latter is in the future? -- MM -- View this message in context: http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3567049.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
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
With the rules you gave, in STREAM mode and with a pseudo clock and running 5.2.0: SessionPseudoClock clock; private void advance( Date eventDate ){ long currentTime = clock.getCurrentTime(); long eventTime = eventDate.getTime(); clock.advanceTime( eventTime - currentTime, TimeUnit.MILLISECONDS ); } private void makeFacts(){ clock = kSession.getSessionClock(); WorkingMemoryEntryPoint eventStream = kSession.getWorkingMemoryEntryPoint( "EventStream" ); InhibitEvent inhibit; TriggerEvent trigger; inhibit = new InhibitEvent( new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 0, 0).getTime() ); advance( inhibit.getTimestamp() ); eventStream.insert( inhibit ); kSession.fireAllRules(); // proceed likewise with events at 1300, 1400, 1410, 1420 Output: SingleEvent TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] Found TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] SingleEvent TriggerEvent [timestamp=Tue Dec 06 14:10:00 CET 2011] On 07/12/2011, MarcoMojana wrote: > > laune wrote >> >> Do you really set the pseudo clock to the values in the timestamps? >> set the clock >> insert the event >> fire all rules >> > > Now, if I do: > set the clock > fire all rules > insert the event > > i.e., something like this: > > nextEventTime = new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 10, > 0).getTime(); > advanceSessionClock(ksession, nextEventTime.getTime()); > System.err.println("Firing rules"); > ksession.fireAllRules(); > System.err.println("Inserting event"); > eventStream.insert(new InhibitEvent(nextEventTime)); > > everything works unexpectedly correctly. It works even when the clock is > updated in one single step (instead of once per second). Doing the three > steps in the sequence you suggested, i.e. > > nextEventTime = new GregorianCalendar(2011, Calendar.DECEMBER, 6, 12, 10, > 0).getTime(); > advanceSessionClock(ksession, nextEventTime.getTime()); > System.err.println("Inserting event"); > eventStream.insert(new InhibitEvent(nextEventTime)); > System.err.println("Firing rules"); > ksession.fireAllRules(); > > never triggers the rule. Have you an idea why this happens? > Does it exists a configuration option that implicitly updates the session > clock with that of the last inserted event if the latter is in the future? > > -- > > MM > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3567049.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
[rules-users] cron timer not running
Hi! I have a problem with getting cron based timers to start running. The rules compiles just fine it's just that the timer never executes the rule. When I use "timer ( int: 1m )" it works fine but not with cron timers. My rule looks like the following: rule "whatever" timer(cron:* 0/1 * * * ?) when .. -- View this message in context: http://drools.46999.n3.nabble.com/cron-timer-not-running-tp3567205p3567205.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] cron timer not running
Hi! I have a problem with getting cron based timers to start running. The rules compiles just fine it's just that the timer never executes the rule. When I use "timer ( int: 1m )" it works fine but not with cron timers. My rule looks like the following: rule "whatever" timer(cron:* 0/1 * * * ?) when .. -- View this message in context: http://drools.46999.n3.nabble.com/cron-timer-not-running-tp3567201p3567201.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
Re: [rules-users] cron timer not running
When do you expect this to fire? Is the condition true? -W On 07/12/2011, ollem wrote: > Hi! > > I have a problem with getting cron based timers to start running. > The rules compiles just fine it's just that the timer never executes the > rule. > When I use "timer ( int: 1m )" it works fine but not with cron timers. > My rule looks like the following: > > rule "whatever" > timer(cron:* 0/1 * * * ?) > when > .. > > -- > View this message in context: > http://drools.46999.n3.nabble.com/cron-timer-not-running-tp3567205p3567205.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] cron timer not running
Thanks for answering. I expect the condition of the rule to be evaluated every minute by the cron timer. Yes the condition is true, that's why I'm puzzled. Maybe I have just misunderstood the way that timers work. What I want to achieve is: I want an event to represent a window in time and every minute that window is replaced by a new one. I want to be able to track a certain type of event that has happened during this window in time. I'm not looking for sliding windows. BR // Olle On 12/7/11 1:42 PM, "Wolfgang Laun" wrote: >When do you expect this to fire? Is the condition true? >-W > > >On 07/12/2011, ollem wrote: >> Hi! >> >> I have a problem with getting cron based timers to start running. >> The rules compiles just fine it's just that the timer never executes the >> rule. >> When I use "timer ( int: 1m )" it works fine but not with cron timers. >> My rule looks like the following: >> >> rule "whatever" >> timer(cron:* 0/1 * * * ?) >> when >> .. >> >> -- >> View this message in context: >> >>http://drools.46999.n3.nabble.com/cron-timer-not-running-tp3567205p356720 >>5.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] cron timer not running
I think that the entry should be written cron: * 0-59/1 ... -W On 07/12/2011, Olle Martensson wrote: > Thanks for answering. > > I expect the condition of the rule to be evaluated every minute by the > cron timer. > Yes the condition is true, that's why I'm puzzled. Maybe I have just > misunderstood the way that timers work. > > What I want to achieve is: > > I want an event to represent a window in time and every minute that window > is replaced by a new one. I want to be able to track a certain type of > event that has happened during this window in time. > I'm not looking for sliding windows. > > BR // Olle > > On 12/7/11 1:42 PM, "Wolfgang Laun" wrote: > >>When do you expect this to fire? Is the condition true? >>-W >> >> >>On 07/12/2011, ollem wrote: >>> Hi! >>> >>> I have a problem with getting cron based timers to start running. >>> The rules compiles just fine it's just that the timer never executes the >>> rule. >>> When I use "timer ( int: 1m )" it works fine but not with cron timers. >>> My rule looks like the following: >>> >>> rule "whatever" >>> timer(cron:* 0/1 * * * ?) >>> when >>> .. >>> >>> -- >>> View this message in context: >>> >>>http://drools.46999.n3.nabble.com/cron-timer-not-running-tp3567205p356720 >>>5.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 > > > ___ > 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] 'else' in rule
I fully agree with Jim K. Writing good business rules (and in my opinion good business rules are loosely coupled) is not straightforward and intuitive at the beginning and requires from software engineers to develop a different mindset. Having an ELSE statement could be a deterrent from writing loosely coupled rules which is a good practice IMHO. It reminds me of my early BASIC programming days (in the 80's :) where I would end up with horrible spaghetti code because of my misuse of the infamous GOTO statement. I also vote against the ELSE statement. Spyros -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of JimK Sent: Tuesday, December 06, 2011 9:08 PM To: rules-users@lists.jboss.org Subject: Re: [rules-users] 'else' in rule My $.02 I'm early in my use of Drools and Rules and struggled at first with the lack of ELSE. At first I would frequently feel "an ELSE would be prefect here". After awhile I believe that NOT having Else is a good thing. As I get better with writing rules I find that most of the times when I think I need an Else it usually means I should take a closer look at the rule. If I have a true Else situation for me I put the two rules one right after another. In these situations I think it is better to have to write the "ELSE" rule as effectively a NOT of the WHEN rule then having an ELSE fall through. Isn't that much extra coding and usually gives me pause to give it one more evaluation to see if this is a true ELSE or a new rule with similar criteria from the When. Many times the ELSE covers too many possibilities that should be explicitly checked and for me at least tells me I might not have fully broken the requirements down. As another posting indicates the complexity of implementing it I also wonder about the performance hit the logic to allow for an ELSE would add. With my current understanding of business rules and drools I would vote against an ELSE. Jim K. -- View this message in context: http://drools.46999.n3.nabble.com/else-in-rule-tp3264337p3565278.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
[rules-users] XSD resource type
Hello, I am trying Spring - Drools integration and in the documentation I found this line: (section 2.1.1.4. Define a KnowledgeBase, example 2.2) I also realized that XSD resource type is present in the resourceTypeEnum (drools-spring.xsd). Could I ask you where to find more information about this resource type? Best regards, Radovan Synek ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?
Adding to your analysis: when looking at the "Building ConstraintOccurrence summary" for the presumed working memory we can see what is wrong (the cause includes the collection of matching ShiftAssignment to IntervalRequirement). Also keep in mind that there is only one instance of a ShiftAssignment (starting at 100 and going from 1 to 4 in duration), versus 4 instances of IntervalRequirement (interval # from 100 to 103): 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: 101, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st: 100, dur: 1]]]=1) Here it matched wrongly the ShiftAssignment. Nothink should have been matched since the ShiftAssignment covers only interval 100. Weight should have been 2 instead of 1. 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: 100, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st: 100, dur: 1], ShiftAssignment: emp. id: 10 [st: 100, dur: 1]]]=0) Here that's the oddest. The ShiftAssignment should be matched, however the cause shows that it matched *twice* the same and only one ShiftAdjustment. Weight should have been 1 instead of 0. Maybe this odd behavior would ring some bells? -- View this message in context: http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corrupted-when-using-update-on-the-rules-working-memory-tp3546932p3567517.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
Re: [rules-users] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?
Op 07-12-11 15:12, guyramirez schreef: > Adding to your analysis: > when looking at the "Building ConstraintOccurrence summary" for the presumed > working memory we can see what is wrong (the cause includes the collection > of matching ShiftAssignment to IntervalRequirement). Also keep in mind that > there is only one instance of a ShiftAssignment (starting at 100 and going > from 1 to 4 in duration), versus 4 instances of IntervalRequirement > (interval # from 100 to 103): > > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: > 101, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st: > 100, dur: 1]]]=1) > > Here it matched wrongly the ShiftAssignment. Nothink should have been > matched since the ShiftAssignment covers only interval 100. Weight should > have been 2 instead of 1. > > > > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: interval: > 100, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 [st: > 100, dur: 1], ShiftAssignment: emp. id: 10 [st: 100, dur: 1]]]=0) > > Here that's the oddest. The ShiftAssignment should be matched, however the > cause shows that it matched *twice* the same and only one ShiftAdjustment. > Weight should have been 1 instead of 0. > > Maybe this odd behavior would ring some bells? Bugs in your Solution.cloneSolution() function? Or in it's equals or hashcode function? Compare it with the implementation from the examples. It's odd indeed that the tmp working memory is incorrect, instead of the real one. This is how I 'd write the rule btw: when $intervalReq : IntervalRequirement($interval : interval, $position : position, $staffingRequired : staffingRequired) $matchingShiftAssignmentSize : Number(intValue<= $staffingRequired) from accumulate( $x : ShiftAssignment(shiftStartTime<= $interval, shiftEndTime> $interval, position == $position), count($x) ) then insertLogical(new IntConstraintOccurrence("intervalRequirementCovered", ConstraintType.NEGATIVE_HARD, $staffingRequired - $matchingShiftAssignmentSize, $intervalReq)) // No $matchingShiftAssignments in causes > -- > View this message in context: > http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corrupted-when-using-update-on-the-rules-working-memory-tp3546932p3567517.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 > -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?
During my debugging, I notice the call to getWorkingFacts() doesn't include the planning entities. To make sure, I've run the NQueens example (that use the same construction heuristic) : the call to getWorkingFacts() include the planning entities. After more debugging, I figure out the problem. The ValueRange of my PlanningEntity include 'null'. I use null for un-assigned shift. In PlanningVariableDescriptor.java:149, the check for initialized variable return False if the value is null. Then my planning entity is wrongly identify as not initialized and the SolutionDescriptor.java:135 doesn't include it in the facts list. So how do I fix it ? 2011/12/7 Geoffrey De Smet > ** > > > Op 07-12-11 02:18, Patrik Dufresne schreef: > > I'm still experimenting with Drools Planner and I also have the exact same > issue : > > java.lang.IllegalStateException: The presumedScore (0hard/-1soft) is > corrupted because it is not the realScore (0hard/0soft). >Presumed workingMemory: > Score rule (soft-ReduceNullAssignment) has count (1) and weight > total (1). >Real workingMemory: > at > org.drools.planner.core.solution.director.DefaultSolutionDirector.assertWorkingScore(DefaultSolutionDirector.java:157) > at > org.drools.planner.core.solver.DefaultSolverScope.assertWorkingScore(DefaultSolverScope.java:105) > at > org.drools.planner.core.phase.AbstractSolverPhaseScope.assertWorkingScore(AbstractSolverPhaseScope.java:132) > at > org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:69) > at > org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:166) > at > org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:138) > ... > > I've read this (https://issues.jboss.org/browse/JBRULES-3301), but it > didn't help : > >- I'm using IntConstraintOccurrence >- I double check the soft constraint named "soft-ReduceNullAssignment" >-- it's include all the cause. >- I'm using Drools 5.3 > > After more digging, I think something is missing in > DefaultSolutionDirector.java:153. The facts are added, but the > planningEntity are not added. > > They are added: > > for (Object fact : getWorkingFacts()) { > tmpWorkingMemory.insert(fact); > } > > public Collection getWorkingFacts() { > return solutionDescriptor.getAllFacts(workingSolution); // returns > the problem facts + the initiliazed planningEntity's > > } > > So when the score calculation is running, there is two different result. > I'v place a breakpoint at DefaultSolutionDirector.java:157 and looking > in tmpWorkingMemory->defaultEntryPoint->objectStore->identifyMap->table, I > don't see the planningEntity. > > That's weird. > > Could you try this with the latest drools-planner-core 5.4.0.SNAPSHOT from > the jboss nexus repository too? > You'll have to branch and upgrade your local code: > > https://github.com/droolsjbpm/drools-planner/blob/master/drools-planner-distribution/src/main/assembly/filtered-resources/UpgradeFromPreviousVersionRecipe.txt > > As a side affect, you'll notice that the exception message will be much > much clearer too, which will help in discovering the problem. > > > Here is the my rule : > > rule "soft-ReduceNullAssignment" > when > $planif : PlanifEventAssignment( employee == null ) > then > insertLogical(new > IntConstraintOccurrence("soft-ReduceNullAssignment", > ConstraintType.NEGATIVE_SOFT, > 1, > $planif)); > end > > > Thanks > > On Tue, Dec 6, 2011 at 11:12 AM, Geoffrey De Smet > wrote: > >> >> >> Op 06-12-11 05:38, guyramirez schreef: >> > Still the same issue, starting with the construction heuristic phase. >> Please >> > let me know if you need more explanations in what I am trying to do. >> > >> > Here is the error. Please note that there is only one planning entity >> > (ShiftAssignment) object instance in this test. >> > >> > Total Staffing required: 8 >> > 2011-12-05 22:21:49,627 [main] INFO Solver started: time spend (0), >> score >> > (null), new best score (null), random seed (0). >> > ShiftAssignment: emp. id: 10 [st: 100, dur: 3] >> > ShiftAssignment: emp. id: 10 [st: 100, dur: 2] >> > ShiftAssignment: emp. id: 10 [st: 100, dur: 4] >> > ShiftAssignment: emp. id: 10 [st: 100, dur: 1] >> > 2011-12-05 22:21:49,678 [main] TRACE Building ConstraintOccurrence >> summary >> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence >> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: >> interval: >> > 101, position id: 1, staffingRequired: 2, [ShiftAssignment: emp. id: 10 >> [st: >> > 100, dur: 1]]]=1) >> > 2011-12-05 22:21:49,678 [main] TRACE Adding ConstraintOccurrence >> > (intervalRequirementCovered/NEGATIVE_HARD:[IntervalRequirement: >> interval: >> > 103, position id: 1, staffingRequired: 2, []]=2) >> > 2011-12-05 22:21:49,678 [main] TRACE Adding Constr
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
laune wrote > > With the rules you gave, in STREAM mode and with a pseudo clock and > running 5.2.0: > > Output: > SingleEvent TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] > Found TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] > SingleEvent TriggerEvent [timestamp=Tue Dec 06 14:10:00 CET 2011] > I cannot reproduce your output with 5.3.0 final. A possible explanation is that if you fireAllRules when the inhibit event @ 13:50:00 is already in the entry-point, the sliding window moves from 13:00:00, but it already sees the event in the future (if I have correctly understood, a 1h window sees the past 1h and all the future). The event @ 13:50:00 is of type "Inhibit", so it blocks the rule. -- MM -- View this message in context: http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3567750.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
Re: [rules-users] target directory checked in?
(I found a reply to this on Nabble; it never came through the email gateway, and Nabble won't let me reply directly using its interface. Anyhow, the replier wanted to know what Git URL I used since he said that drools-ruleml was not under the droolsjbpm umbrella.) I am a hopeless git newbie. Here's what I did to attempt to come up with that information: Laird-Nelsons-MacBook-Pro:drools-ruleml ljnelson$ git remote -v origingit://github.com/droolsjbpm/drools.git (fetch) origingit://github.com/droolsjbpm/drools.git (push) I hope that helps. Best, Laird On Tue, Dec 6, 2011 at 1:16 PM, Laird Nelson wrote: > I just did a git pull on the drools repositories and noticed that at > least one of the projects has the target directory checked in. Was this > intentional? > > My apologies if this is a known issue or deliberate. It just struck me as > odd, that's all. > > Arbitrary excerpt: > > create mode 100644 > drools-ruleml/target/test-classes/ruleml/translator/TestDataModel$Sell.class > create mode 100644 > drools-ruleml/target/test-classes/ruleml/translator/TestDataModel.class > create mode 100644 > drools-ruleml/target/test-classes/ruleml/translator/TestDrools2RuleML.class > create mode 100644 > drools-ruleml/target/test-classes/ruleml/translator/TestRuleML2Drools.class > create mode 100644 > drools-ruleml/target/test-classes/ruleml/translator/Util.class > > Best, > Laird > > -- > http://about.me/lairdnelson > -- http://about.me/lairdnelson ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to let a rule run only one time
This is my code: session.getAgenda().getAgendaGroup("add").setFocus(); try { int rule=session.fireAllRules(); System.out.println(rule+" rules fired"); } catch (Exception e) { e.printStackTrace(); } The rule doesn't print the message and the code print "0 rules fired". I am using drools 5.1.1. Is this the version you are using? My rule file is: rule "add2" agenda-group "add" dialect "java" lock-on-active when eval(true) then System.out.println("add2"); end -- View this message in context: http://drools.46999.n3.nabble.com/How-to-let-a-rule-run-only-one-time-tp3550555p356.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
Re: [rules-users] Planner 5.3.Final - "presumedScore is corrupted" when using "update" on the rules working memory => shadow proxies problems?
Yes I am getting the same results with your recommended rule. Also I wrote a Drools program that does not use Planner but instead performs the initial insert of the ShiftAdjustment, then the 3 updates with the firing of the rules at each insert/update, all in sequence, with the display of the score after each firing (so no use of the Solution class). And I get exactly the same erroneous results. I agree with you, it could be in the hashCode and/or equals methods. I will check them again against the examples. I have done it so many times already. :) > It's odd indeed that the tmp working memory is incorrect, instead of the real one. The real working memory is created everytime from scratch to check against the presumed score, right? Somehow the update of a fact (planning entity in this case) does not yield the same result as a retract and then insert (or plain insert in the case of the real working memory). We looked at the planning entity code earlier. Here is some code for the IntervalRequirement class that is being used to match against the ShiftAssignment: public class IntervalRequirement implements Comparable { private int dayAppliesTo; private int interval; private int intervalMinutes; private Position position; private int staffingRequired; @Override public int compareTo(IntervalRequirement other) { return this.interval - other.interval; } @Override public boolean equals(Object o) { if (this == o) { return true; } else if (o instanceof IntervalRequirement) { IntervalRequirement other = (IntervalRequirement) o; return new EqualsBuilder() .append(this.interval, other.interval) .append(this.position, other.position) .append(this.staffingRequired, other.staffingRequired) .isEquals(); } else { return false; } @Override public int hashCode() { return new HashCodeBuilder() .append(getClass()) .append(this.interval) .append(this.position) .append(this.staffingRequired) .toHashCode(); } ... } -- View this message in context: http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corrupted-when-using-update-on-the-rules-working-memory-tp3546932p3567779.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
Re: [rules-users] Statefull working memory corruption in Drools 5.3.Final - Was [Planner] "presumedScore is corrupted"
Op 07-12-11 16:44, guyramirez schreef: > Yes I am getting the same results with your recommended rule. > > Also I wrote a Drools program that does not use Planner but instead performs > the initial insert of the ShiftAdjustment, then the 3 updates with the > firing of the rules at each insert/update, all in sequence, with the display > of the score after each firing (so no use of the Solution class). And I get > exactly the same erroneous results. Then it's a bug in Drools Expert, please create a jira at issues.jboss.org/browse/JBRULES and attach code to reproduce (or even better, create a pull request at github.com/droolsjbpm with a regression test). Also try running with the drools-core/compiler 5.4.0-SNAPSHOT's to see if they have it too and report it in the issue. > I agree with you, it could be in the hashCode and/or equals methods. I will > check them again against the examples. I have done it so many times already. > :) > >> It's odd indeed that the tmp working memory is incorrect, instead of the > real one. > The real working memory is created everytime from scratch to check against > the presumed score, right? in environment mode TRACE: yes in environment mode DEBUG: yes, but not every move, but every step (it's too slow otherwise) > Somehow the update of a fact (planning entity in > this case) does not yield the same result as a retract and then insert (or > plain insert in the case of the real working memory). yes, there is statefull working memory corruption. > We looked at the planning entity code earlier. Here is some code for the > IntervalRequirement class that is being used to match against the > ShiftAssignment: > > public class IntervalRequirement implements Comparable > { > private int dayAppliesTo; > private int interval; > private int intervalMinutes; > private Position position; > private int staffingRequired; > > @Override > public int compareTo(IntervalRequirement other) { > return this.interval - other.interval; > } > > @Override > public boolean equals(Object o) { > if (this == o) { > return true; > } else if (o instanceof IntervalRequirement) { > IntervalRequirement other = (IntervalRequirement) o; > return new EqualsBuilder() > .append(this.interval, other.interval) > .append(this.position, other.position) > .append(this.staffingRequired, other.staffingRequired) > .isEquals(); > } else { > return false; > } > > @Override > public int hashCode() { > return new HashCodeBuilder() > .append(getClass()) > .append(this.interval) > .append(this.position) > > .append(this.staffingRequired) > .toHashCode(); > } > ... > } Looks good, but I am talking about the cloneSolution() of the class that implements Solution, not the planning entity. > -- > View this message in context: > http://drools.46999.n3.nabble.com/Planner-5-3-Final-presumedScore-is-corrupted-when-using-update-on-the-rules-working-memory-tp3546932p3567779.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 > -- With kind regards, Geoffrey De Smet ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
I didn't use an event with time stamp 1350. See the times in my previous mail; data was taken from your original post. -W On 07/12/2011, MarcoMojana wrote: > > laune wrote >> >> With the rules you gave, in STREAM mode and with a pseudo clock and >> running 5.2.0: >> >> Output: >> SingleEvent TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] >> Found TriggerEvent [timestamp=Tue Dec 06 13:00:00 CET 2011] >> SingleEvent TriggerEvent [timestamp=Tue Dec 06 14:10:00 CET 2011] >> > > I cannot reproduce your output with 5.3.0 final. A possible explanation is > that if you fireAllRules when the inhibit event @ 13:50:00 is already in the > entry-point, the sliding window moves from 13:00:00, but it already sees the > event in the future (if I have correctly understood, a 1h window sees the > past 1h and all the future). The event @ 13:50:00 is of type "Inhibit", so > it blocks the rule. > > -- > MM > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3567750.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
[rules-users] Is this an appropriate approach
The issue I have been struggling with is ordering rule evaluation ... which I realize violates one of the theoretical underpinnings of a rules system. I receive all String data. I wanted to test if the data was well formed (via regular expressions) prior to testing the semantic values stored in the data (e.g. numbers, etc). However, I woke up this morning, smacking my forehead, wondering why I didn't think of this earlier. Is there any reason I shouldn't run the rules engine twice - once with a knowledge base containing the regular expressions, and then (if it passes) run it through a different knowledge base with the semantic evaluations? -- View this message in context: http://drools.46999.n3.nabble.com/Is-this-an-appropriate-approach-tp3567852p3567852.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
Re: [rules-users] Is this an appropriate approach
As an alternative - can I use ruleflow-group without using .rf files? Can I put the regular expression evaluations in one rule-flow group and the semantic evaluations in a different rule-flow group, and then control the ruleflow-group activations programatically? If this is doable - is it a better or worse idea than making two separate runs thru two separate knowledge bases? -- View this message in context: http://drools.46999.n3.nabble.com/Is-this-an-appropriate-approach-tp3567852p3567870.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] Does drools generate document from drl files?
I want to add some comments on drl files and get a document from that. I know that guvnor can do this for me but it simply copy all the drl file content into a pdf file. What I want is that we can write some comments in a specified format provided by drools and generate a document like, html. Can I do this in drools or not? -- View this message in context: http://drools.46999.n3.nabble.com/Does-drools-generate-document-from-drl-files-tp3567875p3567875.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
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
laune wrote > > I didn't use an event with time stamp 1350. See the times in my > previous mail; data was taken from your original post. > With the data taken from the original post I can reproduce your output. Setting the timestamps to: 12:10 -> 13:00 -> 13:50 -> 14:00 -> 14:10 It still doesn't work. -- MM -- View this message in context: http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3567891.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] Drools&jBPM at ICAART 4th International Conference on Agents and Artificial Intelligence
We have a tentative full day tutorial for Droosl & jBPM in Portugal, Algarve, in Febuary 6 - 8. I'm just waiting for internal confirmations, but I wanted to start getting prelimary communication out there. http://www.icaart.org/tutorials.asp Mark ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] [rules-dev] Drools&jBPM at ICAART 4th International Conference on Agents and Artificial Intelligence
WOW, that sounds great! Let me know if I can help with something, I'm not sure how far away is Esteban from there.. but we can start planning to assist :) Cheers! On Wed, Dec 7, 2011 at 1:46 PM, Mark Proctor wrote: > We have a tentative full day tutorial for Droosl & jBPM in Portugal, > Algarve, in Febuary 6 - 8. I'm just waiting for internal confirmations, > but I wanted to start getting prelimary communication out there. > > http://www.icaart.org/tutorials.asp > > Mark > ___ > rules-dev mailing list > rules-...@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-dev -- - CTO @ http://www.plugtree.com - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino "Salaboy" Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Need clarification on how event expiration offset is calculated in 5.3.0.FINAL
Hi, I've recently started using some of the temporal operators that drools supports (coincides, starts, finishes, during) and have had trouble with events not being expired, causing severe memory consumption. I'd first like to make sure that I'm using these operators appropriately, so as a test case I have rules like: declare A @role( event ) @timestamp( timestamp ) @duration( duration ) end declare B @role( event ) @timestamp( timestamp ) @duration( duration ) end rule "coincides events" when $a: A() from entry-point "a" $b: B(this coincides $a) from entry-point "b" then insert("coincides"); end With classes like: public class A{ public final long timestamp; public final long duration; public A(long timestamp, long duration){ this.timestamp = timestamp; this.duration = duration; } } //B is identical to A. Using a knowledge base configured with stream mode, and a knowledge session with a pseudo clock I'd run this test: A a = new A(0, 1000); B b = new B(0, 1000); entryPointA.insert(a); entryPointB.insert(b); clock.advanceTime(1000, TimeUnit.MILLISECONDS); ksession.fireAllRules(); In this test I'm expecting that the rule will fire to insert "coincides" and expire both A and B. But instead, "coincides" is inserted, B is expired, but A remains in memory permanently. If I use jvisualvm to inspect the expirationOffset for A, I see that it is the Long.MAX value of 9223372036854775807. This behavior persists even after adding an explicit expiration to A. I was under the impression that the offset would be zero (of close to it) since Drools would only need to retain A until the clock reaches A's endTimestamp. The documentation does not cover the calculation of event expiration in great detail, so have I missed something? Thanks in advance. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools&jBPM at ICAART 4th International Conference on Agents and Artificial Intelligence
On 07/12/2011 16:49, Mauricio Salatino wrote: > WOW, that sounds great! > Let me know if I can help with something, I'm not sure how far away is > Esteban from there.. but we can start planning to assist :) > Cheers! I'm still waiting for internal confirmation at RHT, but assuming that goes ahead, the more help the better :) icaart have said they will cancel the event if attendance is not high enough, so if you are thinking of going, make sure you register quickly, and help get the word out. Mark > > On Wed, Dec 7, 2011 at 1:46 PM, Mark Proctor wrote: >> We have a tentative full day tutorial for Droosl& jBPM in Portugal, >> Algarve, in Febuary 6 - 8. I'm just waiting for internal confirmations, >> but I wanted to start getting prelimary communication out there. >> >> http://www.icaart.org/tutorials.asp >> >> Mark >> ___ >> rules-dev mailing list >> rules-...@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-dev > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Sliding window behavior in stream mode and realtime clock
inhibit 12:10 -> trigger 13:00 -> inhibit 13:50 -> trigger 14:00 -> inhibit 14:10 This should not print "Found...", right? And it doesn't. -W On 07/12/2011, MarcoMojana wrote: > > laune wrote >> >> I didn't use an event with time stamp 1350. See the times in my >> previous mail; data was taken from your original post. >> > > With the data taken from the original post I can reproduce your output. > Setting the timestamps to: > 12:10 -> 13:00 -> 13:50 -> 14:00 -> 14:10 > It still doesn't work. > > -- > MM > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Sliding-window-behavior-in-stream-mode-and-realtime-clock-tp3564950p3567891.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
[rules-users] Hard constraints to enforce employee seniority
Hi all, I'm trying to create rules to model my problem. So far, I didn't manage to create rules to make Drools converge to a solution because of score traps. I don't see any way to avoid it (as I'm not an expert with Drools). I can express the rule as follow : a senior employee should work before a less senior employee. I've implement it as a hard constraint : rule "hard-Seniority" when $employee : Employee() $assignment : PlanifEventAssignment( $planifEmployee : employee ) not PlanifEventAssignment( employee == $employee ) eval(Helper.compareEmployee($employee, $planifEmployee) < 0) then insertLogical(new IntConstraintOccurrence("hard-Seniority", ConstraintType.NEGATIVE_HARD, 1, $employee, $assignment)); end The function Helper.compareEmployee(e1, e2) return -1 if e1 is more senior then e2 (mostly based on hire date and other boolean fields). This way, the rule make sure a senior employee is working. But it's a score trap since, many moves are required to resolve the constraint. e.g: PlanifEventAssignment1 = e2 PlanifEventAssignment2 = e3 PlanifEventAssignment3 = e4 PlanifEventAssignment4 = e5 e1 is not working. Multiple move are require to reach the best solution : PlanifEventAssignment1 = e1 PlanifEventAssignment2 = e2 PlanifEventAssignment3 = e3 PlanifEventAssignment4 = e4 So I'm asking you. What is the best way to make Drools converge ? Do I need to change my rule, or should I create a BigMove ? -- Patrik Dufresne ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Need clarification on how event expiration offset is calculated in 5.3.0.FINAL
Scott, The event expiration algorithm in Drools works with compile time analysis of temporal constraints. It calculates the transitive closure on the temporal intervals created by each temporal constraint and from that it infers the required time for an event to stay in memory, expiring them after that. Some interactions are pretty hard to calculate manually, but as you already realized, you can enable the Drools MBeans and use jconsole (or visualvm as you mentioned) to inspect them. In your case, first things first, I assume you are running the engine in STREAM mode? the default is CLOUD mode, and in CLOUD mode there is no expiration of events. Second, there was a bug in one of the released versions of Drools (I think 5.2 or 5.3) that was fixed after where the calculation was wrong if the events were in different packages. Finally, you are using external timestamps for the events (on its attributes), so make sure your clock is in line with the externally timestamped events. If everything I mentioned is working as expected and your events are still not being expired, please try adding an explicit expiration policy (e.g., @expires( 1m ) ), and submit a bug (JIRA) with your findings. Edson 2011/12/7 Scott Embler > Hi, > > I've recently started using some of the temporal operators that drools > supports (coincides, starts, finishes, during) and have had trouble with > events not being expired, causing severe memory consumption. > I'd first like to make sure that I'm using these operators appropriately, > so as a test case I have rules like: > > declare A > @role( event ) > @timestamp( timestamp ) > @duration( duration ) > end > > declare B > @role( event ) > @timestamp( timestamp ) > @duration( duration ) > end > > rule "coincides events" > when > $a: A() from entry-point "a" > $b: B(this coincides $a) from entry-point "b" > then insert("coincides"); end > > With classes like: > > public class A{ > public final long timestamp; > public final long duration; > public A(long timestamp, long duration){ > this.timestamp = timestamp; > this.duration = duration; > } > } > > //B is identical to A. > > Using a knowledge base configured with stream mode, and a knowledge > session with a pseudo clock I'd run this test: > > A a = new A(0, 1000); > B b = new B(0, 1000); > > entryPointA.insert(a); > entryPointB.insert(b); > clock.advanceTime(1000, TimeUnit.MILLISECONDS); > ksession.fireAllRules(); > > In this test I'm expecting that the rule will fire to insert "coincides" > and expire both A and B. But instead, "coincides" is inserted, B is > expired, but A remains in memory permanently. If I use jvisualvm to > inspect the expirationOffset for A, I see that it is the Long.MAX value of > 9223372036854775807. This behavior persists even after adding an explicit > expiration to A. I was under the impression that the offset would be zero > (of close to it) since Drools would only need to retain A until the clock > reaches A's endTimestamp. The documentation does not cover the calculation > of event expiration in great detail, so have I missed something? Thanks in > advance. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] This (ordered) record validation approach is working
I didn't get any feedback when I posted earlier today, so I went ahead and implemented what I thought would work ... and I figured I should share it here since it seems to be working pretty well. I created a Rule Flow as follows: A Rule-Flow-Group that validates the arrays. Unfortunately I sometimes get multiple related arrays of records instead of a single array of records. I confirm that records with mandatory values have arrays with at least one element, and confirm that the related arrays are of equal length. Errors are logged. A subsequent Rule-Flow-Group that manages inserts. The data actually comes to me as one data structure comprised of sub-records of various types, and I have DRL files for each record type. Some of the sub-records are optional, and since subsequent rules would erroneously flag empty sub-records as errors I have rules here which only allow optional records containing values to be inserted into the system. I am currently using for-loops in the THEN section of some rules to deal with the array problem and would like to know if there is a better way. No errors are generated here. A subsequent Rule-Flow-Group that validates data. The data is all sent to me as Strings, even though many of the values are numbers, dates, etc. This Rule-Flow group tests the various fields using regular expressions, and if a regular expression fails then the record is flagged as having an error. Optional fields are dealt with by the regular expression allowing a blank. Errors are logged. A Diverging Gateway that splits the data into two ... records without validation errors are allowed to progress to the value-checking Rule-Flow group ... those with errors have nothing more done to them. I realize that I could, for instance, let records with bogus numbers thru as long as my string-to-integer routine is robust, however I don't want to flag the same record multiple times (once by reg-ex and then again by the next Rule-Flow-Group). A subsequent Rule-Flow-Group that checks the values and ranges of the numbers, dates, etc, and does other types of validation (e.g. if fieldA has a value greater than 20 then fieldB must be set to "XYZ"). Errors are logged. This Rule-Flow approach currently seems to be solving all of my problems, and it allows me to keep the rules simple and well structured such that most of them are reusable in other parts of our system. I'm interested in getting feedback on this approach ... it seems to be working pretty well for me. It allows me to deal with ordering issues and many of the if/else issues, while keeping the rules simple enough for our non-technical analysts to review without needing a developer to sit next to them. I realize this is a pretty mundane application for a powerful rules system, but it seems like a good fit nonetheless. Thanks Ron -- View this message in context: http://drools.46999.n3.nabble.com/This-ordered-record-validation-approach-is-working-tp3568933p3568933.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] Can Drools supply large Knowledge Base?
Hi All I'm new to Drools, I will build a very large Knowledge Base, let's say it will be larger than 100GB, the files will be stored in a distribute database, so can Droools supply this large Knowledge Base? Any solution? Thank you very much. CheersRamon ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] newStatefuleSession take a long time to run
I did a test. I create a knowledge base and create a statefuleSession. Then I call newStatulSession 1000 times with 5 minutes sleep during each time. There will be some times the newStatefulSession take 5 seconds. I wander why it takes such a long time to run. -- View this message in context: http://drools.46999.n3.nabble.com/newStatefuleSession-take-a-long-time-to-run-tp3569412p3569412.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] guvnor deploy on AS7 times out
Deploying govnor-5.3.0.Final-jboss-as-7.0.war (renamed as guvnor.war) on jboss-as-7.1.0.Beta1b standalone on Windows XP w/java build 1.6.0_29-b11. First attempt was dropping the war into deployments it seems to start fine - I do get some WARN ... does not point to a valid jar for a Class-Path reference - and a couple of EJB get deployed but ultimately I get - JBAS015052: Did not receive a response to the deployment operation within the allowed timeout period [60 seconds]. Check the server configuration file and the server logs to find more about the status of the deployment. Second attempt was via the content deployer in admin console but that even less successful... content was deployed but "enable" produces no results, error message or anything. any help appreciated... i've seen another posting in the forum regarding problems with guvnor deployments and AS7 but that was 5.2 and symptoms were different. response on that was an indication that 5.4 would refactor the seam impl and solve some issues. any help appreciated thanx -- View this message in context: http://drools.46999.n3.nabble.com/guvnor-deploy-on-AS7-times-out-tp3569468p3569468.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] How to use single Model in different rules across different packages
Hi All, I'm using Drools 5.0.1.I've declared two packages in Drools Guvnor Package1 and Package2.I declared one Model named as TestModel in Package1. Now,I created a business rule named as testrule in Package2.Now,while adding conditions to this rule in when clause,I need to get the TestModel from Package1.How it is possible? It means I should use the same Model across different rules in different packages.How it is possible.Please help me.I'm struggling in this.. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/How-to-use-single-Model-in-different-rules-across-different-packages-tp3569485p3569485.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] How to use REST API
How can i use REST API in my drools application.Should i need to include any jars in my application?where can i find REST API avaliable jars?Could you please suggest me.. Thanks in Advance -- View this message in context: http://drools.46999.n3.nabble.com/How-to-use-REST-API-tp3569493p3569493.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
Re: [rules-users] This (ordered) record validation approach is working
In my Rules Fest 2011 boot camp "Rule-Based Programming Design Patterns" I presented a generic solution using linked rule engines for this and similar problems. -W On 08/12/2011, ronalbury wrote: > I didn't get any feedback when I posted earlier today, so I went ahead and > implemented what I thought would work ... and I figured I should share it > here since it seems to be working pretty well. > > I created a Rule Flow as follows: >A Rule-Flow-Group that validates the arrays. Unfortunately I sometimes > get multiple related arrays of records instead of a single array of records. > I confirm that records with mandatory values have arrays with at least one > element, and confirm that the related arrays are of equal length. Errors > are logged. > >A subsequent Rule-Flow-Group that manages inserts. The data actually > comes to me as one data structure comprised of sub-records of various types, > and I have DRL files for each record type. Some of the sub-records are > optional, and since subsequent rules would erroneously flag empty > sub-records as errors I have rules here which only allow optional records > containing values to be inserted into the system. I am currently using > for-loops in the THEN section of some rules to deal with the array problem > and would like to know if there is a better way. No errors are generated > here. > >A subsequent Rule-Flow-Group that validates data. The data is all sent > to me as Strings, even though many of the values are numbers, dates, etc. > This Rule-Flow group tests the various fields using regular expressions, and > if a regular expression fails then the record is flagged as having an error. > Optional fields are dealt with by the regular expression allowing a blank. > Errors are logged. > >A Diverging Gateway that splits the data into two ... records without > validation errors are allowed to progress to the value-checking Rule-Flow > group ... those with errors have nothing more done to them. I realize that > I could, for instance, let records with bogus numbers thru as long as my > string-to-integer routine is robust, however I don't want to flag the same > record multiple times (once by reg-ex and then again by the next > Rule-Flow-Group). > >A subsequent Rule-Flow-Group that checks the values and ranges of the > numbers, dates, etc, and does other types of validation (e.g. if fieldA has > a value greater than 20 then fieldB must be set to "XYZ"). Errors are > logged. > > > This Rule-Flow approach currently seems to be solving all of my problems, > and it allows me to keep the rules simple and well structured such that most > of them are reusable in other parts of our system. > > I'm interested in getting feedback on this approach ... it seems to be > working pretty well for me. It allows me to deal with ordering issues and > many of the if/else issues, while keeping the rules simple enough for our > non-technical analysts to review without needing a developer to sit next to > them. > > I realize this is a pretty mundane application for a powerful rules system, > but it seems like a good fit nonetheless. > > Thanks >Ron > > -- > View this message in context: > http://drools.46999.n3.nabble.com/This-ordered-record-validation-approach-is-working-tp3568933p3568933.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
[rules-users] How to retrieve Fact names in Declarative Model
Hi, How to retrieve factnames in declarative model present in guvnor.Please help me by suggesting some classes and methods to retrieve.Please..I'm strucked here.. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/How-to-retrieve-Fact-names-in-Declarative-Model-tp3569634p3569634.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] How to retrieve Declarative Model names in a package
Hi, I'm using 5.0.1 Drools I've declarative models present in one package p1 in Drools guvnor.I need to retrieve all Model names through Java code.How can i achieve this..Could you please suggest me..I was strucked here in doing this. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/How-to-retrieve-Declarative-Model-names-in-a-package-tp3569648p3569648.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