[rules-users] How to use KnowledgeAgent in the "old manner" (just like RuleAgent)

Mark Proctor mproctor at codehaus.org
Tue Dec 16 03:22:22 EST 2008


psentosa wrote:
> Hi all,
>
> Can anyone give some explanation / examples on this? The docu is still using
> ruleagent.
> I found some piece of codes within the KnowledgeAgentFactory, but I saw that
> it uses the configuration object. 
The javadocs:
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/javadocs/stable/drools-api/org/drools/agent/KnowledgeAgent.html
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/javadocs/stable/drools-api/org/drools/ChangeSet.html

There are a number of unit tests you can follow:
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/agent/KnowledgeAgentTest.java

http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/ChangeSetTest.java

http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/ChangeSetTest.java
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/
> I personally prefer the old style by using
> a property file in which the configuration is defined.
>   
The properties file does not offer enough flexibilility to support all 
resource types - the xml really is quite simple - how do you specify the 
worksheet name for a decision tree? In some ways it's actually simpler 
and more powerful, as there is no separate line for directories, it's 
just another resource and it detects that it's a directory. ChangeSets 
will eventually support remove and modify, for incremental knowledgebase 
changes, so the properties file just doesn't cut it.

<change-set>
   <add>
      <resource source='http://www.domain.com/test.drl' type='DRL' />
      <resource source='file://data/somedir' type='DRL' />
      <resource source='http://www.domain.com/test.xls' type='DTABLE' >
         <decisiontable-conf worksheet-name='sheet10' input-type='XLS' />
      </resource>
  </add>        
</change-set>


Mark


> Thanks in advance for any help
>
> Regards
> Paul
>   





More information about the rules-users mailing list