The problem is that you are inserting the fact type definition instead of the facts themselves. <div><br></div><div>instead of insert <i>appType</i> and <i>incomeType</i> you should insert <i>application</i> and <i>income</i>.<br clear="all">
<br>Best Regards,<br><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
<br><br><div class="gmail_quote">On Mon, Jul 16, 2012 at 3:20 PM, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Why do you think that you should have a third fact when there are no<br>
insert() calls except the two in your Java code?<br>
<span class="HOEnZb"><font color="#888888">-W<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 16/07/2012, Ravikiran <<a href="mailto:ravikiran.kakarla@gmail.com">ravikiran.kakarla@gmail.com</a>> wrote:<br>
> Hi,<br>
> I'm using default Guvnor package "mortgages" decision table as example for<br>
> my POC. Below is the rules from the decision table. No rule is being fired<br>
> from my JAVA client out of 3 rules given below.<br>
><br>
> //from row number: 1<br>
> rule "Row 3 Pricing loans"<br>
> dialect "mvel"<br>
> when<br>
> application : LoanApplication( amount > "131000" , amount <=<br>
> "200000" , lengthYears == "30" , deposit < "20000" )<br>
> income : IncomeSource( type == "Asset" )<br>
> then<br>
> application.setApproved( true );<br>
> application.setInsuranceCost( 0 );<br>
> application.setApprovedRate( 2 );<br>
> end<br>
><br>
> //from row number: 2<br>
> rule "Row 1 Pricing loans"<br>
> dialect "mvel"<br>
> when<br>
> application : LoanApplication( amount > "10000" , amount <= "100000" ,<br>
> lengthYears == "20" , deposit < "2000" )<br>
> income : IncomeSource( type == "Job" )<br>
> then<br>
> application.setApproved( true );<br>
> application.setInsuranceCost( 0 );<br>
> application.setApprovedRate( 4 );<br>
> end<br>
><br>
> //from row number: 3<br>
> rule "Row 2 Pricing loans"<br>
> dialect "mvel"<br>
> when<br>
> application : LoanApplication( amount > "100001" , amount <= "130000" ,<br>
> lengthYears == "20" , deposit < "3000" )<br>
> income : IncomeSource( type == "Job" )<br>
> then<br>
> application.setApproved( true );<br>
> application.setInsuranceCost( 10 );<br>
> application.setApprovedRate( 6 );<br>
> end<br>
><br>
> ==> My Java client follows<br>
> KnowledgeBase knowledgeBase = createKnowledgeBase(); //Successfully creates<br>
> knowledgebase<br>
> StatefulKnowledgeSession session =<br>
> knowledgeBase.newStatefulKnowledgeSession();<br>
><br>
> FactType appType = knowledgeBase.getFactType( "mortgages",<br>
> "LoanApplication" );<br>
> FactType incomeType = knowledgeBase.getFactType( "mortgages",<br>
> "IncomeSource" );<br>
><br>
> Object application = appType.newInstance();<br>
> Object income = incomeType.newInstance();<br>
><br>
> appType.set(application, "amount", 100000);<br>
> appType.set(application, "deposit", 1500);<br>
> appType.set(application, "lengthYears", 20);<br>
><br>
> incomeType.set(income, "type", "Job");<br>
> incomeType.set(income, "amount", 65000);<br>
><br>
> session.insert(appType);<br>
> session.insert(incomeType);<br>
><br>
> assertTrue(session.getFactCount() == 2);<br>
> session.fireAllRules();<br>
> assertTrue(session.getFactCount() == 3);<br>
><br>
> Question: I hope the way i pass the input satisfies "Row 2 Pricing loans"<br>
> above. But My assertion is getting failed after calling<br>
> fireAllRules()...because the factcount was still 2. Please help what could<br>
> be the wrong in above scenario.<br>
><br>
> thanks a lot.<br>
><br>
> --<br>
> View this message in context:<br>
> <a href="http://drools.46999.n3.nabble.com/Drools-Guvnor-Decison-Tables-Rule-is-not-being-fired-Please-help-tp4018701.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-Guvnor-Decison-Tables-Rule-is-not-being-fired-Please-help-tp4018701.html</a><br>
> Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
_______________________________________________<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></div>