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

Paul Sentosa psentosa at yahoo.com
Tue Dec 16 04:45:07 EST 2008


Hi,

Mark, thanks for the links and explanation.
So if I use Guvnor for administrating my rules,
- should I use the URL pointing to LATEST.DRL in change-set instead of the one in package snapshot to get the latest version of rules?

- I assume the communication between my application and the Guvnor will happen by the time applyChangeSet-method (which defines a resource by pointing to the URL of DRL) is called and internally create package out of it (compared to the method newRuleAgent("properties"). Is this correct? Is there any significat difference in required time/performance?

Again, thanks and appreciate your answer

Regards
Paul





________________________________
From: Mark Proctor <mproctor at codehaus.org>
To: Rules Users List <rules-users at lists.jboss.org>
Sent: Tuesday, December 16, 2008 9:22:22 AM
Subject: Re: [rules-users] How to use KnowledgeAgent in the "old manner" (just like RuleAgent)

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
>  


_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081216/ffaa65f1/attachment.html 


More information about the rules-users mailing list