[rules-users] Unpredicatable output with Temporal rule

PriyaKathan nash.8103 at gmail.com
Thu Jul 2 11:22:46 EDT 2009


Thanks for your quick response. Your previous reply solved my problem.
I failed to declaretimestamp attribute with the rule engine with an
assumption that rulesession will consider psuedo clock's time as event's.
After including the timestamp attribute, it works as expected.
Thanks once again.

2009/7/2 Edson Tirelli <tirelli at post.com>

>
>     It is hard to know what is wrong from the code snippets. Can you
> provide the full test case so that I can reproduce locally? If so, plz open
> a JIRA, attach the test case and ping me.
>
>     I am moving today, so I will probably not be much responsive till next
> week, but I will try to look into this asap.
>
>     []s
>     Edson
>
>
>
> 2009/7/2 PriyaKathan <nash.8103 at gmail.com>
>
>  Here is the Code Snippet:
>>
>>             currentTimeStamp = getCurrentTimeStamp(tuple, schArray);// the
>> method will the timestamp of the tuple
>>
>>             this.clock.advanceTime(currentTimeStamp -
>> clock.getCurrentTime(), TimeUnit.MILLISECONDS);
>>             this.ruleSession.fireAllRules();
>>
>> I use Pseudoclock. The events are fed into the engine as stream of data.
>>
>> 2009/7/2 Edson Tirelli <tirelli at post.com>
>>
>>
>>>    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
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://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
>>
>>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss by Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090702/7e01ee8f/attachment.html 


More information about the rules-users mailing list