Re: [rules-users] How can we make the ‘over window:time’ parameter being configurable?

2014-06-11 Thread Matteo Mortari
Hi,
I'm quite intrigued by this question also myself, I would like to know more
about what you mean by configurable ?

For instance you can have the window 'declared'

declare window SensorReading30s
SensorReading() over window:time(30s) from entry-point DEFAULT
end

and also use this custom window name in the accumulate rule.

Do you mean by configurable , known at runtime and varying?

A solution I can think of in that case, a specific rule with the
housekeeping style; but I'm quite worried about performance issues may
arise.

Just my 2c, hope maybe helps?


On Tue, Jun 10, 2014 at 4:18 AM, moonbeam jplabe...@magenta.ca wrote:

 How can we make the ‘over window:time’ parameter being configurable?

 Something similar to the following rule (that does not compile at all).
  See
 the $windowTime variable.


 declare TemperatureThreshold
 windowTime : String = 30s
 max : long = 70
 end

 declare SensorReading
 @role( event )
 temperature : String = 40
 end

 rule Sound the alarm in case temperature rises above threshold
 when
TemperatureThreshold( $max : max, $windowTime : windowTime )
Number( doubleValue  $max ) from accumulate(
SensorReading( $temp : temperature ) over window:time( $windowTime ),
average( $temp ) )
 then
// sound the alarm
 end





 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-can-we-make-the-over-window-time-parameter-being-configurable-tp4029932.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] How can we make the 'over window:time' parameter being configurable?

2014-06-11 Thread Wolfgang Laun
It requires a little work (and the timestamp should be an event attribute) to
write rules to select facts being in a dynamic window, but it can be done.

-W


On 11/06/2014, Matteo Mortari matteo.mort...@gmail.com wrote:
 Hi,
 I'm quite intrigued by this question also myself, I would like to know more
 about what you mean by configurable ?

 For instance you can have the window 'declared'

 declare window SensorReading30s
 SensorReading() over window:time(30s) from entry-point DEFAULT
 end

 and also use this custom window name in the accumulate rule.

 Do you mean by configurable , known at runtime and varying?

 A solution I can think of in that case, a specific rule with the
 housekeeping style; but I'm quite worried about performance issues may
 arise.

 Just my 2c, hope maybe helps?


 On Tue, Jun 10, 2014 at 4:18 AM, moonbeam jplabe...@magenta.ca wrote:

 How can we make the 'over window:time' parameter being configurable?

 Something similar to the following rule (that does not compile at all).
  See
 the $windowTime variable.


 declare TemperatureThreshold
 windowTime : String = 30s
 max : long = 70
 end

 declare SensorReading
 @role( event )
 temperature : String = 40
 end

 rule Sound the alarm in case temperature rises above threshold
 when
TemperatureThreshold( $max : max, $windowTime : windowTime )
Number( doubleValue  $max ) from accumulate(
SensorReading( $temp : temperature ) over window:time( $windowTime ),
average( $temp ) )
 then
// sound the alarm
 end





 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-can-we-make-the-over-window-time-parameter-being-configurable-tp4029932.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How can we make the ‘over window:time’ parameter being configurable?

2014-06-11 Thread moonbeam
By 'configurable', I mean 'user defined' instead of 'programmer defined'.  I
know, I can write (and it will work):

rule Sound the alarm in case temperature rises above threshold 
when 
   TemperatureThreshold( $max : max ) 
   Number( doubleValue  $max ) from accumulate( 
   SensorReading( $temp : temperature ) over window:time( 30s ), 
   average( $temp ) ) 
then 
   // sound the alarm 
End

In this manner, the threshold ($max) is ‘user defined’.  Just need to inject
a TemperatureThreshold fact with user’s preferred 'max' value.
But the 'window:time' is hardcoded forever.

I would prefer injecting TemperatureThreshold fact containing a second
parameter (windowTime) that could be decide at 'inject time'.  That gives a
rule similar to the one I had posted originally.
But, unfortunately this way, the rule does not compile at all. Passing a
variable (like $windowTime) to 'window:time' does not seems to be syntax
acceptable.




--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-we-make-the-over-window-time-parameter-being-configurable-tp4029932p4029982.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] How can we make the ‘over window:time’ parameter being configurable?

2014-06-09 Thread moonbeam
How can we make the ‘over window:time’ parameter being configurable?

Something similar to the following rule (that does not compile at all).  See
the $windowTime variable.


declare TemperatureThreshold
windowTime : String = 30s
max : long = 70
end

declare SensorReading
@role( event )
temperature : String = 40
end

rule Sound the alarm in case temperature rises above threshold
when
   TemperatureThreshold( $max : max, $windowTime : windowTime )
   Number( doubleValue  $max ) from accumulate(
   SensorReading( $temp : temperature ) over window:time( $windowTime ),
   average( $temp ) )
then
   // sound the alarm
end





--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-we-make-the-over-window-time-parameter-being-configurable-tp4029932.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users