[rules-users] Using global variable in DRL file

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jul 27 02:50:34 EDT 2012


How do the record counts relate to files? 1800,12k and
9.5k =:= ABPolicyTransactions, ABPolicy, ABAgent?

Are these two rules all there is?

The second one has
    $csvPolicy : CSVBeanPolicy()
    //$csvAgent : CSVBeanAgent()   --- assume this is not commented out

Now if you do insert CSVBeanAgents, this will create (using the
*assumed* record counts) that you'll get 12,000*9,500 = 114.000,000
activations! This is the reason for your heap problem.

The RHS of this rule has an if, comparing agent ids from both facts.
(If statements on the RHS is an anti-pattern, with rare exceptions!)
Conditions belong into the LHS!

rule "accumulate policy APEs into agent APE"
when
    $csvAgent : CSVBeanAgent( $agno: agentNo, $agAPE: agentAPE )
    $csvPolicy : CSVBeanPolicy( agentNo == $agno, $polAPE: policyAPE )
then
    modify( $csvAgent ){
           setAgentAPE(  $agAPE + $polAPE )
    }
end

Now, inserting all facts will still create some activations, but only
12,000, the number of ABPolicy records.

Firing the rules after each insertion of an agent will not let more
than one activation accumulate - you can't have less that that :)

-W



On 27/07/2012, zeeshan <zeeshan.spring at gmail.com> wrote:
> Hi Laune and thanks for replying....
>
> Actually it was not just 50,000, it was 1,00,000 records in single CSV that
> we solved the Heap space problem by your help and we have developed that
> product and successfuly integrated in Liferay Portal... :)
>
> Now in this case, we have to read* three CSV files* having *1800,12k and
> 9.5k* records. Now our concern is that if it was running fine for 100
> thousand records then why it is creating problem data which is much lesser
> than 100 thousand.
>
> Actually we are thinking in the direction like, it might creating problem
> because increased number of columns in each of three CSV files that we are
> using compare to that 100 thousand records in which we had 8 columns but
> only one file.
>
> Another concern is ,there may be possibility that as we are generating
> objects from 3 CSV one after another then firing rules might creating
> problem...??  Please help us in finding out what is the reason for this
> problem....Please find the Rulemain.java and Sample .drl file which u asked
> me to provide....
>
> thanks !!
>
> http://drools.46999.n3.nabble.com/file/n4018939/RuleMain.java RuleMain.java
>
> http://drools.46999.n3.nabble.com/file/n4018939/RuleRunner.java
> RuleRunner.java  http://drools.46999.n3.nabble.com/file/n4018939/Sample.drl
> Sample.drl
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018939.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list