functions .drl file
by Chris Richmond
Is it possible to create a .drl file of nothing but functions then import
those into another .drl file to make it easy to maintain one file of API
style functions and then beable to call them from any additional .drl files?
Thanks,
Chris
16 years, 7 months
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.
16 years, 7 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
16 years, 7 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.
16 years, 7 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
16 years, 7 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
16 years, 7 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
16 years, 7 months