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...)
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/ht...).
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/ht...
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