rule engine - Maybe a bug in temporal reasoning on drools? -


i want test scenario temporal reasoning on drools. have message class timestamp field. when each event of class received drools, inserted working memory , called fireallrules(). in every firing want print timestamp of paired message ml , mo, ml after[0s,160s] mo. when write rule below every things ok.

rule "rule 1" when     ml: message()     mo: message(ml after[0s,160s] this)     system.out.println("ml:"+new date(ml.timestamp));     system.out.println("mo:"+new date(mo.timestamp)); end 

output:

message received{"timestamp":"feb  8 19:39:45", ... } ml:sun feb 08 19:39:45 irst 1970 mo:sun feb 08 19:39:45 irst 1970 message received{"timestamp":"feb  8 19:40:04", ... } ml:sun feb 08 19:40:04 irst 1970 mo:sun feb 08 19:39:45 irst 1970 ml:sun feb 08 19:40:04 irst 1970 mo:sun feb 08 19:40:04 irst 1970 message received{"timestamp":"feb  8 19:40:15", ... } ml:sun feb 08 19:40:15 irst 1970 mo:sun feb 08 19:40:04 irst 1970 ml:sun feb 08 19:40:15 irst 1970 mo:sun feb 08 19:39:45 irst 1970 ml:sun feb 08 19:40:15 irst 1970 mo:sun feb 08 19:40:15 irst 1970 

but when rewrite rule in form output not good.

rule "rule 1" when     ml: message()     mo: message(this before[0s,160s] ml)     system.out.println("ml:"+new date(ml.timestamp));     system.out.println("mo:"+new date(mo.timestamp)); end 

output:

message received{"timestamp":"feb  8 19:41:40", ... } ml:sun feb 08 19:41:40 irst 1970 mo:sun feb 08 19:41:40 irst 1970 message received{"timestamp":"feb  8 19:41:57", ... } ml:sun feb 08 19:41:57 irst 1970 mo:sun feb 08 19:41:57 irst 1970 message received{"timestamp":"feb  8 19:42:02", ... } ml:sun feb 08 19:42:02 irst 1970 mo:sun feb 08 19:42:02 irst 1970 

why in second form output not good? problem observed when used 2 parameters temporal operators , "this" first operand. "this before[0s,160s] ml" equals "ml after[0s,160s] this"? second form bug?


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -