<div dir="ltr">Hi Bojan,<div><br></div><div style>thanks a lot for your fast response.</div><div style><br></div><div style>but how can I guarantee that there is only one textfile per detector created, even if the detecor has a value above 5 for a longer time? Obviously the method for textfile-creation could check if there already exists a file on the filesystem, but that doesn&#39;t feel &quot;drools-like&quot; to me.</div>
<div style><br></div><div style>further ideas?</div><div style><br></div><div style>thanks</div><div style>Stefan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/26 Bojan Janisch <span dir="ltr">&lt;<a href="mailto:bojan.janisch@scai.fraunhofer.de" target="_blank">bojan.janisch@scai.fraunhofer.de</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Stefan,<br>
<br>
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.<br>

<br>
For example:<br>
<br>
rule &quot;Measure &gt;= 5&quot;<br>
when<br>
    MeasureResult(result &gt;= 5)<br>
then<br>
    //insert textfile creation here<br>
end<br>
<br>
rule &quot;Measure &lt;= 3&quot;<br>
when<br>
    MeasureResult(result &lt;= 3)<br>
then<br>
    //insert textfile deletion here<br>
end<br>
<br>
Of course for these rules your MeasureResult class need a variable called result and getter-Methods for it.<br>
<br>
Greetings<br>
Bojan<br>
<br>
<br>
<br>
----- Ursprüngliche Mail -----<br>
Von: &quot;Stefan Schuster&quot; &lt;<a href="mailto:stefan.m.schuster@gmail.com">stefan.m.schuster@gmail.com</a>&gt;<br>
An: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>
Gesendet: Freitag, 26. April 2013 11:30:40<br>
Betreff: [rules-users] Getting Started with an simple sample<br>
<div><div class="h5"><br>
<br>
<br>
<br>
<br>
Hello,<br>
<br>
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:<br>
<br>
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.<br>
<br>
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.<br>

<br>
My problem is that I’m still “thinking in java” and not yet “thinking in drools”.<br>
<br>
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?<br>

<br>
Thanks in advance<br>
<br>
Stefan<br>
</div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></blockquote></div><br></div>