Requirement: To identify those tickets with "critical" severity which occurs after 2minutes but before 5minutes of a ticket with severity 'warning', provided both are of different application name.
This rule though not meaningful, is considered to understand the temporal operator. This is the rule: declare OMNewTicket @role( event ) @expires (10m) end rule "Sample Temporal" salience 10 no-loop true when $ticket : OMNewTicket(severity == "warning", $appName : appName) $ticket1 : OMNewTicket(this after[2m, 5m] $ticket, severity == "critical", appName != $appName) then String $s = ""; String $s1 = ""; if ( $ticket != null) { $s = formatDate($ticket.getReceivingTime()); } if ( $ticket1 != null ) { $s1 = formatDate($ticket1.getReceivingTime()); } drools.getWorkingMemory().setGlobal( "output", "found"); drools.getWorkingMemory().setGlobal( "output1", $s); drools.getWorkingMemory().setGlobal( "output2", $s1); end function String formatDate( String inputDate ) { try { DateFormat formatter = new SimpleDateFormat("MM/dd/yy:hh:mm:aaa"); Date date = (Date)formatter.parse(inputDate); return date.toString(); } catch (ParseException e) { System.out.println("Exception :"+e); return null; } } Input: 14178 10/25/2008:9:33:AM critical TCS_Tibco_AMS_Email 14178 10/25/2008:9:49:AM warning NETLOGON 14178 10/25/2008:9:58:AM warning NETLOGON 14178 10/25/2008:10:00:AM warning crypt32 14178 10/25/2008:10:00:AM warning crypt32 14178 10/25/2008:10:00:AM warning crypt32 14178 10/25/2008:10:03:AM warning crypt32 14178 10/25/2008:10:04:AM warning Symantec 14178 10/25/2008:10:05:AM critical Windows SharePoint Services 3 14178 10/25/2008:10:08:AM critical OVIS 14178 10/25/2008:10:10:AM critical Office SharePoint Server 14225 12/11/2008:3:25:AM warning ASBDSM 14225 12/11/2008:3:25:AM warning WinDiskSpace 14225 12/11/2008:3:25:AM critical OVIS 14225 12/11/2008:3:30:AM normal OVIS 14225 12/11/2008:3:34:AM critical TCS_Tibco_AMS_Email Output: Status Time of Ticket Timestamp of Ticket1 Time (Clock) found Sat Oct 25 10:00:00 Sat Oct 25 10:05:00 Sat Oct 25 10:05:00 found Sat Oct 25 10:00:00 Sat Oct 25 10:08:00 Sat Oct 25 10:08:00 found Sat Oct 25 10:04:00 Sat Oct 25 10:10:00 Sat Oct 25 10:10:00 found Thu Dec 11 03:25:00 Thu Dec 11 03:34:00 Thu Dec 11 03:34:00 Here Time of Ticket is output1 from rule and Timestamp of Ticket1 is output2 of the consequence. Problem : The output 'found Thu Dec 11 03:25:00 Thu Dec 11 03:34:00 Thu Dec 11 03:34:00 ' is not satisfying the rule condition. After first three output, there are no tuples matching the criteria mentioned. Unable to predict the occurence of this in the output. May I know what i miss here? -- View this message in context: http://www.nabble.com/Unpredicatable-output-with-Temporal-rule-tp24307147p24307147.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