Hi Michael, Drools users, 
I've one hundred rules in my rulebase.
Each rules have a different salience (they're all ordered between them ).
Each rule can set the value of the category and "exclude" all other rules.
That is to say that when a category is set, I clear the agenda.

My rulefile looks like this (in pseudo-code ) :

rule "CAT1" salience 980 
        when
                The category is empty
                Type of the input is '10' //The 1st and the 2nd chars of the 
record
                The color matches 'Regular Expression' //The 3rd to 20th chars 
of the record
        then
                Set to the category the value 'CAT1'
                drools.clearAgenda()
end


rule "CAT2" salience 970
        when
                The category is empty
                Type of the input is '20' //The 1st and the 2nd chars of the 
record
                The area is neither 'XX' nor 'YY' //The 20th to 22th chars of 
the record
        then
                Set to the category the value 'CAT2'
                drools.clearAgenda()
end

rule "CAT3" salience 960 
        when
                The category is empty
                Type of the input is '20' //The 1st and the 2nd chars of the 
record
                The area is either 'XX' or 'YY' //The 20th to 22th chars of the 
record
        then
                Set to the category the value 'CAT3'
                drools.clearAgenda()
end 

        

Do you need some more infos or is it enough ?

Thanks for your help.


> De: "Michael Neale" <[EMAIL PROTECTED]>
> A: user@drools.codehaus.org
> Objet: Re: [drools-user] Using Drools to modify the records of a file
> Date: Thu, 4 May 2006 11:05:32 +1000

> may need some more info on the specifics of your rule.
> On 5/3/06, Karim <[EMAIL PROTECTED]> wrote:
> >
> > Hi all Drools users,<br>
> > I'm trying to use Drools in order to determinize a category from a
> > record from an input file and write the category int an output file.<br>
> > I have around 100 categories and so around 100 rules.<br>
> > Everything works well except the fact that the perf are really bad.<br>
> > After profiling my program, it appears that the performance problem
> > cames from the call of the modifyObject method everytime I read a new
> > record. With a file of 10000 lines, I need 200 seconds to determinize
> > all the categories. The modifyObject method calls represents 185
> > seconds.<br>
> > <br>
> > The problem is that I've not found any other ways to activate my rules
> > without making a call to modifyObject.<br>
> > <br>
> > Is there any other way to read a file, and determinize all my
> > categories without regenerating the activations in the agenda every new
> > line ?<br>
> > <br>
> > I already tried to activate all my rules, to get all the activations
> :<br>
> > org.drools.spi.Activation[] acts = workingMemory.getAgenda
> > ().getActivations();<br>
> > <br>
> > To create a new agenda Group :<br>
> > org.drools.common.AgendaGroupImpl group = new
> > org.drools.common.AgendaGroupImpl("test");<br>
> >         for(int j = 0; j < acts.length; j++  {<br>
> >             group.add(acts[j]);<br>
> >         }<br>
> > <br>
> > To create my agenda :<br>
> > org.drools.common.Agenda agenda = new org.drools.common.Agenda
> > (workingMemory);<br>
> >         agenda.addAgendaGroup(group);<br>
> >         agenda.setFocus(group);<br>
> > <br>
> > And I modified the working memory to always fire the rules in my agenda
> > :<br>
> > workingMemory.fireAllRules(agenda);<br>
> > <br>
> > But the problem is that the LHS is not evaluated and all the rules
> > activated are fired so I always have the same result (the one from the
> > rules with the smaller salience...).<br>
> > <br>
> > I will really appreciate any help :-)<br>
> > <br>
> > Thank you<br>
> > <br>
> > <br>
> >
> > CaraMail le seul webmail à vous offir des fils d'infos RSS -
> > www.caramail.com
> >

Avec M6mobile, remixe « la Boulette » de Diam?s et crée ton propre tube. 
Inscris ton mix au concours et soumets le aux oreilles des internautes ET à 
celles de Diam?s ! Visit: http://ad.fr.doubleclick.net/clk;32430316;13177692;b

Reply via email to