that's weird.. you are using a varible that you never define in the Right Hand Side.<br> $severity was never defined. In the RHS remember that you can write pure java. So if you want a variable called severity you should declare it as:<br>
String severity = $patient.<p class="MsoNormal">medicalHistoryBleedingRiskFactors.gastritis; <br></p><p class="MsoNormal">Greetings.<br></p><br><br><div class="gmail_quote">2010/12/3 John McKim <span dir="ltr"><<a href="mailto:jmckim@comcast.net">jmckim@comcast.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal" style="margin-bottom:12.0pt">I'm having a problem that I can't seem to figure out. I have rules that run in a client program with no problem - about 125 rules in all. When I try to run these same rules in an App Server (GlassFish) I get several rules (about 5) that have an error on initialization. Here is the error message followed by the rule. <br>
<br>******************************************* <br>SEVERE: java.lang.RuntimeException: Unable to build expression for 'consequence': [Error: not a statement, or badly formed structure] <br>[Near : {... $severity; <br>
....}] <br> ^ <br>[Line: 1, Column: 233] ' $severity = $patient.medicalHistoryBleedingRiskFactors.gastritis; <br> $weight = 5; <br> $factor = .1; <br> $tempScore = $factor; <br>
$tempScore = $tempScore * $weight; <br> $tempScore = $tempScore * $severity; <br> // Now add this risk score to the accumlated risk score <br> $patient.score = $patient.score + $tempScore; <br>
$patient.problem = new String("MedicalHistoryBleedingRiskFactors.gastritis"); <br>' : [Rule name='medicalHistoryBleedingRiskFactors.gastritis rule'] <br>********************************************** <br>
rule "medicalHistoryBleedingRiskFactors.gastritis rule" <br>salience 20 <br> when <br> # find patients who indicated that they have MedicalHistoryBleedingRiskFactors: gastritis <br> $patient : Patient(medicalHistoryBleedingRiskFactors.gastritis > 0) <br>
then <br> $severity = $patient.medicalHistoryBleedingRiskFactors.gastritis; <br> $weight = 5; <br> $factor = .1; <br> $tempScore = $factor; <br> $tempScore = $tempScore * $weight; <br>
$tempScore = $tempScore * $severity; <br> # Now add this risk score to the accumlated risk score <br> $patient.score = $patient.score + $tempScore; <br> $patient.problem = new String("MedicalHistoryBleedingRiskFactors.gastritis"); <br>
end </p><p class="MsoNormal">As I said, this rule runs fine in a client app – when I run the same rules in app server I get an error. This is only happening in 5 out of 125 rules, and only during initialization using builder.add(ResourceFactory.newClassPathResource(file).<br>
Thanks.</p><p class="MsoNormal"> </p></div></div><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>
<br></blockquote></div><br><br clear="all"><br>-- <br> - CTO @ <a href="http://www.plugtree.com">http://www.plugtree.com</a> <br> - MyJourney @ <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br>
- Co-Founder @ <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> <br> - Salatino "Salaboy" Mauricio -<br>