Hi Stefan,

after you know what in the knowledgesession shall be, you have to think how you 
could check the value that the detectors return. For this you could create a 
new class e.g. MeasureResult which contains the result of the detectors. So 
instead of inserting the value, you insert the object (that contains the value) 
into the session. Now your rule only have to check if there is a MeasureResult 
object and depending on the value, do something.

For example:

rule "Measure >= 5"
when
    MeasureResult(result >= 5)
then
    //insert textfile creation here
end

rule "Measure <= 3"
when
    MeasureResult(result <= 3)
then
    //insert textfile deletion here
end

Of course for these rules your MeasureResult class need a variable called 
result and getter-Methods for it.

Greetings
Bojan



----- Ursprüngliche Mail -----
Von: "Stefan Schuster" <[email protected]>
An: "Rules Users List" <[email protected]>
Gesendet: Freitag, 26. April 2013 11:30:40
Betreff: [rules-users] Getting Started with an simple sample





Hello, 

I’m still in the phase of learning the basics with drools. Therefor I created a 
simplified problem that I try to realize it with drools: 

I have several detectors, each of them measures something and converts it into 
an integer value between 1 one 6. Every Minute a new measurement is performed. 

When a detector reaches a value of 5 or above, a textfile is created with the 
name of the detector as filename and a predefined text as content. When the 
detector reaches a value of 3 or less, the texfile is deleted. 

My problem is that I’m still “thinking in java” and not yet “thinking in 
drools”. 

I guess the measured values would be facts that I insert (like the key-pressed 
events in the pong-example) to the knowledgebase. But now I stumble, I have no 
idea how to continue. Could anyone give me a helping hand for the next steps? 

Thanks in advance 

Stefan 
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to