It appears that you want to reason about travel bookings or some such thing.<br><br>You are thinking of the various attributes as individual (abstract) things that<br>have a designation (such as &quot;Adult Fare&quot;) and a value, with the intent to<br>


handle this with a set of facts, each of which has these two fields. While<br>this &quot;property list&quot; view of data may have its merits, it complicates the writing<br>of rules in system like Drools.<br><br>Moreover, keeping this data in a map is fine from the Java point of view, but it<br>


leads to complications while processing it in DRL rules. (To say nothing<br>about the poor performance due to eval all over the place.) I&#39;m not sure<br>about the relation between your Java class RuleAttributes and the<br>

HashMap instance hmAttriList, but even if the latter were an instance<br>of the former (so it is a subclass of HashMap), it is questionable what<br>the $a.Values[&quot;...&quot;] returns - most likely not an Integer, and this is<br>

confirmed by the compiler&#39;s error message.<br><br>Try to view a Booking as a Java Bean with attributes<br>int numberOfAdults<br>int numberOfChildren<br>int childFare<br>int adultFare<br>boolean rejected<br>and any other attribute of a booking you might want to put there.<br>


<br>Create an instance of this bean and add it to Working Memory.<br><br>A rule could now be written as<br><br>rule &quot;adt_chld_fare&quot;<br>no-loop true<br>when<br>    $b: Booking( $af : adultFare, childFare &gt; ($af - 1500) )<br>

then<br>    modify( $b ){ setRejected( true ); }<br>end<br><br>There are many possible variations on this. Here is just one idea:<br><br>You might not want to have the rejection being stored in the Booking bean,<br>so you could, perhaps assert an instance of another suitably composed Bean<br>

class Rejection<br>    Booking booking<br>    String    reason<br><br>Much of the design depends on what and how you need to get the results<br>of rule firing back to the application, so I won&#39;t continue.<br><br>-W<br>

<div class="gmail_quote">On Thu, Mar 19, 2009 at 7:52 AM, Nikhil_dev <span dir="ltr">&lt;<a href="mailto:k.nikhil@verchaska.com" target="_blank">k.nikhil@verchaska.com</a>&gt;</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>
i have combined all the rules into a single RuleBase,<br>
below is the content of drl file,<br>
<br>
package com.vtech.ruleengine.module.rulemanagermodule<br>
import com.vtech.ruleengine.module.rulemanagermodule.RuleAttributes;<br>
import java.util.Map;<br>
<br>
rule  &quot;adt_chld_fare&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $a : RuleAttributes()<br>
        eval ($a.Values[&quot;Adult Fare&quot;]&gt; ($a.Values[&quot;Child Fare&quot;]+ 1500 ) )<br>
then<br>
         ($a.Values[&quot;AcceptRejectFilter&quot;]=&#39;Reject&#39;)<br>
end<br>
<br>
<br>
rule  &quot;DEMO_RULE&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $a : RuleAttributes()<br>
        eval ($a.Values[&quot;Adult Fare&quot;]&gt; 8000 )<br>
then<br>
         ($a.Values[&quot;Nett Payable&quot;]= ($a.Values[&quot;Adult Fare&quot;]* 0.80 ) )<br>
end<br>
<br>
<br>
rule  &quot;Compare_date_1&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $a : RuleAttributes()<br>
        eval (&#39;12-Jan-2009&#39;&gt;=&#39;15-Jan-2008&#39;)<br>
then<br>
         ($a.Values[&quot;Adult Fare&quot;]= 5000 )<br>
end<br>
<br>
<br>
rule  &quot;Rule_20090106_1&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $a : RuleAttributes()<br>
        eval ( ($a.Values[&quot;No Of Adults&quot;]&lt; 10 ) &amp;&amp; ($a.Values[&quot;No Of<br>
Adults&quot;]&gt; 5 ) )<br>
then<br>
         ($a.Values[&quot;Adult Fare&quot;]= ($a.Values[&quot;Adult Fare&quot;]+ -50 ) )<br>
end<br>
<br>
<br>
rule  &quot;Rule_20090107_Markup&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $a : RuleAttributes()<br>
        eval ($a.Values[&quot;markupPerc&quot;]&gt;= 0 )<br>
then<br>
         ($a.Values[&quot;markupAmount&quot;]=<br>
($a.Values[&quot;buyingAmount&quot;]*$a.Values[&quot;markupPerc&quot;]) )<br>
end<br>
<br>
<br>
rule  &quot;Sample_Rule&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $a : RuleAttributes()<br>
        eval ($a.Values[&quot;Sector&quot;]&lt; 0 )<br>
then<br>
         ($a.Values[&quot;Via&quot;]= ($a.Values[&quot;Via1&quot;]+ 1250 ) )<br>
end<br>
<br>
i am passing following hashmap containing,<br>
hmAttriList.put(&quot;Adult Fare&quot;, 8000);<br>
hmAttriList.put(&quot;Child Fare&quot;, 80);<br>
hmAttriList.put(&quot;Gross Fare&quot;, 0);<br>
hmAttriList.put(&quot;Published Fare&quot;, 0);<br>
<br>
while executing it i am getting following error message<br>
SEVERE [global]<br>
org.mvel.CompileException: could not perform numeric operation on<br>
non-numeric types: left-type=null; right-type=java.lang.Integer<br>
        at<br>
org.mvel.math.IEEEFloatingPointMath.doOperationNonNumeric(IEEEFloatingPointMath.java:149)<br>
        at<br>
org.mvel.math.IEEEFloatingPointMath._doOperations(IEEEFloatingPointMath.java:102)<br>
        at<br>
org.mvel.math.IEEEFloatingPointMath.doOperation(IEEEFloatingPointMath.java:43)<br>
        at org.mvel.util.ParseTools.doOperations(ParseTools.java:810)<br>
        at<br>
org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)<br>
        at org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45)<br>
        at<br>
org.mvel.ast.Substatement.getReducedValueAccelerated(Substatement.java:24)<br>
.............<br>
..............<br>
==&gt;[ActivationCreated(0): rule=adt_chld_fare;<br>
tuple=[fid:1:1:com.vtech.ruleengine.module.rulemanagermodule.RuleAttributes@14a0fe1]<br>
]<br>
Error Message : org.mvel.CompileException: could not perform numeric<br>
operation on non-numeric types: left-type=null; right-type=java.lang.Integer<br>
<br>
<br></blockquote></div><br>