[rules-users] Drools Fusion speedup

PF paul.i.fodor at gmail.com
Wed Sep 23 13:34:12 EDT 2009


Hi Mauricio,
We are using Drools Fusion. However, the classes from the example that you
mentioned in your previous post (
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-fusion)
are not documented in the documentation (org.drools.time.Trigger and
org.drools.time.TimerService are not mentioned in the documentation:
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-fusion/html_single/index.html).
The events that we are creating have the role "event" and they are matched
with the rules which are written in Fusion using the temporal reasoning
enabling operators. To get the comlex events feedback (printouts), please
uncomment the "println" statements in the "then" part in the fusion.drl
(rule file), these were commented out to get better results in the
benchmarks.
I attached the sources in this email.

BTW: We have a second question regarding aggregate functions (count, sum,
etc.). Does Drools Fusion provides any kind of aggregates over events or
these should be created separately in the .drl file (as rules)? We cannot
find anything like that in the documentation.
Regards,
Paul Fodor.
fusion.drl:
//package tests

//Check docu at
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html/ch02.html
import Event
declare Event
 @role (event)
 @expires (64m)
end

/*rule Newevent_detected_debug_only
dialect "mvel"
when
 $a : Event()
then
 System.out.println("Event "+ $a.symbol + " has been fired !");
end*/

rule "experiment A -Rule 0/0"
when
 $ae1 :Event(symbol == 1, $Pr1 : price) and
 $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2))
then
 //System.out.println("Ce1 fired !");
end
rule "experiment A -Rule 0/1"
when
 (
 $ae2 :Event(symbol == 2,$Pr2 : price) and
 $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) )
 )
then
 //System.out.println("Ce2 fired !");
end
rule "experiment A -Rule1"
when
 (
 $ae1 :Event(symbol == 1, $Pr1 : price) and
 $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2) )
 )
  or
 (
 $ae2 :Event(symbol == 2,$Pr2 : price) and
 $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) )
 )
then
 //System.out.println("Ce3 fired !");
end

rule "experiment A -Rule4"
when
 (
 $ae1 :Event(symbol == 1, $Pr1 : price) and
 $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2) )
 )
  and
 (
 $ae2 :Event(symbol == 2,$Pr2 : price) and
 $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) , this
after[0,20m] $ce1 )
 )
then
 //System.out.println("Ce4 fired !");
end

rule "experiment A -Rule5"
when
 (
 $ae1 :Event(symbol == 1, $Pr1 : price) and
 $ce1 :Event(this after $ae1 , symbol == 1, price > ($Pr1/1.2))
 )
  and
 (
 $ae2 :Event(symbol == 2,$Pr2 : price) and
 $ce2 : Event(this after $ae2 , symbol == 2,price > ($Pr2/1.2) , this
overlaps $ce1)
 )

then

 //System.out.println("Ce5 fired !");
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090923/4515f52d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Event.java
Type: application/octet-stream
Size: 1934 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090923/4515f52d/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: EventStream.java
Type: application/octet-stream
Size: 5218 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090923/4515f52d/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drools_fusion.java
Type: application/octet-stream
Size: 2373 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090923/4515f52d/attachment-0002.obj 


More information about the rules-users mailing list