Answering my own question Eclipse 3.4
by J Michael Dean
I have verified that if I start with a virgin Ganymede (Eclipse 3.4)
installation and install Drools 5M3, and then try to install 4.07 from
update site, I cannot go back and trying to manipulate the plugins and
features manually will destroy the ability of the Eclipse distribution
to ever expose Drools.
Also found that my previous problem (probably obvious) is that the
entire binary needs to be used as the runtime environment. I just put
it in as a plugin so it is conveniently located.
- Mike
16 years
Drools 5 in Eclipse 3.4.1 Newbie
by J Michael Dean
Trying to move forward to Eclipse 3.4 so got it set up and now Drools
5.0.0.M3 eclipse plugin and feature. Appears to have no effect, so am
guessing I have to load much more than that. The documentation
implies that I ought to be up and running. I was able to create a new
Drools project, but it would not function, asking for a run time
Drools setup. Removed these and tried to install 4.07 using the
Eclipse 3.3 update site, and that failed. Removed 4.07 artifacts as
far as I can tell, but now when I put the 5.0.0 feature and plugin
back, there is no sign of Drools. I am guessing that trying to load
the 4.07 from the update site has done something subtle to my Eclipse
setup, but no idea.
Shorter question is whether there is more to installing Drools 5 in
Eclipse than is in the documentation. Thanks for any assistance.
- Mike
16 years
Design question for RuleBase and session
by vanshi
I have a ruleEngine class which has one static rulebase and also static
stateful session. The Engine has a static block, that parses drl files and
adds that to package builder and rule base and creates a new stateful
session........all this is done in the static block. So for other classe
that need to access the ruleEngine, there are two ways to access
1) They can get hold of static rule base and create their own session.
2) They can get hold of the centralized stateful session and inserts objects
in that.
Is this idea of having centralized session might create confusion between
different object? Which is better......just to have a static rulebase and
any class that needs functionality of inserting objects/firing rules
.....must create their own session from the rule base OR should the session
be centralized?
--
View this message in context: http://www.nabble.com/Design-question-for-RuleBase-and-session-tp20649168...
Sent from the drools - user mailing list archive at Nabble.com.
16 years
PackageBuilderConfigurations and RuleFlows Drools 5
by keithnielsen
I have the following code:
PackageBuilder packageBuilder = null;
Properties properties = new Properties();
properties.setProperty( "drools.dialect.java.compiler","JANINO" );
PackageBuilderConfiguration cfg = new PackageBuilderConfiguration(
properties );
//error was thrown here complaining about JDT Core not being on classpath
prior to me creating
//configuration and adding Janino jar file to classpath of the plug-in
packageBuilder = new PackageBuilder(cfg);
.
.
.
packageBuilder.addRuleFlow(source);
I receive the "The Eclipse JDT Core jar is not in the classpath" error
message.
I was wondering why since I had created a PackageBuilderConfiguration and
added it to the packagebuilder.
Stepping through the code it appears that the call stack looks like the
following:
packageBuilder.addRuleFlow(source);
ProcessBuilder.addProcessFromFile(.....);
PackageBuilderConfiguration.init(....);
Question is why is the ProcessBuilder not using the
PackageBuilderConfiguration created previously and set on the package
builder and instead creating a new instance? I don't have anywhere to
configure the ProcessBuilder since this is internal to the call on the
packageBuilder.addRuleFlow
Thanks
--
View this message in context: http://www.nabble.com/PackageBuilderConfigurations-and-RuleFlows-Drools-5...
Sent from the drools - user mailing list archive at Nabble.com.
16 years
Rete: A Fast Algorithm for the Many Pattern/Many Object Pattern Match Problem
by Maxim Veksler
Hello,
Can some one please direct me from where to download this article / email it
to me directly please ?
I've googled quite a lot for "Rete: A Fast Algorithm for the Many
Pattern/Many Object Pattern Match Problem" and could find the article
itself.
--
Cheers,
Maxim Veksler
"Free as in Freedom" - Do u GNU ?
16 years
DRL package builder or rule base error
by vanshi
Hi all,
I have some set of rules which work on same Person object but depending on
whether a person is student/employee/Faculty, the rule will have dfferent
logic.
So, I've made 3 .drl files, one will have all the rules for students, other
for employee and then last .drl for faculty. All 3 .drl have same package
name (as the first statement in drl) but all rules are named differently.
When my rule engine starts, it reads these 3 drl files and adds them to a
single rule base, starts a new session, inserts person in working memory and
fires rules.
Now, my questions are...is there anything odd/wrong with this approach?
Secondly, I had some rules names same in different drl and when I changed
them ....then I started getting null pointer exception error..... during
parsing of drl files. Any idea why is that?
code snippet:
list=new ArrayList<File>();
list.add(new File("students.drl"));
list.add(new File("emloyee.drl");
list.add(new File("faculty.drl"));
Iterator<File> it = list.iterator();
ruleBase = RuleBaseFactory.newRuleBase();
builder = new PackageBuilder();
Reader source=null;
while(it.hasNext())
{
source = new
InputStreamReader(RuleEngine.class.getResourceAsStream(it.next().toString()));
builder.addPackageFromDrl(source);
//if DRL has errors don't add it to the RuleBase
if(builder.hasErrors())
log4j.logError(RuleEngine.class, builder.getErrors().toString());
else
ruleBase.addPackage(builder.getPackage());
}
workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(person);
workingMemory.fireAllRules();
--
View this message in context: http://www.nabble.com/DRL-package-builder-or-rule-base-error-tp20627083p2...
Sent from the drools - user mailing list archive at Nabble.com.
16 years
NullPointerException on modifyInsert
by keithnielsen
I have the following test:
public void testFireAllRules() {
rulesManager = RulesManager.getInstance();
assertNotNull(rulesManager);
StatefulSession session =
rulesManager.getStatefulSession("com.dfs.dc.servicing.cms.cid.verification.test");
assertNotNull(session);
Account account = new Account();
account.setAccountNumber("6011006500000");
account.setBalance(200);
account.setDaysDelinquent(32);
//insert a fact
FactHandle accountHandle = session.insert(account);
System.out.println(accountHandle.toExternalForm());
session.fireAllRules();
//insert a fact
//FactHandle accountHandle2 = session.insert(account);
//System.out.println(accountHandle2.toExternalForm());
account.setBalance(300);
session.modifyInsert(accountHandle, account);
System.out.println(accountHandle.toExternalForm());
}
When I call modifyInsert I receive a NullPointerException with the following
stacktrace:
java.lang.NullPointerException
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:169)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:143)
at
org.drools.common.AbstractWorkingMemory.modifyInsert(AbstractWorkingMemory.java:1226)
at
org.drools.common.AbstractWorkingMemory.modifyInsert(AbstractWorkingMemory.java:1183)
at
com.dfs.ecc.framework.client.rules.test.RulesManagerTest.testFireAllRules(RulesManagerTest.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at
org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
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.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:574)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:195)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
I have tried it with both shadow facts enabled and disabled (just fishing
here)
I checked the session and can see that the fact is there with the same ID
after the fireAllRules has returned.
An insert works fine but the modifyInsert does not.
Thanks
--
View this message in context: http://www.nabble.com/NullPointerException-on-modifyInsert-tp20627245p206...
Sent from the drools - user mailing list archive at Nabble.com.
16 years
What's more efficient?
by David Sinclair
I have a question regarding the performance of pattern matching. Is it more
performant to use join nodes, or to use a from?
For example. With joins I could write a rule like
rule "Foo Join"
when
Foo($bar : bar != null)
Bar(this == $bar)
then
...
end
rule "Foo From"
when
$foo :Foo()
Bar () from $foo.bar
then
...
end
thanks
16 years