Updating the knowledge base manually...
by Pablo Navais
Hi,
I'm very new to Drools and don't know if this is possible, but i'm trying to
manually update the knowledge base with the following steps :
1. Retrieve a knowledge builder from KnowledgeBuilderFactory
2. Load a drl rules file into builder
3. Create a knowledge base with the knowledge packages from the builder
4. Create a session from the kbase
4. Insert objects into the working memory => Activations are created
5. Fire all rules => Rules are launched , objects are created by rules and
asserted into the WM
6. Retract objects generated by rules from the WM
7. Remove knowledge packages from the kbase
8. Generate another builder, load a different drl rules file and add the
knowledge pacakges to the kbase => Activations are created automatically
just after adding new packages but objects are created by rules and asserted
into the WM.
9. Fire all rules -> Te agenda is empty , no rules are launched.
Are the 8th and 9th steps the expected behaviour or i'm just doing something
wrong ? The same seems to happen when
Thanks in advance.
Pablo.
15 years, 5 months
Traversing the Rete Network
by Peter Wong
Hello,
I am trying to find out if and why a rule is not activated/fired when
asserting a piece of data. At the moment I am using JBoss AOP to pointcut
the method EntryPointNode.assertObject(), and from there I run an algorithm
to walk to "every" node in the rete network. My question is how can I be
sure that I have indeed accessed every node in the network? Thanks for your
help.
Regards,
Peter
15 years, 5 months
Updating the knowledge base manually...
by pnavais
Hi,
I'm very new to Drools and don't know if this is possible, but i'm trying to
manually update the knowledge base with the following steps :
1. Retrieve a knowledge builder from KnowledgeBuilderFactory
2. Load a drl rules file into builder
3. Create a knowledge base with the knowledge packages from the builder
4. Create a session from the kbase
4. Insert objects into the working memory => Activations are created
5. Fire all rules => Rules are launched , objects are created by rules and
asserted into the WM
6. Retract objects generated by rules from the WM
7. Remove knowledge packages from the kbase
8. Generate another builder, load a different drl rules file and add the
knowledge pacakges to the kbase => Activations are created automatically
just after adding new packages but objects are created by rules and asserted
into the WM.
9. Fire all rules -> Te agenda is empty , no rules are launched.
Are the 8th and 9th steps the expected behaviour or i'm just doing something
wrong ?
Thanks in advance.
Pablo.
--
View this message in context: http://www.nabble.com/Updating-the-knowledge-base-manually...-tp24089673p...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
averages on different data types
by Chris Richmond
Hi guys,
Building from the stockticker sample, I have been running my own average
aggregates over time and window length and I have the following rule.it
simply runs a last 10 average and outputs the average(in theory).
rule "show averages"
when
$n : Number( doubleValue > 0 ) from accumulate (
$mdo : MyDataObject($tm: delayTime) over window:length(10) from
entry-point "DataObject stream",
average( $tm )
)
then
System.err.println($tm);
End
I have set the limit to 0 for the average because I simply want to have it
fire every time, no matter the average(they are all positive)
However I get this error:
Unable to build expression for 'consequence': Failed to compile: 1
compilation error(s):
- (1,3) unqualified type in strict mode for: $tm '
System.err.println($tm);
' : [Rule name='show averages']
If I have the consequence
System.err.println($n);
Then it outputs the average no problem, but I am trying to simply output
that indifidual value, delayTime which I have stored in $tm is an integer,
so I cannot figure out why I cannot output this value. Similarly if I
simply try as a consequence:
System.err.println($ mdo.delayTime);
I get a similar error.
What am I doing wrong?
Thanks,
Chris
15 years, 5 months
Re: [rules-users] Creating drools rules porgramatically?
by Dave Cracauer
Malay,
We've been doing something similar to what you are asking for, but using the rule syntax as an intermediate step. We have a datamodel that users can use to
express the rules, and we have a templating engine that turns that into the drools syntax. This then gets compiled into packages and built into a rule base. This has worked rather well for us, as it allows us to make updates to logic on the fly by changing the templates.
--
Dave
-----Original Message-----
>From: Malay Shah <malay.shah(a)morganstanley.com>
>Sent: Jun 17, 2009 12:36 PM
>To: rules-users(a)lists.jboss.org
>Subject: [rules-users] Creating drools rules porgramatically?
>
>
>Hi,
>
>I am looking to create the drools Rule objects programatically, and I
>believe there is API to do that in 4.0.7. But, the API looks complex and the
>documentation is not sufficient. Could anyone please point me to some
>examples of doing this? I basically don't want to write rules in .drl files,
>but have a database store the rules and make them strongly typed (by
>generating Rule Objects directly from DB). Any help is much appreciated.
>
>Thanks
>Malay
>
>--
>View this message in context: http://www.nabble.com/Creating-drools-rules-porgramatically--tp24077426p2...
>Sent from the drools - user mailing list archive at Nabble.com.
>
>_______________________________________________
>rules-users mailing list
>rules-users(a)lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
15 years, 5 months
Re: [rules-users] Guvnor Building pkg error
by Yan Liu
Toni,
Thanks for your reply. Seems you guys use a different version of mvel2.jar
for Guvnor 5 and my glassfish picked up the older version. Had it fixed and
it builds fine now.
Yan
15 years, 5 months
Where is the log4j configuration file kept?
by Lukas, Ray
This is such a simple thing I would think.. But I don't have it working.
Con someone please help out.
I am running a standalone Drools application in Eclipse, I have it all
working and all my rules fire and everything works great, but I can not
get log4J working with it. I have climbed mountains only top stumble on
a pebble.. ...
Log.error("x") sends to console. So I know that a log4j configuration is
in play. I don't see a log4j properties file, or xml file to add my
stuff into. That is the problem.. where is that located...
Creating my own, and adding it to the class path, of course, as you
would expect, just gets ignored..
Where is the one that Drools uses??
This is what I am looking to add.. I am pretty sure this is correct, but
I could be wrong, long hours and... I could be wrong...
<appender name="myProject"
class="org.jboss.logging.appender.RollingFileAppender">
<errorHandler
class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<!-- <param name="File"
value="${jboss.server.log.dir}/server.log"/> -->
<param name="File" value=" myProject.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="20"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<category name="com.model">
<priority value="Trace" />
<appender-ref ref=" myProject"/>
</category>
<category name="com.request">
<priority value="Trace" />
<appender-ref ref=" myProject"/>
</category>
<category name="com.response">
<priority value="Trace" />
<appender-ref ref=" myProject"/>
</category>
<category name="com.sample">
<priority value="Trace" />
<appender-ref ref=" myProject"/>
</category>
15 years, 5 months