[rules-users] Duration attritube and Temporal Operators

mind gil.vegliach at gmail.com
Thu Mar 8 11:55:07 EST 2012


Hello everybody,

I recently started using Drools (with C#) and I have some problems in
understanding how temporal operators work with the duration field. According
to the documentation, the temporal operators work with startTimestamp and
endTimestamp of events, the semantics being defined with inequalities. In
order to work, temporal operator requires the duration field to be declared.
Now the questions:
1. What does @timeStamp stay for? The start or the end timestamp?
2. Does Drools calculate startTimestamp and endTimestamp if I set @timeStamp
and @duration attribute from my C# code? If not how can I set them? (like
shall I declare like @startTimeStamp(sth) and set from the C# code?)
3. Do temporal operators work if I do not set explicitly the start and end
timestamps but just @timeStamp and @duration attributes?


In particular, I have this drl file (%VAR% are replaced by other code):


declare IntensionalEvent
	@role(event)
	@timeStamp(timeStamp)
	@duration(duration)
end

rule "Expression (%EVENTNAME1%, %OPERATOR%, %EVENTNAME2%, %TIMESPAN%,
%TIMEVAR%)"
    dialect "mvel"
	when
	    $eventA : IntensionalEvent( name == '%EVENTNAME2%' ) 
  		$eventB : IntensionalEvent( this %OPERATOR% $eventA,
	        name == '%EVENTNAME1%'
	    ) over window:time( %TIMESPAN% )
		    	
	then
                  blah blah... create an IntensionalEvent and set timestamp
and duration		

end

Thanks everybody,
Gil

--
View this message in context: http://drools.46999.n3.nabble.com/Duration-attritube-and-Temporal-Operators-tp3810201p3810201.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list