[rules-users] Unpredicatable output with Temporal rule

Edson Tirelli tirelli at post.com
Thu Jul 2 10:12:48 EDT 2009


   Since you are not declaring to the rules engine what is the timestamp
attribute, the engine uses the timestamp of the session clock at event
insertion. What kind of session clock are you using? how are you firing your
rules (fireAllRules() or fireUntilHalt())? How frequently are you feeding
the events into the working memory?

   []s
   Edson

2009/7/2 PriyaSha <nash.8103 at gmail.com>

>
> 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090702/2c8ba881/attachment.html 


More information about the rules-users mailing list