activationCancelled() not being executed?
by Fermion
Hi!
I'm using a JTable to display rules that have been activated.
My goal is to have the table display a set of activations ordered by their
salience. The user should then choose which one of them to fire (if you want
to know why, be invited to read the background).
Of course this makes only sense as long as the activations are valid. Rules
whose activation has been cancelled should still be displayed, but in a
different style (like greyed out).
In order to accomplish this, I want to use an implementation of the
AgendaEventListener-interface, implementing the
activationCancelled()-method.
The Listener itself works, as I use the activationCreated()-method to add
the rule as a row to my table (which works fine).
Unfortunately the activationCancelled()-method doesn't seem to be executed
at all!
I assume that I have a fundamental misunderstanding of what should trigger
an activationCancelled() event?
Background: (just if you're curious...)
I'm working as a PhD student in physics at the CERN international
high-energy physics laboratory, for the ATLAS experiment.
As a member of the Detector Control System (DCS) group, I'm going to write
an expert system in order to assist the shift crew with the detector
operation.
The operation of the detector is a difficult task, because more than 70000
parameters (like voltages, currents and temperatures) have to be controlled.
A Finite State Machine (FSM) computes a defined and limited number of states
from the given parameters (like ON, OFF, STANDBY,...).
I'm going to synchronize the expert system application to ERROR states of
the FSM, in order to extract the relevant parameters from the system (as it
would be impossible to feed all parameters into the XPS all the time).
This is handled by quite some control rules that decide which data has to be
requested, released and so on.
Once all necessary data has been received, this might lead to activations of
the (more interesting) user rules.
Those rules have an explanatory character like "The temperature of this XYZ
is too high, so please try ABC."
For a given set of facts I assume more then one rule to be activated. Whilst
the rule engine should take care of the execution (firing) of all control
related rules, the execution of the user rules should be under direct user
control.
Displaying all activations in a GUI will allow the user to pick one (try it)
and rate it (the proposed solution solved the problem "yes/no"). Changing
the rules salience according to the answer, will allow the system to
dynamically reflect the current system status. (Rules that are related to
broken connections / wrongly connected cables are likely to be found at the
beginning of the experiment but hopefully only on rare occasion later on.)
In order to ensure that no information is lost during the absence of DCS
experts (which will not always be around), a log file should be written for
each major FSM-ERROR. At the moment the WorkingMemoryFileLogger seems to be
predestined for this job. This way I hope to collect large amounts of ERROR
data during the initial phase of the experiment that helps to extract rules
for numerous error conditions.
This will become especially handy, as such errors have a tendency to come
back, even if the original detector experts are gone for years...
--
View this message in context: http://www.nabble.com/activationCancelled%28%29-not-being-executed--tf434...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 2 months
Drools 4.0.4 and Jboss 4.2.2 GA
by Ojwang Wilson O
All,
I am having the following error when deploying drools 4.0.4 within JBOSS
4.2.2 GA. Please help.
====================
01:06,259 INFO [STDOUT] ERROR 17-03 17:01:06,248
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,318 INFO [STDOUT] ERROR 17-03 17:01:06,316
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,348 INFO [STDOUT] ERROR 17-03 17:01:06,347
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,477 INFO [STDOUT] ERROR 17-03 17:01:06,476
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,506 INFO [STDOUT] ERROR 17-03 17:01:06,506
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,523 INFO [STDOUT] ERROR 17-03 17:01:06,522
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,649 INFO [STDOUT] ERROR 17-03 17:01:06,648
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,660 INFO [STDOUT] ERROR 17-03 17:01:06,659
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:06,935 INFO [STDOUT] ERROR 17-03 17:01:06,934
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,065 INFO [STDOUT] ERROR 17-03 17:01:08,064
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,243 INFO [STDOUT] ERROR 17-03 17:01:08,242
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:01:08,994 INFO [STDOUT] ERROR 17-03 17:01:08,993
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:33,956 INFO [STDOUT] ERROR 17-03 17:19:33,956
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:33,988 INFO [STDOUT] ERROR 17-03 17:19:33,987
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:19:34,039 INFO [STDOUT] INFO 17-03 17:19:34,038
(SecurityServiceImpl.java:login:45) Logging in user [wojwang]
17:19:34,048 INFO [STDOUT] INFO 17-03 17:19:34,047
(DefaultAuthenticator.java:authenticate:38) User logged in via
default authentication module (no security check).
17:19:34,068 INFO [STDOUT] ERROR 17-03 17:19:34,067
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
17:24:34,104 INFO [STDOUT] ERROR 17-03 17:24:34,102
(Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
===================
Regards
Wilson
16 years, 5 months
RE: Rules with Lookup Tables...
by Rahul Phadnis
Have you looked at
http://labs.jboss.com/portal/jbossrules/subversion.html
I think that page is not uptodate since at the bottom
it says "Trunk is unstable and may often not build. If
you wish to build form Subversion source the latest
tag is:
http://anonsvn.labs.jboss.com/labs/jbossrules/tags/3.0.3-GA/
"
Are n't we at 3.0.5 already?
-Rahul
--- jjdepaul(a)us.ibm.com wrote:
> Rahul -
>
> Where can I find Maven2 repository that has the
> nightly builds for Drools project?! I've looked
> around on a couple of well-known ones abut no luck
> finding anything above D3.0.5
>
> thanks,
> james
> >
> > The "from" CE (conditional expression) is not
> > available in the current released jboss rules
> version
> > (3.0.5) and you probably have to use the nightly
> build
> > to use it.
> >
> > -Rahul
> >
> >
>
>
16 years, 5 months
Re:JUnit testing
by J. Michael Dean
>
Thanks. Sorry for few details as this has been a several message
question. I have created a Drools plugin that contains EITHER the
maximum number of jars and dependencies (i.e. ALL), or the minimum
(i.e. those needed for compiler option only processing DRL files), or
adding the entire Drools distribution to my Java extensions folder in
OS X, and in all instances, I get an error loading dialects. The
enigma for me is that all of these plugin options enable me to make a
stand alone RCP application that works fine.
Here is the test unit code:
@BeforeClass
public static void setUp() throws Exception {
Reader source;
PackageBuilderConfiguration pkgConfig = new
PackageBuilderConfiguration();
JavaDialectConfiguration javaDialectConf =
(JavaDialectConfiguration) pkgConfig.getDialectConfiguration("java");
javaDialectConf.setCompiler(JavaDialectConfiguration.ECLIPSE);
final PackageBuilder builder = new PackageBuilder(pkgConfig);
boolean exists = (new File("rules/GlucoseDroolRules00.drl")).exists();
if (exists) {
builder.addPackageFromDrl(new FileReader(
"rules/GlucoseDroolRules00.drl"));
System.out.println("Found the file!");
} else {
System.out.println("Cannot locate the file - will try as resource");
source = new InputStreamReader(AllDroolsRulesTests.class
.getResourceAsStream("rules/GlucoseDroolRules00.drl"));
builder.addPackageFromDrl(source);
}
if (builder.hasErrors()) {
System.out.println(builder.getErrors().toString());
}
Package pkg = builder.getPackage();
ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(pkg);
}
It crashes in the line trying to instantiate the package
configuration. If I eliminate the lines that configure the package,
and invoke the package building without an argument (the default),
then the crash occurs in that line. The crash trace:
org.drools.RuntimeDroolsException: Unable to load dialect
'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
at
org
.drools
.compiler
.PackageBuilderConfiguration
.addDialect(PackageBuilderConfiguration.java:152)
at
org
.drools
.compiler
.PackageBuilderConfiguration
.buildDialectConfigurationMap(PackageBuilderConfiguration.java:140)
at
org
.drools
.compiler
.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:117)
at
org
.drools
.compiler
.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:94)
at
droolsRules.tests.AllDroolsRulesTests.setUp(AllDroolsRulesTests.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at
org
.junit
.internal
.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at
org
.eclipse
.jdt
.internal
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
460)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
673)
at
org
.eclipse
.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
386)
at
org
.eclipse
.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
196)
Caused by: java.lang.NullPointerException
at
org
.drools
.compiler
.PackageBuilderConfiguration
.addDialect(PackageBuilderConfiguration.java:146)
... 18 more
This trace is identical in all instances. I have looked at the source
code and it appears that the Drools code is looking for the drools
configuration file, and I am not sure if this is included in the
classpath when running JUnit. However, the minimal and maximal plugin
configurations make an RCP run perfectly as a standalone application.
This is Eclipse 3.3 fall version, Mac OXX Leopard (but have run on
Tiger and same error, so not a new Apple bug), Drools 4.03, and JUnit 4.
Thanks.
> ------------------------------
>
> Message: 8
> Date: Tue, 4 Dec 2007 06:50:15 -0800 (PST)
> From: "John J. Franey" <jjfraney(a)gmail.com>
> Subject: Re: [rules-users] JUnit testing
> To: rules-users(a)lists.jboss.org
> Message-ID: <14151759.post(a)talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
>
>
> J Michael Dean wrote:
>>
>> I am having problems figuring out how to do JUnit 4 unit tests with
>> Drools and am wondering what I am missing.
>>
>
> I'm successfully using junit4 to test rules. I build a rules
> package from
> my rules file, create a stateful session, insert facts, fire all
> rules, run
> queries, and finally, perform junit asserts on the results.
>
> I can't tell you what you are missing, unless you say what you have.
>
> Regards,
> John
>
>
> --
> View this message in context: http://www.nabble.com/JUnit-testing-tf4930259.html#a14151759
> 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
>
>
> End of rules-users Digest, Vol 13, Issue 6
> ******************************************
16 years, 6 months
are "sentence fragments" possible w/DSL?
by Matt Geis
Hey everyone -- I've got a problem around trying to create arbitrary DSL rules. I asked a similar question about a year ago, and given the state of Drools at the time, it wasn't possible. I'm not having much more success now, a year later, but I wanted to find out if what I'm trying to accomplish is even possible. If yes, how can I pull it off? If no, are there plans to have this level of flexibility with DSL's in the future?
My high-level goal is to allow non-programmers some flexibility in defining rules, without me calculating all possible permutations of a rule ahead of time and building an all-encompassing DSL definition.
What I want to do, in a DRL sense, if I were to fire a rule if a user asserted into memory has a house in San Francisco, could be expressed as follows, in java:
rule "rule1"
when
u : User( )
exists(a : Address(type== "HOUSE", city == "San Francisco") from u.addresses)
then
System.out.println( "got a user with a house in San Francisco");
end
Next, to make it easier, I can "DSL-ify" it as follows...
in my DSL I add the following
[condition][]address is present where {}=u : User() and exists (a: Address({}) from u.addresses)
(Note the "{}" right after the declared constraint for "Address"... -- by the way, this works. I've tested it out)
The problem is that while it does accept the constraints, Drools requires them to be in rule dialect format.
That's to say, the rule must look like this...
rule "rule1"
when
address is present where city=="San Francisco", type=="HOUSE"
then
output "got a user with a house in San Francisco"
end
As soon as the first DSL entry is found, it's expanded into a DRL-typecondition, and everything else is considered to be a literal in the DRLdialect. Normally, these would just be value constants, like TRUE,100, "foo", etc. I've massaged the intent of the DSL a bit, it seems,by allowing some form of arbitrary rule definition, but all I've doneis gone and created a DSL/DRL hybrid.
What I WANT to be able to do is populate that {} with DSL text, so I can write a rule like...
rule "rule1"
when
address is present where city is "San Francisco" and address type is "HOUSE"
then
output "got a user with a house in San Francisco"
end
What I'd really like to do is create this rule and adhere 100% to the DSL I've defined.
Can I do this already in Drools (is there something I'm overlooking)? Is there a way to tell the DSL expander to continue to perform substitutions on what it would normally treat as literal values?
Thanks!
Matt
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
16 years, 8 months
Drools and Google Summer Of Code
by Mark Proctor
http://blog.athico.com/2008/03/drools-and-google-summer-of-code.html
The Google Summer of Code <http://code.google.com/soc/2008/> is
beginning. Drools, being a Red Hat project, has to participate under the
Fedora banner. So I've put a few project ideas up on the JBoss GSoC
<http://labs.jboss.com/wiki/GSoC> page. If you're able to enter as a
student please do take a look and don't hesitate to contact if anything
interests you.
I've also listed the ideas below, please leave comments if you have any
other ideas you think might make good student projects. Or maybe you are
a student and you want to propose a GSoC project.
# Subversion/CVS and JCR synchronisation. This allows our web based BRMS,
called Guvnor, to synchronise it's content with what's used in an IDE,
such as Eclipse
# Eclipse file upload tool with meta-data properties editing. You should
be able to right click a file or a folder and upload to the web based
Guvnor. Previously uploaded files(assets) should be recognised and
uploaded as a modify.
# SBVR <http://www.businessrulesgroup.org/sbvr.shtml>, structured natural
language, implementation for Drools. Can do either or both the frontend
or the backend.
# Eclipse tooling enhancements including any of the following: search,
refactoring, reformatting.
# Animate the Rete view to represent network propagation.
# Improve the DSL capabilities of Drools, supporting more complex grammars.
# Improve the Guvnor, web based BRMS, to handle the management of more
asset types. Including images, video, sound etc. Guvnor involves JCR,
Seam and GWT work.
# Create a Web based process designer for Drools ruleflow using GWT
Designer. <http://code.google.com/p/gwt-diagrams/>
Mark
16 years, 8 months
BRMS and package issue
by rhickson
Hi everyone
Relatively new to BRMS and Drools. Built and tested some packages using
BRMS for a couple of
weeks, now having some problems loading the package in the last couple
of days. The error comes
up:
Does anyone have some information on this?
Any help is appreciated.
Thanks
Rich Hickson
rhickson(a)alcatel-lucent.com
RuleAgent(FlexRoute) INFO (Mon Mar 31 16:26:22 CDT 2008): Configuring
with newInstance=true, secondsToRefresh=30
RuleAgent(FlexRoute) INFO (Mon Mar 31 16:26:22 CDT 2008): Configuring
package provider : URLScanner monitoring URLs:
http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/com.samp...
with local cache dir of /home/visage/cache
RuleAgent(FlexRoute) INFO (Mon Mar 31 16:26:22 CDT 2008): Configuring
package provider : DirectoryScanner scanning dir: /home/visage/brms-pkgs
found 1 file(s).
RuleAgent(FlexRoute) INFO (Mon Mar 31 16:26:22 CDT 2008): Configuring
package provider : FileScanner scanning:
RuleAgent(FlexRoute) WARNING (Mon Mar 31 16:26:22 CDT 2008): Was an
error contacting
http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/com.samp....
Reponse header: {}
RuleAgent(FlexRoute) WARNING (Mon Mar 31 16:26:22 CDT 2008): Falling
back to local cache.
java.lang.NullPointerException
at org.drools.agent.FileScanner.readPackage(FileScanner.java:121)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
at
org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:43)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:216)
at com.sample.DroolsTest.main(DroolsTest.java:29)
16 years, 8 months
Missing mvel class after upgrade 4.0.4 => 4.0.5
by Christian Gorbach
hi ,
I am using maven, I tried to upgrade to the latest release be just
changing the dools pom version number to 4.0.5
After the upgrade execution fails with the following stack trace:
...
java.lang.NoClassDefFoundError: org/mvel/AbstractParser
at
org.drools.rule.builder.dialect.mvel.MVELDialect.setLanguageLevel(MVELDialect.java:128)
at
org.drools.rule.builder.dialect.java.AbstractJavaBuilder.<clinit>(AbstractJavaBuilder.java:26)
at
org.drools.rule.builder.dialect.java.JavaDialect.<init>(JavaDialect.java:78)
at
org.drools.rule.builder.dialect.java.JavaDialectConfiguration.getDialect(JavaDialectConfiguration.java:62)
at
org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:175)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:142)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:86)
......
has anyone successfully switched to the latest version using the maven2
poms?
thanks in advance,
c)hristian
16 years, 8 months
Question on BRMS Data Enumeration
by Barbara L Burns
I'm trying to do a simple example of loading enums programmatically pretty much
following the user guide example.
I'm on Drools and BRMS 4.0.5, Java 1.6 running under Jboss.
I'm trying to define this 'data enumeration/drop down list'
package com.alcatel_lucent.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DataEnumSource {
public Map<String, List<String>> loadData(){
Map<String, List<String>> map =
new HashMap<String,List<String>>();
List<String> l = new ArrayList<String>();
l.add("foo");
l.add("boo");
map.put("AvpSubscriptionId.subscriptionIdType", l);
l = new ArrayList<String>();
l.add("apple");
l.add("bannana");
map.put("AvpServiceContext.serviceContextId",l);
return map;
}
}
The jar containing the DataEnumSource has been defined as a model within BRMS.
Here's what I put in the 'Data enumeration' text window
=(new DataEnumSource()).loadData()
When validating the Data enumeration from BRMS, I get the following error:
Unable to load enumeration data.
unable to resolve class: DataEnumSource
Error type: org.mvel.CompileException
Any insight as to what might be the problem?
16 years, 8 months