Eliane,

I guess you are using Drools 2.x. It is possible to load a set of different rule files in the same RuleBase and then create working memories from each of your RuleBases. Look at the following code snippet:

           RuleBaseBuilder builder = new RuleBaseBuilder( );
           RuleBaseContext factoryContext = new RuleBaseContext( );

           for ( Iterator i = ruleFiles.iterator(); i.hasNext(); ) {
               RuleFile file = (RuleFile) i.next();
               InputStream fileStream = file.getInputStream();
               RuleSetReader reader = new RuleSetReader( factoryContext );
               RuleSet ruleSet = reader.read( fileStream );
               builder.addRuleSet( ruleSet );
               fileStream.close();
           }
          RuleBase ruleBase = builder.build();

RuleFile is a class I created myself that basically stores the DRL file names and manages opening, uncompressing (in my case they are compressed), etc.
  It is pretty easy and straight forward.

  Hope it helps.

  []s
  Edson


Eliane Daghfal wrote:

In fact,
what i want is to have separate drl files each one containing a rule set . I never used the xml entity but i took a look at it now and in fact to include the external files we need to specify the parent node (something like this)
----
<!DOCTYPE rule-set [
<!ENTITY ext1 SYSTEM "./helloworld.csharp.drl.xml">
]>

---
till now this does not work in i have a absolute url exception although i think that i specified correctly the path ... But will the xml entities allow me to "load" different rule sets in different files ? if yes how should the doctype be written knowing that in the drl file the parent node is rule-set
can i write something like this ??

<!DOCTYPE [
<!ENTITY ext1 SYSTEM "./first.csharp.drl.xml">
<!ENTITY ext2 SYSTEM "./two.csharp.drl.xml">
]>
thanks for ur help,
--
Eliane Daghfal



Reply via email to