Identity, equality, hashing and indexing
by Bruno Freudensprung
Hi,
I have some existential questions about Drools Expert's magic :-).
When reading the documentation it is clear that, by default, facts are
stored in an IdentityHashMap. If I understand things correctly it means
that the objects I put in the working memory don't have to implement the
hashCode() and equals() method. They should implement them only if I
tell Drools to use the "equality mode".
So here is my first question: in equality mode, if a fact field is used
by the hashCode method, and if that field is modified by a rule action,
should I expect a weird behavior since facts are stored in a HashMap?
When digging into rules-users' archives I also found posts of Mark
Proctor, talking about field indexing and alpha node hashing, that lead
to my second question: should I expect a weird behavior if 2 fields are
related to each other?
For instance (not a good example but it gives an idea): a Person type
has a getFirstName() method, a getLastName() method and a getName()
method that return the concatenation of getFirstName() and getLastName().
Is it problematic if one rule has a "Person(name == "John Doe")" fact in
its LHS and if another rule modifies the "firstName" of that Person fact
(John -> Jane)?
Does it depend on the equality vs. identity mode (I don't think so...
unless the field itself is a also a fact)?
Many thanks in advance for your answers,
Best regards,
Bruno.
13 years, 11 months
Troubles building 5.1.1 source osgi-bundles
by kenichiwa
I am unable to build Drools from the 5.1.1 source distribution because it
complains about not finding the osgi-bundles directory. I noticed the
drools-5.1.1-osgi-bundles.zip file download available, but how do I add this
to the build? It does not contain a pom.xml file. The README.txt does not
mention anything about osgi-bundles.
Also...README.txt says "NOTE: you MUST use maven version 2.0.9 or 2.0.10 to
build because of surefire
maven plugin classpath problems". Does this mean I must compile Maven to get
this to work since they only make Maven 2.0.11 binary available for
download??
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Troubles-building-5-1...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 11 months
Installing Drools Eclipse IDE on 64 bit linux
by sholliday
Does Drools Eclipse IDE run on 64 bit linux?
I have a fresh install of eclipse IDE.
I installed the GEF plugin from here:
http://archive.eclipse.org/tools/gef/downloads/drops/3.5.1/R200909151220/...
I tried to use the Drools Eclipse update site here:
http://downloads.jboss.com/drools/updatesite3.5/ but it does not list me
any content.
So I manually downloaded the tools from here:
http://www.jboss.org/drools/downloads.html
When I start up my eclipse and try to open the sample project I see the
error below.
Any help is much appreciated ... I am at a bit of a loss where to go from
here,
Thanks
Sharon
!SESSION 2010-12-07 15:35:11.808
-----------------------------------------------
eclipse.buildId=M20090917-0800
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_AU
Framework arguments: -plugincustomization ../eclipse.preferences.ini
Command-line arguments: -os linux -ws gtk -arch x86_64 -data ../workspace/
-plugincustomization ../eclipse.preferences.ini
!ENTRY org.eclipse.jdt.core 4 4 2010-12-07 15:35:19.119
!MESSAGE Unable to read variable and containers file
!STACK 0
java.io.EOFException
at java.io.DataInputStream.readBoolean(DataInputStream.java:227)
at
org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.loadBoolean(JavaModelManager.java:3155)
at
org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.loadPath(JavaModelManager.java:3245)
at
org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.loadContainers(JavaModelManager.java:3217)
at
org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.loadProjects(JavaModelManager.java:3275)
at
org.eclipse.jdt.internal.core.JavaModelManager$VariablesAndContainersLoadHelper.load(JavaModelManager.java:3109)
at
org.eclipse.jdt.internal.core.JavaModelManager.loadVariablesAndContainers(JavaModelManager.java:2946)
at
org.eclipse.jdt.internal.core.JavaModelManager.startup(JavaModelManager.java:4589)
at org.eclipse.jdt.core.JavaCore.start(JavaCore.java:4965)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
at
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
at
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
at
org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:454)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:152)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
at
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
at
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:457)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at
org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
at
org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
at
org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
at
org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at
org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at
org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
at
org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:63)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:324)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:668)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
at
org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
at
org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:982)
at
org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
at
org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2965)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at
org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2946)
at
org.eclipse.ui.internal.WorkbenchWindow$21.runWithException(WorkbenchWindow.java:2263)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at
org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
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:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
!ENTRY org.eclipse.core.resources 4 566 2010-12-07 15:35:19.804
!MESSAGE An error occurred while traversing resources.
!STACK 0
java.lang.NullPointerException
at
org.drools.eclipse.util.DefaultDroolsRuntimeRecognizer.addJarNames(Unknown
Source)
at
org.drools.eclipse.util.DefaultDroolsRuntimeRecognizer.recognizeJars(Unknown
Source)
at org.drools.eclipse.util.DroolsRuntimeManager.recognizeJars(Unknown
Source)
at
org.drools.eclipse.util.DroolsRuntimeManager.getDroolsRuntimeJars(Unknown
Source)
at org.drools.eclipse.util.DroolsClasspathContainer.getJarNames(Unknown
Source)
at
org.drools.eclipse.util.DroolsClasspathContainer.createDroolsLibraryEntries(Unknown
Source)
at
org.drools.eclipse.util.DroolsClasspathContainer.getClasspathEntries(Unknown
Source)
at
org.eclipse.jdt.internal.core.JavaModelManager.containerPutIfInitializingWithSameEntries(JavaModelManager.java:594)
at
org.eclipse.jdt.internal.core.SetContainerOperation.executeOperation(SetContainerOperation.java:49)
at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at
org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:793)
at
org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1781)
at org.eclipse.jdt.core.JavaCore.getClasspathContainer(JavaCore.java:2652)
at
org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2578)
at
org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2679)
at
org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:1866)
at
org.eclipse.jdt.internal.core.JavaProject.isOnClasspath(JavaProject.java:2169)
at org.drools.eclipse.view.rules.RulesView.updateResource(Unknown Source)
at org.drools.eclipse.view.rules.RulesView.visit(Unknown Source)
at org.eclipse.core.internal.resources.Resource$2.visit(Resource.java:108)
at
org.eclipse.core.internal.resources.Resource$1.visitElement(Resource.java:60)
at
org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:82)
at
org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at
org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at
org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at
org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at
org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:120)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:70)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:106)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:90)
at org.drools.eclipse.view.rules.RulesView.init(Unknown Source)
at
org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:340)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:313)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:529)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:668)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
at
org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
at
org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:272)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:982)
at
org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2626)
at
org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWindow.java:2965)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at
org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2946)
at
org.eclipse.ui.internal.WorkbenchWindow$21.runWithException(WorkbenchWindow.java:2263)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at
org.eclipse.ui.internal.Workbench$28.runWithException(Workbench.java:1384)
at
org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2316)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
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:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Installing-Drools-Ecl...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 11 months
new to Drools: modeling issues
by Gabor Szokoli
Hi there,
We are evaluating Drools for an industry project. Trouble is, I'm not
good at ignoring men behind curtains, and need to know how things
actually work.
Links to papers explaining the theory and principles of Drools Expert
are highly appreciated.
Some specifics:
We have a network of domain objects, with basic attributes (numbers,
strings, enums) and two-way mapped associations.
Rules modify the basic attributes only. Associations (references and
reference sets) are static.
"where" conditions refer to both static information and modifiable attributes.
I was wondering how I can express this distinction in my domain
objects without sacrificing readability of the actual rules?
(Domain experts should be able to edit the rules themselves.)
Here's the current pattern of my rules:
rule "child molester"
where
$parent : Parent( ... )
$child: Child(parent==$parent ... attribute!="value")
then
modify ($child) { setAttribute("value") }
end
I'm not happy my users need to know about the setter methods instead
of using the same reflection-backed notation as in the condition.
I also worry they'll make infinite loops by omitting the
"attribute!=value" clause.
So I guess I should elevate the attributes to first class status in my
model to make them the atomic unit of triggering, but how do I do that
elegantly?
rule "attribute molester"
where
$parent : Parent( ... )
$attribute : StringHolder(get()!="value")
$child: Child(parent==$parent ... attribute=$attribute)
then
modify ($attribute) { set("value") }
end
That looks worse than before! Please share your thoughts.
Thanks in advance:
Gabor Szokoli
13 years, 11 months
WorkingMemoryEventListener and Stateless sessions in sequential mode
by Bruno Freudensprung
Hi,
I am using Drools 5.1.1 and I have the impression that the
WorkingMemoryEventListener is not called when using a
StatelessKnowledgeSession configured in Sequential mode.
Does anyone have experienced such a behavior?
When using the SequentialOption.NO option, the little program below (in
PS) displays:
Retracting: to-be-removed
Retracted: to-be-removed
When using the SequentialOption.YES option, the program displays:
Retracting: to-be-removed
Many thanks in advance,
Bruno.
PS : Here is the sample code
// DRL:
rule "Retract to-be-removed string"
when
$s : String(this == "to-be-removed")
then
System.out.println("Retracting: " + $s);
retract($s);
end
// listener:
public class MyListener implements
org.drools.event.rule.WorkingMemoryEventListener {
public void objectInserted(
org.drools.event.rule.ObjectInsertedEvent event) {
}
public void
objectRetracted(org.drools.event.rule.ObjectRetractedEvent event) {
System.out.println("Retracted: " +
event.getOldObject().toString());
}
public void
objectUpdated(org.drools.event.rule.ObjectUpdatedEvent event) {
}
}
// main:
KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add(ResourceFactory.newFileResource(new
File("simpleRule.drl")),ResourceType.DRL);
KnowledgeBaseConfiguration configuration =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
configuration.setOption(SequentialOption.YES); // change this
line to change the program behavior
KnowledgeBase knowledgeBase =
KnowledgeBaseFactory.newKnowledgeBase(configuration);
knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages());
StatelessKnowledgeSession session =
knowledgeBase.newStatelessKnowledgeSession();
MyListener handler = new MyListener();
List<Command<?>> commands = new ArrayList<Command<?>>();
commands.add(CommandFactory.newInsert("to-be-removed"));
commands.add(new AddEventListenerCommand(handler));
session.execute(CommandFactory.newBatchExecution(commands));
13 years, 11 months
Re: [rules-users] KnowledgeAgent exception while trying to deserialize
by John Peterson
I had a ruleflow resource I needed to add, and I cleaned up my KB
creation code and that seemed to take care of it. I also did a rebuild
of the package in Guvnor, so I'm not 100% sure what exactly fixed it,
but it is fixed. Thanks for the follow-up.
>Message: 1
>Date: Sat, 04 Dec 2010 04:47:23 +0000
>From: Mark Proctor <mproctor(a)codehaus.org>
>Subject: Re: [rules-users] KnowledgeAgent exception while trying to
> deserialize KnowledgeDefinitionsPackage
>To: rules-users(a)lists.jboss.org
>Message-ID: <4CF9C7DB.2010900(a)codehaus.org>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Did you recompile the packages in Guvnor, there is a button for that.
>Server and client must all be on the same version, as well as compiled
Packages.
>
>Mark
>On 03/12/2010 16:15, John Peterson wrote:
>>
>> I'm getting the following error when I attempt torun my Drools
>> application. I recently upgraded from Drools 5.0.1 and Guvnor 5.0.1
>> to 5.1.1 (for both). I've looked through the rules-users list and I
>> found the issue with the XML Change Set (authentication), which I've
>> addressed (XML listed at the bottom), but I'm still getting the
error.
>> Does anyone have any ideas or can point me in a particular direction?
>>
>> Thanks
>>
>> Error:
>>
>> [2010:12:337 09:12:373:debug] KnowledgeAgent mapping
>> resource=[ClassPathResource path='ruleflow.rf'] to
>> KnowledgeDefinition=org.drools.ruleflow.core.RuleFlowProcess@2d89ba2a
>>
>> [2010:12:337 09:12:373:exception]
>>
>> _java.lang.RuntimeException_: KnowledgeAgent exception while trying
to
>> deserialize KnowledgeDefinitionsPackage
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(_
>> KnowledgeAgentImpl.java:914_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(_KnowledgeAg
>> entImpl.java:704_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(_Knowledge
>> AgentImpl.java:584_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(_KnowledgeAgen
>> tImpl.java:185_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(_KnowledgeAgen
>> tImpl.java:168_)
>>
>> at
>>
com.agencyawards2.RuleSessionProviderFactory.getSessionFactory(_RuleSe
>> ssionProviderFactory.java:102_)
>>
>> at
>>
com.agencyawards2.RuleSessionProviderFactory.getProvider(_RuleSessionP
>> roviderFactory.java:30_)
>>
>> at com.agencyawards2.RunRules.runRules(_RunRules.java:25_)
>>
>> at com.agencyawards2.DroolsTest.main(_DroolsTest.java:36_)
>>
>> Caused by:_java.lang.NullPointerException_
>>
>> at
>>
org.drools.process.core.impl.ProcessImpl.equals(_ProcessImpl.java:134_
>> )
>>
>> at java.util.HashMap.put(Unknown Source)
>>
>> at java.util.HashSet.add(Unknown Source)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl$RegisteredResourceMap.putDefi
>> nition(_KnowledgeAgentImpl.java:1150_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.addDefinitionMapping(_Knowled
>> geAgentImpl.java:1037_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.buildResourceMapping(_Knowled
>> geAgentImpl.java:496_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.buildResourceMapping(_Knowled
>> geAgentImpl.java:443_)
>>
>> at
>>
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(_
>> KnowledgeAgentImpl.java:912_)
>>
>> ... 8 more
>>
>> Change Set:
>>
>> *<?xml version="1.0" encoding="UTF-8" ?> *
>>
>> *- <change-set xmlns="http://drools.org/drools-5.0/change-set"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
>> xs:schemaLocation="http://drools.org/drools-5.0/change-set
>> drools-change-set-5.0.xsd">*
>>
>> *- <add>*
>>
>> *<resource
>>
source="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/pac
kage/com.agencyawards2/LATEST"
>> type="PKG" basicAuthentication="enabled" username="admin"
>> password="admin" /> *
>>
>> *</add>*
>>
>> *</change-set>*
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
13 years, 11 months
Insert new facts in WorkingMemory event handler
by Bruno Freudensprung
Hi everyone,
Do you know if it is possible to insert/modify/retract facts in a
working memory event handler?
Here is my use case actually: I want my users to be able to write rules
like "When ... Then retract X" without having to bother with the
consequences of retracting X on the other objects of the sessions (some
of them might be retracted as well). These consequences can be expressed
by rules, but I would like them to be kind of "part of the framework"
and it would be easier for users if those rules were implicitly defined.
Many thanks in advance for any hint,
Best regards,
Bruno.
13 years, 11 months
Re: [rules-users] rules-users Digest, Vol 49, Issue 16
by Mike Love
Regards,
Mike Love
mike.love(a)symbiotics.co.za
-----Original Message-----
From: rules-users-request(a)lists.jboss.org
Sender: rules-users-bounces(a)lists.jboss.org
Date: Mon, 06 Dec 2010 04:15:57
To: <rules-users(a)lists.jboss.org>
Reply-To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 49, Issue 16
Send rules-users mailing list submissions to
rules-users(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-request(a)lists.jboss.org
You can reach the person managing the list at
rules-users-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. Re: Repackaging of the jar: missing drools.rulebase.conf?
(Kris Verlaenen)
2. Re: Task Server as Jboss Service (Cristiano Nicolai)
3. Drools Spring + JPA + JTA (Cristiano Nicolai)
4. Re: How to modify changeset.xml in guvnor (Jervis Liu)
5. new to Drools: modeling issues (Gabor Szokoli)
----------------------------------------------------------------------
Message: 1
Date: Sun, 05 Dec 2010 21:57:50 +0100
From: Kris Verlaenen <kris.verlaenen(a)cs.kuleuven.be>
Subject: Re: [rules-users] Repackaging of the jar: missing
drools.rulebase.conf?
To: Rules Users List <rules-users(a)lists.jboss.org>, drdaveg(a)gmail.com
Message-ID: <4CFBFCCE.1020507(a)cs.kuleuven.be>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
This is specified in the drools-core jar, in the
drools.default.rulebase.conf:
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-core/src...
Kris
drdaveg wrote:
> I had several Eclipse projects with customized WorkItem's in 5.1. The latest
> download of the source code seems to have been reorganized: I see
> drools.rulebase.conf files that seem unrelated to drools.workDefinitions and
> all the versions that look like what I would expect are in the example files
> and their jars; have the drools-process jar's been repackaged without
> drools.rulebase.conf or might this file have been deprecated?
>
> What I had been expecting was to find an entry like:
>
> drools.workDefinitions = WorkDefinitions.conf
>
> in the file with a corresponding WorkDefinitions.conf file for the email and
> log WorkItem's. Thanks!
>
------------------------------
Message: 2
Date: Mon, 6 Dec 2010 09:20:38 +1000
From: Cristiano Nicolai <cristiano.nicolai(a)gmail.com>
Subject: Re: [rules-users] Task Server as Jboss Service
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<AANLkTimYSqyNCQi7uyKN2=2kUgxLXc5A0SaFfE4hLc-K(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
OK, done: https://jira.jboss.org/browse/JBRULES-2818
There's any reason for packing drools-process-task with persistence.xml? The
problem is that Jboss will try to deploy it if it's in the classpath.
Thanks.
2010/12/3 Mauricio Salatino <salaboy(a)gmail.com>
> You can create a jira issue explaining your contribution as a new feature.
> And attach a patch or the project into it. Then we will review it and let
> you know.
>
> 2010/12/3 Cristiano Nicolai <cristiano.nicolai(a)gmail.com>
>
> I'd done some work on deploying the task service on Jboss and I'm wondering
>> that could be a new maven module.
>> I also changed the rhq-plugin to control it over admin-console.
>>
>> How can I start to contribute with that?
>>
>> Thanks
>>
>>
>> On Thu, Dec 2, 2010 at 9:29 AM, Cristiano Nicolai <
>> cristiano.nicolai(a)gmail.com> wrote:
>>
>>> That's interesting and important as well, I'll give a try with HornetQ...
>>>
>>> There's any sample configuration? Which WorkItemHandler must be used...
>>>
>>> Thanks
>>>
>>>
>>> 2010/12/1 Mauricio Salatino <salaboy(a)gmail.com>
>>>
>>>> Hmm it really depends on your scenario.
>>>> Mina doesn't have message realibility and a lot of things that HornetQ
>>>> provides. But If you are OK with Mina you can use it.
>>>>
>>>>
>>>>
>>>> 2010/11/30 Cristiano Nicolai <cristiano.nicolai(a)gmail.com>
>>>>
>>>>> No, I didn't, I just saw some sources in the drools-process-task
>>>>> module. I preferred to go with what is in the documentation, wondering that
>>>>> Mina transport is the recommended approach.
>>>>>
>>>>> 2010/12/1 Mauricio Salatino <salaboy(a)gmail.com>
>>>>>
>>>>> did you try the HornetQ integration?
>>>>>> The main idea was to create a transport agnostic TaskServer, so for
>>>>>> each implementation you can choose between different technologies depending
>>>>>> on the situation.
>>>>>> I'm not sure if there is another effort for this kind of deployment..
>>>>>> if no one else answer this mail feel free to propose and contribute with
>>>>>> your ideas.
>>>>>> Greetings
>>>>>>
>>>>>> 2010/11/30 Cristiano Nicolai <cristiano.nicolai(a)gmail.com>
>>>>>>
>>>>>>> If there's no other way/plans to deploy it, even using HornetQ
>>>>>>> integration, I'll be more than happy to contribute!
>>>>>>>
>>>>>>> 2010/11/30 Mauricio Salatino <salaboy(a)gmail.com>
>>>>>>>
>>>>>>> I think that your idea would be a great contribution!
>>>>>>>>
>>>>>>>> 2010/11/30 Cristiano Nicolai <cristiano.nicolai(a)gmail.com>
>>>>>>>>
>>>>>>>>> Hi guys,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I think that would be great if we could deploy the TaskServer
>>>>>>>>> (MinaTaskServer) as a JbossMC bean, making possible to administer it using
>>>>>>>>> admin-console.
>>>>>>>>>
>>>>>>>>> There's any work in this way or other plans to deploy this
>>>>>>>>> component?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Best regards,
>>>>>>>>>
>>>>>>>>> Cristiano Nicolai
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> rules-users mailing list
>>>>>>>>> rules-users(a)lists.jboss.org
>>>>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> - CTO @ http://www.plugtree.com
>>>>>>>> - MyJourney @ http://salaboy.wordpress.com
>>>>>>>> - Co-Founder @ http://www.jbug.com.ar
>>>>>>>>
>>>>>>>> - Salatino "Salaboy" Mauricio -
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> rules-users mailing list
>>>>>>>> rules-users(a)lists.jboss.org
>>>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Best regards,
>>>>>>>
>>>>>>> Cristiano Nicolai
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> rules-users mailing list
>>>>>>> rules-users(a)lists.jboss.org
>>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> - CTO @ http://www.plugtree.com
>>>>>> - MyJourney @ http://salaboy.wordpress.com
>>>>>> - Co-Founder @ http://www.jbug.com.ar
>>>>>>
>>>>>> - Salatino "Salaboy" Mauricio -
>>>>>>
>>>>>> _______________________________________________
>>>>>> rules-users mailing list
>>>>>> rules-users(a)lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best regards,
>>>>>
>>>>> Cristiano Nicolai
>>>>>
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users(a)lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> - CTO @ http://www.plugtree.com
>>>> - MyJourney @ http://salaboy.wordpress.com
>>>> - Co-Founder @ http://www.jbug.com.ar
>>>>
>>>> - Salatino "Salaboy" Mauricio -
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users(a)lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>>
>>> --
>>> Best regards,
>>>
>>> Cristiano Nicolai
>>>
>>
>>
>>
>> --
>> Best regards,
>>
>> Cristiano Nicolai
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> - CTO @ http://www.plugtree.com
> - MyJourney @ http://salaboy.wordpress.com
> - Co-Founder @ http://www.jbug.com.ar
>
> - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Best regards,
Cristiano Nicolai
13 years, 11 months
Drools Spring + JPA + JTA
by Cristiano Nicolai
Hi guys,
I'm trying to deploy a spring based Knowledege Session with JPA persistence
on Jboss 5.1, I was able to do it using a RESOURCE_LOCAL persistence unit
but I would like to use a container JTA based deployment.
Basically, JPAConfiguration requires a Spring PlatformTransactionManager
then I tried to use the following combination:
<bean id="springTxManager"
class="org.springframework.transaction.jta.JtaTransactionManager" />
<jee:jndi-lookup id="springEMF" jndi-name="java:DroolsEMF"/>
The problem is that using it,
SingleSessionCommandService.initTransactionManager does not create a
JPAManager.
So, my guess for this to work is to add support for this on
SingleSessionCommandService or change JPAConfiguration
(drools-spring-1.0.0.xsd) to accept that no transaction-manager is defined,
causing Drools JtaTransactionManager to lookup the TransactionMananger from
JNDI context.
The only way that I could deploy it is using these beans definitions:
<bean id="springEMF"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation"
value="classpath:META-INF/spring-persistence.xml" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
</bean>
<bean id="springTxManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="springEMF" />
</bean>
Thanks.
--
Best regards,
Cristiano Nicolai
13 years, 11 months