Does guvnor 5.1 uses hibernate ?
by Harshit Bapna
Hello All,
I am investigating Drools Guvnor for its rule authoring capabilities.
*The site says the Gunor License is ASL but it packages hibernate jars.
Hibernate license is LGPL.*
I removed the hibernate jars from Guvnor & still it is able to perform db
operations.
Note: Guvnor is using Oracle database as a repository (not using the default
file system repo). Repository file attached.
*Question:
1. Does Guvnor uses hibernate jars? If yes then in what scenarios. (I am
able to do create rules in repo (database) without hibernate jars)
2. Is hibernate a leftover from old versions of drools ? Why is it packaged
with drools 5.1 guvnor release ?*
*Tasks performed to proove that Guvnor does not have any dependency on
hibernate.*
1. Stopped the JBOSS server
2. Removed hibernate jars from guvnor lib folder.
3. Started Guvnor
3. Created rules in guvnor. I verified that the new rules were getting
stored in the database.
Hence no dependency of guvnor on Hibernate.
--harshit
15 years, 3 months
Multiple bindings with the same type
by Robert Miyashiro
Let¹s say there¹s a rule with multiple bindings of the same type evaluated
in a stateless session. For example:
rule
when
$list1 : ArrayList()
$list2 : ArrayList()
then
...
end
Now, I have 2 ArrayList objects to insert into the session, A1 and A2. How
can I make sure that A1 gets bound to $list1, and A2 gets bound to $list2?
Obviously, I can¹t just insert A1 first followed by A2 and expect that to
work. Is there some kind of evaluation mode or setting that will make
Drools pay attention to the order in which objects are inserted into the
session?
15 years, 3 months
DROOLS problem with sliding windows
by AberAber
I have been working with sliding windows, and they do not appear to work
properly in DROOLS 5.1.1 or I am misunderstanding how they work. My goal is
to have the last X number of samples averaged or summed. I've tried two
mechanism, the accumulate/from, and the collect, and they both behave
similarly wrong (or different than I expect), but this was much easier to
follow so I've posted it for help.
The way I have the code structured, I receive values for two nodes, 1 and 2
every second or two, which each contain random values. After each value
received I pass the CPUReportEvent and fire the rules. The results are
bizarre. Sometimes it resets back to 1 count, sometimes it keeps the value
to the previous one. It seems to also fire both rules when really only one
should've been triggered? Can someone explain the results and how to adjust
it to work for my specs? Thanks!
I can't see into the accumulate function, so here's the collect function,
but they perform identically.
package com.sample
import com.sample.DroolsTest.Message;
import com.sample.DroolsInput;
import com.sample.CPUReportEvent;
import com.ComEntity;
import java.util.Iterator
import java.util.ArrayList
declare CPUReportEvent
// declare a fact type as an event, default is 'fact'
@role( event )
end
rule "collect with length window"
no-loop true
when
$comEntity : ComEntity()
$list : ArrayList () from collect(
CPUReportEvent(comEntity == $comEntity)
over window:length(3) )
then
System.out.print("Entity " + $comEntity.getName() + " fired of count " +
$list.size() + " value");
Double sum = 0.0;
Double count = 0.0;
for(Iterator it = $list.iterator();it.hasNext();) {
CPUReportEvent report = (CPUReportEvent) it.next();
System.out.print(" " + report.getAmount());
sum = sum + report.getAmount();
count = count + 1.0;
}
if (count > 0.0)
{
Double avg = (sum / count);
System.out.print(" - Sum " + sum + " avg " + avg + " count " +
count);
}
System.out.println();
end
RESULTS:
Node1 : 7.0
Entity Node2 fired of count 0 value
Entity Node1 fired of count 1 value 7.0 - Sum 7.0 avg 7.0 count 1.0
Node2 : 94.0
Entity Node2 fired of count 1 value 94.0 - Sum 94.0 avg 94.0 count 1.0
Node1 : 43.0
Entity Node1 fired of count 2 value 7.0 43.0 - Sum 50.0 avg 25.0 count 2.0
Node2 : 85.0
Entity Node2 fired of count 2 value 94.0 85.0 - Sum 179.0 avg 89.5 count 2.0
Entity Node1 fired of count 1 value 43.0 - Sum 43.0 avg 43.0 count 1.0
Node1 : 88.0
Entity Node2 fired of count 1 value 85.0 - Sum 85.0 avg 85.0 count 1.0
Entity Node1 fired of count 2 value 43.0 88.0 - Sum 131.0 avg 65.5 count 2.0
Node2 : 47.0
Entity Node2 fired of count 2 value 85.0 47.0 - Sum 132.0 avg 66.0 count 2.0
Entity Node1 fired of count 1 value 88.0 - Sum 88.0 avg 88.0 count 1.0
Node1 : 39.0
Entity Node2 fired of count 1 value 47.0 - Sum 47.0 avg 47.0 count 1.0
Entity Node1 fired of count 2 value 88.0 39.0 - Sum 127.0 avg 63.5 count 2.0
Node1 : 0.0
Entity Node1 fired of count 2 value 39.0 0.0 - Sum 39.0 avg 19.5 count 2.0
When I set the window to 4, the results are similar but never get past a
count of 2.
Node2 : 87.0
Entity Node2 fired of count 1 value 87.0 - Sum 87.0 avg 87.0 count 1.0
Entity Node1 fired of count 0 value
Node1 : 39.0
Entity Node1 fired of count 1 value 39.0 - Sum 39.0 avg 39.0 count 1.0
Node2 : 11.0
Entity Node2 fired of count 2 value 87.0 11.0 - Sum 98.0 avg 49.0 count 2.0
Node1 : 48.0
Entity Node1 fired of count 2 value 39.0 48.0 - Sum 87.0 avg 43.5 count 2.0
Node2 : 33.0
Entity Node2 fired of count 2 value 11.0 33.0 - Sum 44.0 avg 22.0 count 2.0
Node1 : 69.0
Entity Node1 fired of count 2 value 48.0 69.0 - Sum 117.0 avg 58.5 count 2.0
Node2 : 63.0
Entity Node2 fired of count 2 value 33.0 63.0 - Sum 96.0 avg 48.0 count 2.0
Node1 : 82.0
Entity Node1 fired of count 2 value 69.0 82.0 - Sum 151.0 avg 75.5 count 2.0
Node2 : 94.0
Entity Node2 fired of count 2 value 63.0 94.0 - Sum 157.0 avg 78.5 count 2.0
Node1 : 65.0
Entity Node1 fired of count 2 value 82.0 65.0 - Sum 147.0 avg 73.5 count 2.0
And here's sliding window length of 5:
Node1 : 34.0
Entity Node2 fired of count 0 value
Entity Node1 fired of count 1 value 34.0 - Sum 34.0 avg 34.0 count 1.0
Node1 : 3.0
Entity Node1 fired of count 2 value 34.0 3.0 - Sum 37.0 avg 18.5 count 2.0
Node2 : 92.0
Entity Node2 fired of count 1 value 92.0 - Sum 92.0 avg 92.0 count 1.0
Node1 : 61.0
Entity Node1 fired of count 3 value 34.0 3.0 61.0 - Sum 98.0 avg
32.666666666666664 count 3.0
Node1 : 65.0
Entity Node1 fired of count 4 value 34.0 3.0 61.0 65.0 - Sum 163.0 avg 40.75
count 4.0
Node2 : 81.0
Entity Node2 fired of count 2 value 92.0 81.0 - Sum 173.0 avg 86.5 count 2.0
Entity Node1 fired of count 3 value 3.0 61.0 65.0 - Sum 129.0 avg 43.0 count
3.0
Node1 : 29.0
Entity Node1 fired of count 3 value 61.0 65.0 29.0 - Sum 155.0 avg
51.666666666666664 count 3.0
Node2 : 28.0
Entity Node2 fired of count 2 value 81.0 28.0 - Sum 109.0 avg 54.5 count 2.0
Node2 : 46.0
Entity Node2 fired of count 3 value 81.0 28.0 46.0 - Sum 155.0 avg
51.666666666666664 count 3.0
Entity Node1 fired of count 2 value 65.0 29.0 - Sum 94.0 avg 47.0 count 2.0
Node2 : 55.0
Entity Node2 fired of count 4 value 81.0 28.0 46.0 55.0 - Sum 210.0 avg 52.5
count 4.0
Entity Node1 fired of count 1 value 29.0 - Sum 29.0 avg 29.0 count 1.0
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/DROOLS-problem-with-s...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 3 months
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.
15 years, 3 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.
15 years, 3 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.
15 years, 4 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
15 years, 4 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));
15 years, 4 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
15 years, 4 months