In addition to what Nestor has said, you'll also have to make sure your inserted facts objects contain values. You are just calling the default constructors<br> Adattipus ertek = new Adattipus();<br>
Mertadat mertekegyseg = new Mertadat ();<br>
Mertadat mozgas = new Mertadat ();<br>
workingMemory.insert( ertek );<br>
workingMemory.insert( mertekegyseg );<br>
workingMemory.insert( mozgas );<br>for Adattipus and Mertadat.<br><br>Also, it seems that you are confusing your Mertadat fields "mertekegyseg" and "mozgas" with objects of the same name.<br>
<br>Minden jót!<br>-W<br><br><div class="gmail_quote">On Sun, Nov 8, 2009 at 12:16 PM, SzA84 <span dir="ltr"><<a href="mailto:szepesiandras@citromail.hu">szepesiandras@citromail.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi I am working on a simple drools project.<br>
I have now one rule, but it not works.<br>
<br>
This is the drl:<br>
<br>
package orvosi;<br>
import orvosi.orvosimeres.Adattipus;<br>
import orvosi.orvosimeres.Mertadat;<br>
<br>
rule "Your First Rule"<br>
<br>
when<br>
Adattipus(ertek="heart_rate");<br>
Mertadat(ertek>180, mertekegyseg=="/min",<br>
mozgas==true);<br>
then<br>
System.out.println ("riasztas");<br>
<br>
end<br>
<br>
And this is the orvosi.java in the package but I think it's not good so.<br>
Suggest me any ideas how I can make it work.<br>
Thx!<br>
<br>
package orvosi;<br>
<br>
import java.io.InputStreamReader;<br>
import java.io.Reader;<br>
<br>
import org.drools.RuleBase;<br>
import org.drools.RuleBaseFactory;<br>
import org.drools.WorkingMemory;<br>
import org.drools.compiler.PackageBuilder;<br>
import org.drools.rule.Package;<br>
<br>
<br>
public class orvosimeres {<br>
<br>
<br>
public static final void main(String[] args) {<br>
try {<br>
RuleBase ruleBase = readRule();<br>
WorkingMemory workingMemory = ruleBase.newStatefulSession();<br>
Adattipus ertek = new Adattipus();<br>
Mertadat mertekegyseg = new Mertadat ();<br>
Mertadat mozgas = new Mertadat ();<br>
workingMemory.insert( ertek );<br>
workingMemory.insert( mertekegyseg );<br>
workingMemory.insert( mozgas );<br>
workingMemory.fireAllRules();<br>
} catch (Throwable t) {<br>
t.printStackTrace();<br>
}<br>
}<br>
<br>
private static RuleBase readRule() throws Exception {<br>
Reader source = new InputStreamReader(<br>
orvosimeres.class.getResourceAsStream( "/vernyomas.drl" ) );<br>
<br>
<br>
PackageBuilder builder = new PackageBuilder();<br>
<br>
builder.addPackageFromDrl( source );<br>
<br>
Package pkg = builder.getPackage();<br>
<br>
RuleBase ruleBase = RuleBaseFactory.newRuleBase();<br>
ruleBase.addPackage( pkg );<br>
return ruleBase;<br>
}<br>
<br>
public static class Adattipus{<br>
public int ertek;<br>
}<br>
public static class Mertadat{<br>
public int mertekegyseg;<br>
boolean mozgas=false;<br>
}<br>
<br>
<br>
}<br>
<font color="#888888">--<br>
View this message in context: <a href="http://old.nabble.com/rule-help-tp26245649p26245649.html" target="_blank">http://old.nabble.com/rule-help-tp26245649p26245649.html</a><br>
</font><div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<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><br>
</div></div></blockquote></div><br>