Re: [rules-users] CompositiveClassLoader$CachingLoader$load method intermittently hangs

2014-05-15 Thread Steven Williams
We are also experiencing the same problems using 5.x and it is causing us
big problems.

I haven't had time to try it yet but do any developers know whether we
would be safe to change the HashMap the CompositiveClassLoader is using to
a ConcurrentHashMap?

thanks
Steve

---
Steven Williams



On Wed, Mar 19, 2014 at 12:31 AM, mikerod mjr4...@gmail.com wrote:

 I cannot easily reproduce an issue that I'm seeing.  This is an
 intermittent
 issue that happens probably 3% of the time or less.

 This is observed behavior in
 * Drools v5.6.0.Final, using
 * Janino compiler v2.5.16  transitively Drools brings
 * mvel2 v2.1.8.Final

 We have an environment that loads around 10 different KnowledgeBases into a
 list.
 Then one-by-one a single StatefulKnowledgeSession is created for a single
 KnowledgeBase, facts are inserted, and then fireAllRules is called.

 Every so often, we noticed that we were getting what seemed to be ininite
 looping behavior for during either insertion time or fireAllRules time.
 When we subsequently re-run the *same* session with the *same*
 KnowledgeBase
 and the *same* facts inserted, it was successful and finished in
 milliseconds (the average for our successful runs).  We have repeatedly
 seen
 this behavior of 1 failure, followed by a re-run that is successful.

 We were able to attach a profiler to several of these hung sessions to
 determine what was happening.  It turns out that in both the scenario where
 we saw a hang up on fact insertion and on fireAllRules call, the thread
 dump
 was the same.

 The stack looks like:
 ```
 main - Thread t@1
java.lang.Thread.State: RUNNABLE
  at java.util.HashMap.getEntry(HashMap.java:347)
  at java.util.HashMap.containsKey(HashMap.java:335)
  at

 org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:244)
  at

 org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:237)
  at

 org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:88)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:247)
  at

 org.mvel2.ParserConfiguration.checkForDynamicImport(ParserConfiguration.java:163)
  at
 org.mvel2.ParserConfiguration.hasImport(ParserConfiguration.java:191)
  at org.mvel2.ParserContext.hasImport(ParserContext.java:360)
  at org.mvel2.ParserContext.isVariableVisible(ParserContext.java:715)
  at
 org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:394)
  at
 org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:250)
  at
 org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
  at org.mvel2.MVEL.compileExpression(MVEL.java:810)
  at

 org.drools.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:417)
  at

 org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:238)
  at

 org.drools.rule.constraint.MvelConstraint.createMvelConditionEvaluator(MvelConstraint.java:224)
  at
 org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:208)
  at

 org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:175)
  at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:133)
  at

 org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
  at

 org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
  at
 org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:302)
  at
 org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:254)
  at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:366)
  at
 org.drools.common.SimpleBeliefSystem.insert(SimpleBeliefSystem.java:38)
  at

 org.drools.common.TruthMaintenanceSystem.addLogicalDependency(TruthMaintenanceSystem.java:207)
  at

 org.drools.common.TruthMaintenanceSystem.addLogicalDependency(TruthMaintenanceSystem.java:179)
  at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:247)
  at

 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:950)
  at

 org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:263)
  at

 org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:228)
  at

 org.drools.base.DefaultKnowledgeHelper.insertLogical(DefaultKnowledgeHelper.java:223)
  application-stack
  at some.drools.generated.rule.package.Rule_drools-generated2
  at some.drools.generated.rule.package.Rule_drools-generated1
  at
 org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1282)
  - locked 656dd9a0 (a org.drools.common.DefaultAgenda

Re: [rules-users] Jetty NoSuchMethodError Lorg/eclipse/jdt/core/compiler/CategorizedProblem

2013-11-26 Thread Steven Williams
I noticed this same error when attempting to use the Run Jetty Run eclipse
plugin with Jetty 6.1.26. Changing it to use Jetty 7.5.1 fixed the problem.
We still use version 6 on our test servers without a problem though so I
just put it down to some classpath issue with the plug-in.

---
Steven Williams



On Wed, Nov 27, 2013 at 3:01 AM, captainrhino 
graeme.kitc...@axa-travel-insurance.com wrote:


 I am running some drools application code through Jetty and I get the
 following error.  I'm guessing its something to do with a conflicting jar
 or
 dependency?  Any help would be much appreciated.  It does not happen when I
 run it through tomcat 7.

 java.lang.NoSuchMethodError:

 org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
 at

 org.drools.compiler.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:375)
 at
 org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
 at

 org.drools.compiler.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:405)
 at

 org.drools.compiler.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
 at

 org.drools.compiler.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:405)
 at

 org.drools.compiler.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46)
 at

 org.drools.compiler.compiler.PackageRegistry.compileAll(PackageRegistry.java:107)
 at

 org.drools.compiler.compiler.PackageBuilder.compileAll(PackageBuilder.java:1218)
 at

 org.drools.compiler.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:955)
 at

 org.drools.compiler.compiler.PackageBuilder.addPackage(PackageBuilder.java:943)
 at

 org.drools.compiler.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:507)
 at

 org.drools.compiler.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:714)
 at

 org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
 at

 org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Jetty-NoSuchMethodError-Lorg-eclipse-jdt-core-compiler-CategorizedProblem-tp4026946.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] How to use type-safe enums in rule condition

2013-11-13 Thread Steven Williams
We use drools for validation rules in our application. Some of these rules
are dependent on which CRUD operation is being performed at the time, so as
part of our validation aspect we insert a CrudMode enum with the current
action (by annotating the advised method). e.g.

@Validate(validators = BusinessRulesValidator.class, mode = CREATE)
public void create(@DTO SomeDTO incomingDto)

In our rules we can then go:

CrudMode(this == CrudMode.CREATE)

The second way we use it (and this one I don't like so much) is that our
validation aspect runs both before and after a method (PRE and POST). We
use an agenda-group to to indicate which phase a rule should be included
which works fine, however we were finding that some conditions were
relatively expensive which had performance implications. Our solution was
to also include a ValidationPhase enum as a fact and use that to
short-circuit the rules. I reckon there is probably a better way to achieve
this however we didn't spend a lot of time thinking about it.

cheers
Steve

---
Steven Williams



On Thu, Nov 14, 2013 at 12:40 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote:

 Just curiosity.

 On 13/11/2013, Steven Williams stevearoo...@gmail.com wrote:
  I use something like the following in rules to good effect:
 
  Country( this == Country.USA )

 Granted, you can add any number of attributes to an enum so that it's
 just another way of writing a static set of bean objects. But is there
 a good effect to be had from a pattern that merely ascertains the
 presence of an enum instance
 in the Working Memory?

 Other than this, a pattern like
City( country == Country.USA )
 doesn't require the insertion of the Country enums.

 Cheers
 Wolfgang
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] How to use type-safe enums in rule condition

2013-11-12 Thread Steven Williams
I use something like the following in rules to good effect:

Country( this == Country.USA )

---
Steven Williams



On Wed, Nov 13, 2013 at 12:20 AM, droolster quant.co...@gmail.com wrote:

 Thanks Steve for the advice and code! Awesome.



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-use-type-safe-enums-in-rule-condition-tp4026739p4026745.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Classloading error with AspectJ and Drools 5.2.0.Final

2011-09-07 Thread Steven Williams
FYI - https://issues.jboss.org/browse/JBRULES-3122 was raised for this.

cheers
Steve

2011/8/31 Wolfgang Laun wolfgang.l...@gmail.com

 This should be fixed by now on the way to 5.3.0, returning an empty
 collection -  I've seen a confirming email from Mark Proctor.
 -W


 On 30 August 2011 13:27, Sammi sammi_t...@yahoo.com.hk wrote:

 We got exactly the same issue, but I think it could just return empty
 enumeration rather than null?

 Cited from the javadoc *EnumberationURL getResources(String name)*
 /An enumeration of URL objects for the resource. If no resources could be
 found, the enumeration will be empty. Resources that the class loader
 doesn't have access to will not be in the enumeration./

 stevearoonie wrote:
 
  Clarification to this - it does also happen when we run our server. So
  this
  is preventing us from upgrading to 5.2
 
  My guess is that getResources should return getParent().getResources()
  rather than null.
 
  regards
  Steve
 
 


 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rules-users-Classloading-error-with-AspectJ-and-Drools-5-2-0-Final-tp3143394p3295236.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Classloading error with AspectJ and Drools 5.2.0.Final

2011-07-05 Thread Steven Williams
Hi,

I have just upgraded to Drools 5.2.0.Final and am getting a weird error when
running unit tests.

   java.lang.NullPointerException

at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.parseDefinitions(
ClassLoaderWeavingAdaptor.java:251)

at org.aspectj.weaver.loadtime.DefaultWeavingContext.getDefinitions(
DefaultWeavingContext.java:130)

at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(
ClassLoaderWeavingAdaptor.java:161)

at
org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(
Aj.java:271)

at
org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(
Aj.java:276)

at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:254)

at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:90)

at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(
ClassPreProcessorAgentAdapter.java:54)

at sun.instrument.TransformerManager.transform(TransformerManager.java:169)

at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365
)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(
JavaDialectRuntimeData.java:570)

at org.drools.util.CompositeClassLoader$CachingLoader.load(
CompositeClassLoader.java:258)

at org.drools.util.CompositeClassLoader$CachingLoader.load(
CompositeClassLoader.java:241)

at org.drools.util.CompositeClassLoader.loadClass(
CompositeClassLoader.java:88)

at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

at org.drools.rule.JavaDialectRuntimeData.wire(
JavaDialectRuntimeData.java:405)

at org.drools.rule.JavaDialectRuntimeData.wire(
JavaDialectRuntimeData.java:396)

at org.drools.rule.JavaDialectRuntimeData.onBeforeExecute(
JavaDialectRuntimeData.java:237)

at org.drools.rule.DialectRuntimeRegistry.onBeforeExecute(
DialectRuntimeRegistry.java:132)

at org.drools.compiler.PackageBuilder.reloadAll(PackageBuilder.java:796)

at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:751)

at org.drools.compiler.PackageBuilder.addPackageFromDrl(
PackageBuilder.java:360)

at org.drools.compiler.PackageBuilder.addKnowledgeResource(
PackageBuilder.java:538)

at org.drools.builder.impl.KnowledgeBuilderImpl.add(
KnowledgeBuilderImpl.java:28)

at au.com.promedicus.rules.KnowledgeBaseBuilder.addPackagesFromList(
KnowledgeBaseBuilder.java:108)

at au.com.promedicus.rules.KnowledgeBaseBuilder.build(
KnowledgeBaseBuilder.java:69)

at au.com.promedicus.rules.KnowledgeBaseBuilder.build(
KnowledgeBaseBuilder.java:54)


I have traced the problem to org.drools.rule.
JavaDialectRuntimeData$PackageClassLoader.getResources. This returns null
whereas AspectJ expects it to at least return an empty enumeration - hence
the NPE. Interestingly the problem does not occur when running our server,
however we can't upgrade unless our unit tests pass and we can't easily turn
off aspectj for these.

regards
Steve
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Classloading error with AspectJ and Drools 5.2.0.Final

2011-07-05 Thread Steven Williams
Clarification to this - it does also happen when we run our server. So this
is preventing us from upgrading to 5.2

My guess is that getResources should return getParent().getResources()
rather than null.

regards
Steve

On Wed, Jul 6, 2011 at 1:42 PM, Steven Williams stevearoo...@gmail.comwrote:

 Hi,

 I have just upgraded to Drools 5.2.0.Final and am getting a weird error
 when running unit tests.

 java.lang.NullPointerException

 at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.parseDefinitions(
 ClassLoaderWeavingAdaptor.java:251)

 at org.aspectj.weaver.loadtime.DefaultWeavingContext.getDefinitions(
 DefaultWeavingContext.java:130)

 at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(
 ClassLoaderWeavingAdaptor.java:161)

 at
 org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(
 Aj.java:271)

 at
 org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(
 Aj.java:276)

 at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:254)

 at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:90)

 at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(
 ClassPreProcessorAgentAdapter.java:54)

 at sun.instrument.TransformerManager.transform(TransformerManager.java:169
 )

 at sun.instrument.InstrumentationImpl.transform(
 InstrumentationImpl.java:365)

 at java.lang.ClassLoader.defineClass1(Native Method)

 at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

 at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

 at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(
 JavaDialectRuntimeData.java:570)

 at org.drools.util.CompositeClassLoader$CachingLoader.load(
 CompositeClassLoader.java:258)

 at org.drools.util.CompositeClassLoader$CachingLoader.load(
 CompositeClassLoader.java:241)

 at org.drools.util.CompositeClassLoader.loadClass(
 CompositeClassLoader.java:88)

 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

 at org.drools.rule.JavaDialectRuntimeData.wire(
 JavaDialectRuntimeData.java:405)

 at org.drools.rule.JavaDialectRuntimeData.wire(
 JavaDialectRuntimeData.java:396)

 at org.drools.rule.JavaDialectRuntimeData.onBeforeExecute(
 JavaDialectRuntimeData.java:237)

 at org.drools.rule.DialectRuntimeRegistry.onBeforeExecute(
 DialectRuntimeRegistry.java:132)

 at org.drools.compiler.PackageBuilder.reloadAll(PackageBuilder.java:796)

 at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:751)

 at org.drools.compiler.PackageBuilder.addPackageFromDrl(
 PackageBuilder.java:360)

 at org.drools.compiler.PackageBuilder.addKnowledgeResource(
 PackageBuilder.java:538)

 at org.drools.builder.impl.KnowledgeBuilderImpl.add(
 KnowledgeBuilderImpl.java:28)

 at au.com.promedicus.rules.KnowledgeBaseBuilder.addPackagesFromList(
 KnowledgeBaseBuilder.java:108)

 at au.com.promedicus.rules.KnowledgeBaseBuilder.build(
 KnowledgeBaseBuilder.java:69)

 at au.com.promedicus.rules.KnowledgeBaseBuilder.build(
 KnowledgeBaseBuilder.java:54)


 I have traced the problem to org.drools.rule.
 JavaDialectRuntimeData$PackageClassLoader.getResources. This returns null
 whereas AspectJ expects it to at least return an empty enumeration - hence
 the NPE. Interestingly the problem does not occur when running our server,
 however we can't upgrade unless our unit tests pass and we can't easily turn
 off aspectj for these.

 regards
 Steve

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Error opening dslr in Eclipse on Mac

2011-04-30 Thread Steven Williams
Java 1.6, Drools 5.1.1


On Fri, Apr 29, 2011 at 7:46 PM, Benson Fung benson.red...@gmail.comwrote:

 What version of jdk and Drools plugin are you using?

 2011/4/29 Steven Williams stevearoo...@gmail.com:
  Hi,
  I am running Eclipse Helios on Mac OS X 10.6.7 with the Drools 5.1.1
 plugin
  and cannot open DSLR files with the error below. This error also occurs
 if I
  create a new Drools project, create a new rule resource and select the
 Use a
  DSL checkbox. DRL files open fine.
  Could not open the editor: 1
  java.lang.ArrayIndexOutOfBoundsException: 1
  at
 
 org.eclipse.swt.custom.StyledTextRenderer.calculateClientArea(StyledTextRenderer.java:230)
  at org.eclipse.swt.custom.StyledText.handleResize(StyledText.java:6169)
  at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5662)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3783)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1398)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1379)
  at org.eclipse.swt.widgets.Control.resized(Control.java:2944)
  at org.eclipse.swt.widgets.Composite.resized(Composite.java:929)
  at org.eclipse.swt.widgets.Control.setFrameSize(Control.java:3428)
  at org.eclipse.swt.widgets.Display.windowProc(Display.java:4975)
  at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
  at org.eclipse.swt.internal.cocoa.NSView.setFrameSize(NSView.java:259)
  at org.eclipse.swt.widgets.Control.setBounds(Control.java:3171)
  at org.eclipse.swt.widgets.Control.setSize(Control.java:3668)
  at
 
 org.eclipse.jface.text.source.SourceViewer$RulerLayout.getVerticalScrollArrowHeights(SourceViewer.java:200)
  at
 
 org.eclipse.jface.text.source.SourceViewer$RulerLayout.layout(SourceViewer.java:157)
  at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1183)
  at org.eclipse.swt.widgets.Composite.layout(Composite.java:703)
  at org.eclipse.swt.widgets.Composite.layout(Composite.java:661)
  at
 
 org.eclipse.jface.text.source.CompositeRuler.layoutTextViewer(CompositeRuler.java:611)
  at
 
 org.eclipse.jface.text.source.CompositeRuler.addDecorator(CompositeRuler.java:565)
  at
 
 org.eclipse.jface.text.source.projection.ProjectionViewer.addVerticalRulerColumn(ProjectionViewer.java:1289)
  at
 
 org.eclipse.jface.text.source.projection.ProjectionSupport.doEnableProjection(ProjectionSupport.java:310)
  at
 
 org.eclipse.jface.text.source.projection.ProjectionSupport$ProjectionListener.projectionEnabled(ProjectionSupport.java:143)
  at
 
 org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled(ProjectionViewer.java:489)
  at
 
 org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection(ProjectionViewer.java:537)
  at
 
 org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1441)
  at
 org.drools.eclipse.editors.AbstractRuleEditor.createPartControl(Unknown
  Source)
  at
 
 org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:241)
  at org.eclipse.ui.forms.editor.FormEditor.addPage(FormEditor.java:325)
  at
 
 org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:211)
  at org.eclipse.ui.forms.editor.FormEditor.addPage(FormEditor.java:308)
  at org.drools.eclipse.dsl.editor.DSLRuleEditor2.addPages(Unknown Source)
  at
 org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:138)
  at
 
 org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
  at
 
 org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
  at
 
 org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
  at
 
 org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
  at
 
 org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
  at
 
 org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2863)
  at
 
 org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768)
  at
 org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760)
  at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711)
  at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
  at
 org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707)
  at
 org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691)
  at
 org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2682)
  at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
  at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
  at org.drools.eclipse.wizard.rule.NewRulePackagePage.finish(Unknown
 Source)
  at
 org.drools.eclipse.wizard.rule.NewRulePackageWizard.performFinish(Unknown
  Source)
  at
 
 org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811

[rules-users] Error opening dslr in Eclipse on Mac

2011-04-29 Thread Steven Williams
Hi,

I am running Eclipse Helios on Mac OS X 10.6.7 with the Drools 5.1.1 plugin
and cannot open DSLR files with the error below. This error also occurs if I
create a new Drools project, create a new rule resource and select the Use a
DSL checkbox. DRL files open fine.

Could not open the editor: 1

java.lang.ArrayIndexOutOfBoundsException: 1
at
org.eclipse.swt.custom.StyledTextRenderer.calculateClientArea(StyledTextRenderer.java:230)
at org.eclipse.swt.custom.StyledText.handleResize(StyledText.java:6169)
at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5662)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3783)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1398)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1379)
at org.eclipse.swt.widgets.Control.resized(Control.java:2944)
at org.eclipse.swt.widgets.Composite.resized(Composite.java:929)
at org.eclipse.swt.widgets.Control.setFrameSize(Control.java:3428)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4975)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSView.setFrameSize(NSView.java:259)
at org.eclipse.swt.widgets.Control.setBounds(Control.java:3171)
at org.eclipse.swt.widgets.Control.setSize(Control.java:3668)
at
org.eclipse.jface.text.source.SourceViewer$RulerLayout.getVerticalScrollArrowHeights(SourceViewer.java:200)
at
org.eclipse.jface.text.source.SourceViewer$RulerLayout.layout(SourceViewer.java:157)
at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1183)
at org.eclipse.swt.widgets.Composite.layout(Composite.java:703)
at org.eclipse.swt.widgets.Composite.layout(Composite.java:661)
at
org.eclipse.jface.text.source.CompositeRuler.layoutTextViewer(CompositeRuler.java:611)
at
org.eclipse.jface.text.source.CompositeRuler.addDecorator(CompositeRuler.java:565)
at
org.eclipse.jface.text.source.projection.ProjectionViewer.addVerticalRulerColumn(ProjectionViewer.java:1289)
at
org.eclipse.jface.text.source.projection.ProjectionSupport.doEnableProjection(ProjectionSupport.java:310)
at
org.eclipse.jface.text.source.projection.ProjectionSupport$ProjectionListener.projectionEnabled(ProjectionSupport.java:143)
at
org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled(ProjectionViewer.java:489)
at
org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection(ProjectionViewer.java:537)
at
org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1441)
at org.drools.eclipse.editors.AbstractRuleEditor.createPartControl(Unknown
Source)
at
org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:241)
at org.eclipse.ui.forms.editor.FormEditor.addPage(FormEditor.java:325)
at
org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:211)
at org.eclipse.ui.forms.editor.FormEditor.addPage(FormEditor.java:308)
at org.drools.eclipse.dsl.editor.DSLRuleEditor2.addPages(Unknown Source)
at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:138)
at
org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at
org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:289)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2863)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2768)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2760)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2711)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2707)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2691)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2682)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
at org.drools.eclipse.wizard.rule.NewRulePackagePage.finish(Unknown Source)
at org.drools.eclipse.wizard.rule.NewRulePackageWizard.performFinish(Unknown
Source)
at
org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
at
org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3783)
at 

Re: [rules-users] execute particular rules programmatically and dynamically

2011-03-31 Thread Steven Williams
I have actually used this method for the one valid case I have thought of -
unit testing rules.

Steve


2011/4/1 Swindells, Thomas tswinde...@nds.com

  Agreed,

 But if you really do want to you can setup an agenda filter so that only
 the activation for the rule you care about is fired – but I don’t think
 there are many valid cases where this is needed/desirable/appropriate.



 Thomas



 *From:* rules-users-boun...@lists.jboss.org [mailto:
 rules-users-boun...@lists.jboss.org] *On Behalf Of *Michael Anstis
 *Sent:* 31 March 2011 10:08
 *To:* Rules Users List
 *Subject:* Re: [rules-users] execute particular rules programmatically and
 dynamically



 Why would you want to execute a single rule?

 The logic you'd write to determine which rule to fire should itself be part
 of the rules: So, for example, if you want to validate facts of type Smurf
 then write a rule that matches on Smurf. When you insert a Smurf only
 the rules that match on this will become candidates for execution when you
 call fireAllRules. Perhaps use of a stateless session would simplify things
 so you need not worry about other facts in WM polluting the results you
 expect to see?

 More and more questions are posted here asking how to make individual rules
 execute; IMO the solution is to change your thinking about how Rules Engines
 work.

 If you give your use-case we might be able to advise a better approach.

 With kind regards,

 Mike

 2011/3/31 Wolfgang Laun wolfgang.l...@gmail.com



 On 31 March 2011 07:58, Benson Fung benson.red...@gmail.com wrote:

 Hi,

 If there are 10 rules in the drools rulebase, and right now I would
 like to execute one of the particular rule.  Is there any approach/way
 to execute particular rule programmatically?


 No. The right hand side of a rule (code between then and end) is
 executed whenever there is a set of fact objects in Working Memory
 satisfying the condition. If you insert such a set of facts and call
 fireAllRules(), then it will happen.



  I don't think
 agenda-group or activation-group can do that, right?  Or is it
 possible to create an agenda programmatically ?


 No to both.
 -W



 Thanks
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



 --


 **
 This message is confidential and intended only for the addressee. If you
 have received this message in error, please immediately notify the
 postmas...@nds.com and delete it from your system as well as any copies.
 The content of e-mails as well as traffic data may be monitored by NDS for
 employment and security purposes. To protect the environment please do not
 print this e-mail unless necessary.

 NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
 4EX, United Kingdom. A company registered in England and Wales. Registered
 no. 3080780. VAT no. GB 603 8808 40-00

 **

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Configure custom SystemEventListener via Drools Spring

2011-03-23 Thread Steven Williams
Hi,

I have just started using the drools-spring integration (5.1.1) and I would
to use my own SystemEventListener instead of the default
PrintStreamSystemEventListener however I am not sure if it is possible or
how to configure it.

thanks
Steve
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] KnowledgeAgent Issue

2011-03-21 Thread Steven Williams
Hi all,

I am trying to use a Knowledge Agent in 5.1.1 with a change set with a few
different packages and resource types in it, and I am running into a problem
where it is not adding all the packages. Looking at the code I can see that
KnowledegeAgentImpl.createPackageFromResource has the following code when it
loads a resource:

if (kbuilder.getKnowledgePackages().iterator().hasNext()) {

return (KnowledgePackageImp)
kbuilder.getKnowledgePackages().iterator().next();

}


and KnowledgeBuilderImpl.getKnowledgePackages does the following:


Package[] pkgs = pkgBuilder.getPackages();

ListKnowledgePackage list = new ArrayListKnowledgePackage( pkgs.length
);


and PackageBuilder.getPackages does the following:


for ( PackageRegistry pkgRegistry : this.pkgRegistryMap.values() ) {

Package pkg = pkgRegistry.getPackage();

// add package to array

}


pkgRegistryMap is implemented as a HashMap however so the order the packages
are returned in is not guaranteed. I seem to be hitting this problem.

This is a hard one to create a unit test for so I wanted to check that my
analysis is correct before raising a bug. Perhaps using a LinkedHashMap or
similar would fix it?

thanks
Steve
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] KnowledgeAgent Issue

2011-03-21 Thread Steven Williams
I'm not sure whether they were added or not. I noticed the rules weren't
running when I expected them to though, so perhaps not. I have worked around
it by putting all my rules in the same package - luckily I only had about 30
different rule files, but it is a less than ideal solution.

Once I have everything working and checked in on my project I'll test
further to see what is going on.

Steve

On Tue, Mar 22, 2011 at 2:43 PM, Esteban Aliverti 
esteban.alive...@gmail.com wrote:

 Someone mentioned me the problem some time ago. I have a fix for it in my
 local repo, butI was waiting for the trunk to be stable to test it.
 The problem is that under certain circumstances, the kagent is reusing the
 same kbuilder to compile all the resources present in a change-set (the
 modifications I have force the agent to use a new kbuilder for each
 resource).
 The only difference between what you are reporting and the problem I'm
 talking about is that in my case all the rules, functions, etc were added to
 the kbase, but all within the same package. No matter the real package
 definition. Is this your case also?

 Please file a bug report and let me know.

 Best Regards,

 

 Esteban Aliverti
 - Developer @ http://www.plugtree.com
 - Blog @ http://ilesteban.wordpress.com


 2011/3/21 Steven Williams stevearoo...@gmail.com

 Hi all,

 I am trying to use a Knowledge Agent in 5.1.1 with a change set with a few
 different packages and resource types in it, and I am running into a problem
 where it is not adding all the packages. Looking at the code I can see that
 KnowledegeAgentImpl.createPackageFromResource has the following code when it
 loads a resource:

 if (kbuilder.getKnowledgePackages().iterator().hasNext()) {

 return (KnowledgePackageImp)
 kbuilder.getKnowledgePackages().iterator().next();

 }


 and KnowledgeBuilderImpl.getKnowledgePackages does the following:


 Package[] pkgs = pkgBuilder.getPackages();

 ListKnowledgePackage list = new ArrayListKnowledgePackage(
 pkgs.length );


 and PackageBuilder.getPackages does the following:


 for ( PackageRegistry pkgRegistry : this.pkgRegistryMap.values()
 ) {

 Package pkg = pkgRegistry.getPackage();

 // add package to array

 }


 pkgRegistryMap is implemented as a HashMap however so the order the
 packages are returned in is not guaranteed. I seem to be hitting this
 problem.

 This is a hard one to create a unit test for so I wanted to check that my
 analysis is correct before raising a bug. Perhaps using a LinkedHashMap or
 similar would fix it?

 thanks
 Steve

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Inserting collection of facts in rule Consequence

2009-02-15 Thread Steven Williams
I normally do something like

when
$creditContract : CreditContract()
$o : Applicant() from $creditContract.coApplicantArray
then
insert($o);
end

retract would be something like

when
$o : Applicant( )
CreditContract( coApplicantArray contains $o )
then
retract($o);
end

cheers
Steve



On Tue, Feb 10, 2009 at 6:36 AM, k...@chryslerfinancial.com wrote:


 There may be a better way but I did it using a function as below:

 *function* *void* insertArray(WorkingMemory workingMemory, Object[] array)
 {
 *for* (*int* i=0;iarray.length;i++)
 {
 workingMemory.*insert*(array[i]);
 }
 *return*;
 }

 ...

 *rule* StarCoApplicants *ruleflow-group* STAR
 *dialect* mvel
 *when*
 $creditContract : CreditContract ()
 *then*

 insertArray(drools.workingMemory,$creditContract.coApplicantArray);

 *end*


 Kent Symanzik



  *techy techluver...@gmail.com*
 Sent by: rules-users-boun...@lists.jboss.org

 02/09/2009 10:15 AM
  Please respond to
 Rules Users List rules-users@lists.jboss.org

   To
 rules-users@lists.jboss.org
  cc
   Subject
 Re: [rules-users] Inserting collection of facts in rule Consequence





 I would appreciate If someone can clarify this.

 Thanks in advance


 techy wrote:
 
  Hello,
 
  Is there way to insert all facts from collection (similar to
  session.execute(collection)) in the rule consequence ?
 
  Thanks!
 

 --
 View this message in context:
 http://www.nabble.com/Inserting-collection-of-facts-in-rule-Consequence-tp21814308p21914860.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 http://www.nabble.com/Inserting-collection-of-facts-in-rule-Consequence-tp21814308p21914860.html
 https://lists.jboss.org/mailman/listinfo/rules-users
https://lists.jboss.org/mailman/listinfo/rules-users

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Eclipse guvnor plugin issue

2009-02-05 Thread Steven Williams
Hi all,

I am using the snapshot version of the eclipse plugin from Feb 5. When I
attempt to drag a file from the repository explorer into the Navigator view
I get the following exception:

java.lang.Exception: Could not create directory C:\Documents and
Settings\Administrator\workspace\.metadata\.plugins\org.guvnor.tools\623d8213:11f48a3ddff:-7fff
at org.guvnor.tools.views.RepositoryView.prepareFileTransfer(Unknown
Source)
at org.guvnor.tools.views.RepositoryView.access$1(Unknown Source)
at org.guvnor.tools.views.RepositoryView$2.dragSetData(Unknown Source)
at org.eclipse.swt.dnd.DNDListener.handleEvent(DNDListener.java:54)
...

I am using Windows and can drag the file from a mapped webdav directory on
my computer. I think the problem is that the filename contains the invalid
character :

Should I raise a bug?

thanks
Steve
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RuleFlow question

2009-01-28 Thread Steven Williams
Hi guys,

I am playing with the OrderExample in drools-examples and was wondering how
I get access in my rules to the parameters that are sent to startProcess?
e.g.

MapString, Object parameters = new HashMapString, Object();
parameters.put(order, order);
parameters.put(orderId, order.getOrderId());
parameters.put(email, emailTextField.getText());
ProcessInstance processInstance =
ksession.startProcess(org.drools.examples.process.ruleset.RuleSetExample,
parameters);

I have access to the ProcessInstance but there doesn't seem to be any clear
path to the parameters.

thanks
Steve
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] guvnor - cannot delete business rule assets

2009-01-20 Thread Steven Williams
Hi Kent,

I think if you archive your rule (with the archive button) you can then go
into the archive area of Administration and delete them.

cheers
Steve

On Wed, Jan 21, 2009 at 7:09 AM, k...@chryslerfinancial.com wrote:


 *Drools 5.0.0.M4 Guvnor Standalone*

 There does not appear to be an option for deleting business rule assets.
  The delete button does show up for technical assets.

 Is it based on some context that I am not aware of?

 Thanks

 Kent
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.willi...@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] KnowledgeBuilderConfiguration

2009-01-20 Thread Steven Williams
Hi guys,

It's no biggy but I was wondering whether KnowledgeBuilderConfiguration will
get an addAccumulateFunction method, similar to PackageBuilderConfiguration?
In our project we use Spring to configure Drools, which means we have a
MapString, Class available for accumulate functions, so we could
previously do:

config.addAccumulateFunction(entry.getKey(), entry.getValue());

Now with KnowledgeBuilderConfiguration we had to change the Map to
MapString, String and do the following:

config.setProperty(drools.accumulate.function. + entry.getKey(),
entry.getValue());

which seems like a retrograde step.

-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.willi...@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools 5 Accumulate Function

2009-01-18 Thread Steven Williams
Hi all,

I am converting over to Drools 5 and have run into a problem with
AccumulateFunction. I changed my classes to implement
org.drools.runtime.rule.AccumulateFunction however this causes the
ClassCastException below:

Caused by: java.lang.ClassCastException:
au.com.promedicus.rules.MaxPriceAccumulateFunction cannot be cast to
org.drools.base.accumulators.AccumulateFunction
at
org.drools.compiler.PackageBuilderConfiguration.getAccumulateFunction(PackageBuilderConfiguration.java:489)
at
org.drools.rule.builder.dialect.java.JavaAccumulateBuilder.build(JavaAccumulateBuilder.java:108)
...

My guess is this is a bug. For now I will just go back to implementing
org.drools.base.accumulators.AccumulateFunction.

cheers
Steve

-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.willi...@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to access data after rule fires

2009-01-12 Thread Steven Williams
If you put an X or something in the cell (i.e. just don't leave it empty) it
should also work.

On Tue, Jan 13, 2009 at 10:57 AM, Edson Tirelli tire...@post.com wrote:


  The action is not being executed. I don't use decision tables
 frequently, but I think that it ignores empty cells and is generating an
 empty consequence for your rule. Usually, you would place the method call on
 the header prototype and the parameter in the cell. So your cell would be:

 | hoover | true |
 | xyz | false |

  The method prototype would be something like (please check the correct
 syntax in the manual):

 brand.setGoodBrand( $param );

  Where the engine would replace $param by the value you write in the
 cell.


  []s
  Edson

 2009/1/12 Costello, Robert rcos...@searshc.com

  I tried that and it returned false, which doesn't make sense to me since
 the rule firing is to set the value to true, and in the execution the rule
 does fire.



 StatefulKnowledgeSession session =
 kbase.newStatefulKnowledgeSession();

 Product p = *new* Product();

 p.setBrand(hoover);

 session.insert( p );

 *int* u = session.fireAllRules();



 System.*out*.println(u +  many rules fired);

 System.*out*.println(is brand good?  + p.isGoodBrand());



 Here's a snippet of the rule (decision table)





 * *

 CONDITION

 ACTION

 * *

 Product

 * *

 brand

 setGoodBrand(true);

 *Cases*

 hoover match case



 *Brand Check*

 hoover

 * *



 And the console returns:



 1 many rules fired

 is brand good? false







 Robert Costello

 Lead Systems Engineer

 IMA Performance

 E3- 279A

 847.286.0910





 -Original Message-
 *From:* rules-users-boun...@lists.jboss.org [mailto:
 rules-users-boun...@lists.jboss.org] *On Behalf Of *Edson Tirelli
 *Sent:* Monday, January 12, 2009 4:16 PM
 *To:* Rules Users List
 *Subject:* Re: [rules-users] How to access data after rule fires




Can't you keep the reference to your object while firing the rules?

 MyObject x = ...
 ksession.insert( x );
 ksession.fireAllRules();
 boolean result = x.getBooleanAttribute();

 []s
 Edson

 2009/1/12 Costello, Robert rcos...@searshc.com

 So, how do I access data after the rules fire?

 If one has a rule which modifies a field on an object (a boolean, for
 example), and you want to return the object after the rules are
 complete, how do you do it?

 I tried this using a StatefulKnowledgeSession, getting an object
 collection after the rules fire, but I don't see that this works.

 Also googled the heck out of this and looked in all the documentation.
 I must be missing something, because the docs generally are pretty good.


 Any hints?

 Thanks in advance,

 Robert Costello


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




 --
  Edson Tirelli
  JBoss Drools Core Development
  JBoss, a division of Red Hat @ www.jboss.com

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




 --
  Edson Tirelli
  JBoss Drools Core Development
  JBoss, a division of Red Hat @ www.jboss.com

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.willi...@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: Drools nightly snapshot

2009-01-08 Thread Steven Williams
Never mind. (I hate it when you post a question and then immediately find
the answer!)

For anybody else the correct dependency format is:

dependency
groupIdorg.drools/groupId
artifactIddrools-core/artifactId
version5.0.0.SNAPSHOT/version
/dependency

NOT

dependency
groupIdorg.drools/groupId
artifactIddrools-core/artifactId
version5.0.0-SNAPSHOT/version
/dependency


On Fri, Jan 9, 2009 at 2:01 PM, Steven Williams stevearoo...@gmail.comwrote:

 Hi all,

 I was wondering if anyone knows how to get the nightly snapshot for Drools
 5 via maven?

 I am using the http://snapshots.jboss.org/maven2 repository but the
 snapshot jars have different names to what I was expecting (e.g.
 drools-core-5.0.0.20081110.114826-277.jar as opposed to
 drools-core-5.0.0-SNAPSHOT.jar). Can anyone tell me what settings I should
 use in my pom to get the latest version?

 thanks
 Steve

 --
 Steven Williams

 Supervising Consultant

 Object Consulting
 Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
 steven.willi...@objectconsulting.com.au
 www.objectconsulting.com.au

 consulting | development | training | support
 our experience makes the difference




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.willi...@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools 5 migration

2009-01-08 Thread Steven Williams
Hi guys,

I have migrated my code over to Drools 5 and now regular expressions have to
be escaped. e.g. where previously I had

name matches ^\s*$

instead I have to put

name matches ^\\s*$

Is this a bug or am I missing a setting or something? I am running against
the 5 snapshot.

thanks
Steve
-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.willi...@objectconsulting.com.au
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools query

2008-12-10 Thread Steven Williams
Have a look here http://www.jboss.org/community/docs/DOC-11909 (this is to
find the max so just reverse it)

cheers
Steve

On Thu, Dec 11, 2008 at 9:48 AM, tati-2 [EMAIL PROTECTED] wrote:


 How to extract min age of many objects of the same type People , which we
 inserted in the workspace ?

 Thank you very much in advance for help.
 --
 View this message in context:
 http://www.nabble.com/drools-query-tp20945811p20945811.html
 Sent from the drools - user mailing list archive at Nabble.com.


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools query

2008-12-10 Thread Steven Williams
Yeah - that discussion was before drools had the accumulate function.

On Thu, Dec 11, 2008 at 10:16 AM, Greg Barton [EMAIL PROTECTED] wrote:

 That approach looks a bit cartesian joiny.  I'd be interested in seeing how
 it compares to using accumulate.

 --- On Wed, 12/10/08, Steven Williams [EMAIL PROTECTED] wrote:

  From: Steven Williams [EMAIL PROTECTED]
  Subject: Re: [rules-users] drools query
  To: Rules Users List rules-users@lists.jboss.org
  Date: Wednesday, December 10, 2008, 4:59 PM
  Have a look here
  http://www.jboss.org/community/docs/DOC-11909 (this is to
  find the max so just reverse it)
 
  cheers
  Steve
 
  On Thu, Dec 11, 2008 at 9:48 AM, tati-2
  [EMAIL PROTECTED] wrote:
 
  
   How to extract min age of many objects of the same
  type People , which we
   inserted in the workspace ?
  
   Thank you very much in advance for help.
   --
   View this message in context:
  
  http://www.nabble.com/drools-query-tp20945811p20945811.html
   Sent from the drools - user mailing list archive at
  Nabble.com.
  
  
   ___
   rules-users mailing list
   rules-users@lists.jboss.org
   https://lists.jboss.org/mailman/listinfo/rules-users
  
 
 
 
  --
  Steven Williams
 
  Supervising Consultant
 
  Object Consulting
  Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
  [EMAIL PROTECTED]
  www.objectconsulting.com.au
 
  consulting | development | training | support
  our experience makes the difference
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] having counter in drl

2008-12-08 Thread Steven Williams
Globals should only be used for data that is constant over the life of the
working memory, which is not so in your case.

Maybe you should just use a fact counter. If you don't want to affect your
code you could insert it in a separate rule.

when
then


On Tue, Dec 9, 2008 at 9:05 AM, techy [EMAIL PROTECTED] wrote:


 Hello,
 I would like to take 100 sampling facts for rule and persist it in the db
 and ignore other data.
 How Can I maintain the counter? as global variable? Please clarify with
 sample code.
 I tried following way and but it does not work as expected.

 Ex:
 global Integer counter;
 rule get sampling data
   when fact : Foo(some condition)  eval(counter = 100)
   then
counter++
   // do some condition
 end
 --
 View this message in context:
 http://www.nabble.com/having-counter-in-drl-tp20904469p20904469.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] having counter in drl

2008-12-08 Thread Steven Williams
Sorry - I accidentally hit send.

Something like:

when
then
   insert(new Integer(0));
end
when
  $i: Integer(value  100)
  Foo(some condition)
then
  retract($i);
  insert(new Integer($i.intValue() + 1));
  ...
end

On Tue, Dec 9, 2008 at 10:54 AM, Steven Williams [EMAIL PROTECTED]wrote:

 Globals should only be used for data that is constant over the life of the
 working memory, which is not so in your case.

 Maybe you should just use a fact counter. If you don't want to affect your
 code you could insert it in a separate rule.

 when
 then



 On Tue, Dec 9, 2008 at 9:05 AM, techy [EMAIL PROTECTED] wrote:


 Hello,
 I would like to take 100 sampling facts for rule and persist it in the db
 and ignore other data.
 How Can I maintain the counter? as global variable? Please clarify with
 sample code.
 I tried following way and but it does not work as expected.

 Ex:
 global Integer counter;
 rule get sampling data
   when fact : Foo(some condition)  eval(counter = 100)
   then
counter++
   // do some condition
 end
 --
 View this message in context:
 http://www.nabble.com/having-counter-in-drl-tp20904469p20904469.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




 --
 Steven Williams

 Supervising Consultant

 Object Consulting
 Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
 [EMAIL PROTECTED]
 www.objectconsulting.com.au

 consulting | development | training | support
 our experience makes the difference




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] how to find the rule name

2008-07-02 Thread Steven Williams
try
String ruleName = ...

On Thu, Jul 3, 2008 at 7:09 AM, Marina [EMAIL PROTECTED] wrote:

 Hello,

 I need to know the rule name of the rule that fired in the consequence part
 of the rule. I tried something like the following, just trying to see if I
 can get it this way:

 package mode.simple;
 import java.lang.String;
 import java.util.List;
 import com.emptoris.ecm.domain.ContractRulesData;

 global java.util.Set approverList;

 rule testOR_1
dialect java
when
$data : ContractRulesData (sum  500 || name matches .*important)
then
approverList.add(approver3, approver4, Level5);
ruleName = drools.getRule().getName();
System.out.println(ruleName +  is TRUE);

 end

 When I'm trying to compile the rule, I'm getting the following error:
 Builder errors:
 Rule Compilation error : [Rule name=testOR_1, agendaGroup=MAIN, salience=0,
 no-loop=false]
mode/simple/Rule_testOR_1_0.java (8:391) : ruleName cannot be resolved
mode/simple/Rule_testOR_1_0.java (9:452) : ruleName cannot be resolved
 java.lang.RuntimeException: Unable to compile rules file: testOR_1.drl

 I must be doing something wrong here... ?

 thanks!
 Marina
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] No accumulator function found for identifier

2008-05-20 Thread Steven Williams
Hi Jarek,

I have had a similar problem. For the moment I have put the
drools.packagebuilder.conf file in my home directory (e.g. c:\documents and
settings\username on windows). Whilst not ideal it works.

cheers
Steve

On Tue, May 20, 2008 at 10:36 PM, Jaroslaw Kijanowski 
[EMAIL PROTECTED] wrote:

 Hi,
  when I create my own accumulate function, I add it to
 src/main/java/META-INF/drools.packagebuilder.conf and it works fine.

 However, eclipse is showing one error:
 No accumulator function found for identifier: ...

 I've found this
 http://lists.jboss.org/pipermail/rules-users/2007-December/004349.html
 and tried to move META-INF to the root dir, but then my app doesn't work
 (and eclipse shows the same error).

 Any thoughts?

 Thanks,
  Jarek
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] BRMS Security in Websphere 6.1

2008-05-14 Thread Steven Williams
)
at
 com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(Applica
 tionMgrImpl.java:948)
at
 com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(Appli
 cationMgrImpl.java:2114)
at
 com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(W
 sComponentImpl.java:340)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
 Caused by: java.security.AccessControlException: Access denied
 (java.lang.reflect.ReflectPermission suppressAccessChecks)
at
 java.security.AccessController.checkPermission(AccessController.java:104
 )
at
 java.lang.SecurityManager.checkPermission(SecurityManager.java:547)
at
 com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager
 .java:189)
at
 java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:1
 19)
at org.jboss.seam.Component.scanMethod(Component.java:797)
at org.jboss.seam.Component.initMembers(Component.java:548)
at org.jboss.seam.Component.init(Component.java:254)
at org.jboss.seam.Component.init(Component.java:217)
at
 org.jboss.seam.init.Initialization.addComponent(Initialization.java:949)
... 19 more


 This email and/or any files or attachments transmitted with it are
 confidential and intended solely for the use of the individual or entity to
 whom they are addressed, and may contain information that is privileged,
 confidential and exempt from disclosure under applicable law. If you are not
 the intended recipient, or the employee or agent responsible for delivering
 the message to the intended recipient, you are hereby notified that any
 dissemination, distribution or copying of this e-mail and/or any files or
 attachments transmitted with it is strictly forbidden. If you have received
 this email in error, please delete the e-mail and/or any files or
 attachments, and also notify the system manager (
 [EMAIL PROTECTED]) of the error. Please note that any views
 or opinions presented in this email are solely those of the author and do
 not necessarily represent those of the company. Finally, the recipient
 should check this email and any attachments for the presence of !
  viruses. The company accepts no liability for any damage caused by any
 virus transmitted by this email and/or any files or attachments transmitted
 with it.



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Collection Emptyness

2008-04-23 Thread Steven Williams
use sousVenues.empty == true

On Wed, Apr 23, 2008 at 5:32 PM, vdelbart [EMAIL PROTECTED] wrote:


 Hi,

 I have an object 'VenueGlobal' with a property 'sousVenues' who is a List
 of
 SousVenue. I try to test the emptyness of this list in on sentence but i
 don't know why it doesn't work :

 I try this :

 VenueGlobal( sousVenues == null || sousVenues.empty )

 but I have this error :

 org.drools.rule.InvalidRulePackage: [11,53]: unknown:11:53 Unexpected
 token
 ')'
at org.drools.rule.Package.checkValidity(Package.java:424)

 I try this :

 VenueGlobal( sousVenues == null || sousVenues.size == 0 )

 but I have this error :

 Caused by: org.mvel.PropertyAccessException: unable to resolve property:
 size
at

 org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:382)


 I don't know what the solution ?


 regards,

 V.


 --
 View this message in context:
 http://www.nabble.com/Collection---Emptyness-tp16833060p16833060.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: Is this scenario suitable for using Drools?

2008-04-23 Thread Steven Williams
change DBUtils to return a Collection and it should work I think.

On Wed, Apr 23, 2008 at 5:50 PM, Anstis, Michael (M.) [EMAIL PROTECTED]
wrote:

  So, in my usual helpful manner I thought Drools would be a perfect match
 and put together what I thought would be a simple example:-

 package com.sample

 global com.sample.DBUtils dbutils;
 rule a1
 when
 $max : Integer() from accumulate( Integer( $v : intValue ) from
 dbutils.getNumbers(), max($v) )
 then
 System.out.println($max);
 end


 public class DBUtils {

 public Integer[] getNumbers() {

 Integer[] numbers = new Integer[10];
 for (int i = 0; i  numbers.length; i++) {
 numbers[i] = (int) (Math.random() * 100);
 }
 return numbers;
 }
 }

 However this led to some errors:-

 org.drools.RuntimeDroolsException: java.lang.ClassCastException:
 [Ljava.lang.Integer; incompatible with java.lang.Integer
  at org.drools.rule.Accumulate.accumulate(Accumulate.java:131)
  at org.drools.reteoo.AccumulateNode.assertTuple(AccumulateNode.java:127)
  at
 org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)
  at
 org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
  at
 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
  at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
  at org.drools.reteoo.Rete.assertObject(Rete.java:177)
  at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
  at
 org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:179)
  at
 org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1292)
  at
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:891)
  at
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
  at
 org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:659)
  at com.sample.DroolsTest.main(DroolsTest.java:36)
 Caused by: java.lang.ClassCastException: [Ljava.lang.Integer; incompatible
 with java.lang.Integer
  at
 org.drools.base.java.lang.Integer968047027$intValue.getIntValue(Unknown
 Source)
  at
 org.drools.base.ClassFieldExtractor.getIntValue(ClassFieldExtractor.java:197)
  at org.drools.rule.Declaration.getIntValue(Declaration.java:230)
  at
 com.sample.Rule_a1_0AccumulateExpression0Invoker.evaluate(Rule_a1_0AccumulateExpression0Invoker.java:16)
  at
 org.drools.base.accumulators.JavaAccumulatorFunctionExecutor.accumulate(JavaAccumulatorFunctionExecutor.java:74)
  at org.drools.rule.Accumulate.accumulate(Accumulate.java:123)
  ... 13 more
 Have I done something really stupid and is Drools a fit?

 Cheers,

 Mike

  --
 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Cheng Wei Lee
 *Sent:* 22 April 2008 17:27
 *To:* rules-users@lists.jboss.org
 *Subject:* [rules-users] Re: Is this scenario suitable for using Drools?

 I've 2 algorithms to calculate the cost of a product. At any one time,
 there is only 1 algorithm in use. Initially algorithm 1 will be the default.
 Subsequently, the decision to use which algorithm will depend on customers
 feedback. The algorithms are:

 Algorithm 1:
 Cost = MAX(P1, T1, P2, T2, P3, T3, ...)

 Algorithm 2:
 Cost = MIN(P1, P2, P3, ...) + MIN(T1, T2, T3, ...)

 The values of P1, P2, ... are stored within a database. The number of Ps 
 Ts are unknown but can be determined by querying the database, Would drools
 be a good option to use to store the algorithms? If so, how could I be able
 to retrieve the values of P1, P2, etc from the database from within drools?

 Thanks!


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: Is this scenario suitable for using Drools?

2008-04-23 Thread Steven Williams
without knowing how you are accessing the database your two algorithms come
down to something like:

Alg. 1
max(select max(p) from y, select max(t) from z)

Alg. 2
select min(p) from y + select min(t) from z

which is basically the same as what Michael has proposed.

Personally I think if you are already using Drools then this would fit, but
it wouldn't seem like enough of a reason to introduce Drools on its own.

cheers
Steve



On Wed, Apr 23, 2008 at 2:27 AM, Cheng Wei Lee [EMAIL PROTECTED] wrote:

 I've 2 algorithms to calculate the cost of a product. At any one time,
 there is only 1 algorithm in use. Initially algorithm 1 will be the default.
 Subsequently, the decision to use which algorithm will depend on customers
 feedback. The algorithms are:

 Algorithm 1:
 Cost = MAX(P1, T1, P2, T2, P3, T3, ...)

 Algorithm 2:
 Cost = MIN(P1, P2, P3, ...) + MIN(T1, T2, T3, ...)

 The values of P1, P2, ... are stored within a database. The number of Ps 
 Ts are unknown but can be determined by querying the database, Would drools
 be a good option to use to store the algorithms? If so, how could I be able
 to retrieve the values of P1, P2, etc from the database from within drools?

 Thanks!


 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Modifying fact object during rules execution

2008-04-13 Thread Steven Williams
You could then have a rule that checks not (Currency type == USD) and a RHS
with that inserts a new converted amount. If your conversion is rules-based
then just have a rule per currency conversion.

Your processing rules could then act on the converted amounts.

On Mon, Apr 14, 2008 at 2:33 AM, vmuthupal [EMAIL PROTECTED] wrote:


 Hi,

 Currently we have a rule defined like this
 When
  Currency value = 300
  Currency type = USD
  Condition 3 = something
  Condition 4 = something
 Then
  do this

 If the input values are not of the same currency then we need to do a
 currency conversion and then evaluate the above rule. For example if the
 input value says Currency value = 250 and currency type = Euro. then we
 need
 to convert the currency value from Euro to USD and then execute the rule.
 Is
 this possible by using functions on the LHS. If possible is there a better
 way to do this as we are currently looking at 10,000 rules to go through
 this routine.

 Thanks.
 --
 View this message in context:
 http://www.nabble.com/Modifying-fact-object-during-rules-execution-tp16659936p16659936.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Error on access variable in workingmemorylogger

2008-04-09 Thread Steven Williams
This may be http://jira.jboss.org/jira/browse/JBRULES-1415

cheers
Steve

On Wed, Apr 9, 2008 at 5:37 PM, vdelbart [EMAIL PROTECTED] wrote:


 Hello,

 I have an error on WorkingMemoryLogger with this rule :

 package example
 import mcmipih.rules.demo.model.*;
 global Param param;

 rule Your Third Rule
dialect mvel
when
Param( iep : IEP  ) from param
then
System.out.println(Iep de param  + iep);
 end

 The error :

 java.lang.NullPointerException
at

 org.drools.base.mcmipih.rules.demo.model.Param22676229$getIEP.getValue(Unknown
 Source)
at
 org.drools.base.ClassFieldExtractor.getValue(ClassFieldExtractor.java:127)
at org.drools.rule.Declaration.getValue(Declaration.java:198)
at

 org.drools.audit.WorkingMemoryLogger.extractDeclarations(WorkingMemoryLogger.java:265)
at

 org.drools.audit.WorkingMemoryLogger.activationCreated(WorkingMemoryLogger.java:199)
at

 org.drools.event.AgendaEventSupport.fireActivationCreated(AgendaEventSupport.java:75)
at
 org.drools.reteoo.RuleTerminalNode.assertTuple(RuleTerminalNode.java:331)
at
 org.drools.reteoo.RuleTerminalNode.assertTuple(RuleTerminalNode.java:137)
at

 org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(SingleTupleSinkAdapter.java:20)
at org.drools.reteoo.FromNode.assertTuple(FromNode.java:90)
at

 org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
at

 org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
at

 org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at
 org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at
 org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at

 org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:179)
at

 org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1315)
at

 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:462)
at

 org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)
at

 execute.ExecReglesWorkingMemory.testExecReglesWorkingMemory(ExecReglesWorkingMemory.java:107)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at

 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
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)


 The workingmemorylogger wants to show the value of the variable iep even
 if
 my 'param' is not present in the working memory !

 Is it a bug ?

 thanks for your help,

 regards,

 V.







 --
 View this message in context:
 http://www.nabble.com/Error-on-access-variable-in-workingmemorylogger-tp16581343p16581343.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Feature request

2008-04-09 Thread Steven Williams
I also have this requirement. I spoke to Michael Neale about it and he
thought that it shouldn't be too difficult. Michael, I wasn't sure if you
were going to add the feature request or if you want me to do it?

cheers
Steve

On Thu, Apr 10, 2008 at 9:30 AM, Brian Trezise 
[EMAIL PROTECTED] wrote:

  This is a feature request, or if the feature already exists, a request
 that somebody let me know :)



 I have a set of rules that heavily depend on regular expressions to
 operate.  The regular expression is matched on the LHS of the rule, and then
 passed to another object for additional processing in the RHS of the rule.
 We're looking at a few hundred rules here.  Here's the problem – because of
 needing to use the regexes twice, I have stored them in a separate container
 class as public static final String variables; however what we really want
 to do is to be able to make a modification to either the regex or the rules
 themselves, hot deploy the changes to the rule, and have everything work.
 We specifically do not want to have to try hot-deploying or re-compiling
 classes due to the potential issues that can arise.  As it stands now it's
 looking like we are going to have to endure a pretty heavy maintenance
 burden by changing the rule, hot deploying, then later in the evening
 redeploying the java code and rebooting the server whenever we make a
 change.



 The ideal solution for this problem would be if we could set
 package-scoped variables in the .drl file, outside of the rules.  For
 example, at the top of the drl file, below the import statements, if we
 could write something like the following:

  let String THIS_STRING = this regular expression;



 and then in the background when the rule classes are generated, have them
 be declared as static final/constant variables.  This way they could be used
 on either side of the rule, but if a change is made the RuleAgent will see
 that and overwrite the old version of the rule package and fact processing
 would be able to continue uninterrupted.



 If anybody has any suggestions on a work around, I would be appreciative.



 Oh, and thanks to everybody for helping me get the RuleAgent to work :)

 *___
 Brian Trezise
 Staff Software Engineer
 IntelliData, Inc
 *3173 s. uravan way
 aurora, colorado 80013
 T: 720.524.4864
 [EMAIL PROTECTED]

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Missing mvel class after upgrade 4.0.4 = 4.0.5

2008-03-27 Thread Steven Williams
Hi Christian,

I also ran into this problem. The mvel library on repo1.maven.org is wrong.
Try using the jboss or codehaus repos.

cheers
Steve

On Wed, Mar 26, 2008 at 10:28 PM, Christian Gorbach [EMAIL PROTECTED] wrote:

 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
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Can we do this with drools ?

2008-03-27 Thread Steven Williams
There are some undocumented classes in drools-decisiontables that should let
you do this. Have a look at DataProviderCompilerIntegrationTest.java

cheers
Steve*
*
On Tue, Mar 25, 2008 at 12:03 PM, ferry97 [EMAIL PROTECTED] wrote:


 Thanks Mark for the info.
 Could you show me how to do it using mvel ? or refer me a link that
 explaining all this ?



 Mark Proctor wrote:
 
  ferry97 wrote:
  Hi,
  I don't know how to ask this in words.
  But can we do something like :
 
  rule define trx type
  when
 Transaction(code == ${type1.code)
 
  sorry no. But it's a nice idea, maybe submit a patch? You could probably
  do this yourself already if you use MVEL templating as a pre-parser.
  then
 doSomething 
 
  So, we define the type.code in a properties file.
  Thanks
 
 
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 

 --
 View this message in context:
 http://www.nabble.com/Can-we-do-this-with-drools---tp16244282p16266150.html
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: Fire Rules in DT based on a rule in DT

2007-11-15 Thread Steven Williams
I'm not sure if it made its way into the doco. I don't have the code with me
but will check for you what the value is.

cheers
Steve

On Nov 16, 2007 1:21 PM, Arjun Dhar [EMAIL PROTECTED] wrote:

 Steven Williams stevearoonie at gmail.com writes:

 
 
  I added agenda-group to decision tables in September 2006.cheersSteve

 2006, or 2007? Because it was not there in JBoss Rules 4.0.0 (at least not
 documented).

 Either way, it means it exists now. So will look at the latest release
 documentation.

 Thanks

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Fire Rules in DT based on a rule in DT

2007-11-14 Thread Steven Williams
I added agenda-group to decision tables in September 2006.

cheers
Steve

On Nov 14, 2007 6:50 PM, Arjun Dhar [EMAIL PROTECTED] wrote:

 Hi,
  I have the following scenario.

 SCENARIO (simplified for discussion from actual blown up scenario)
 -
  1. A decision table (DT) with rules for all types of employees - Call
 it Common DT
  2. The DT mentioned in Point 1 has a condition that fetched data
 depending
 on Type Of Employee

  3. There are other decision tables that would like to use the the rules
 from Common DT, but here are the challenges:

 Challenges
 --
 1. Decision does not support Agenda Groups
 2. Using a fact; to hold the evaluated result from a DT can pass it from a
 child to a parent; but it requires an update(); which can cause infinite
 recursion if i dont have a Execute ONE Rule Only from Table decision
 variable.

 (Parent) DT - Condition 1, condition 2, Condition 3 (Actually result of
 Child
 DT)


 (Child DT)
 ... The relation is maintained using decision variables.

 This relation works perfenctly good (been working for 3 months now), but
 issue
 is it creates a Sort of a Tree (with each node a DT); in shich I cannot
 fire a
 common set of rules from Any Node.

 As an alternative; I'm suggesting to the client to write replicated DT's
 for
 each type of employee instead of 1 generic DT.

 Can anyone help?

 I've been begging for agenda Groups in decision tables but I guess you
 guys are
 tied up. So at a design level can you suggest a work around?

 Thanks,
 Arjun

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] custom defined types in setter and getters

2007-10-03 Thread Steven Williams
No - you can use any java object as a fact, so both of your classes are
fine. For instance you could do:

when
  Car($p: paint)
then
  System.out.println($p.getName());
end

and using MVEL you could do:

when
  Car(paint.name == red)
then
  ...


On 10/4/07, jack wu [EMAIL PROTECTED] wrote:

 Hi, i suppose the second form of fact is not supported. but i'd like to
 confirm.

 in other words, you can only have setters and getters that return basic
 java types. is that right? can i return java collections such as array and
 map? the documentation is not clear on that.

 thanks.

 public class Paint
 {
 String getName();
 String getColor();
 }


 public class Car
 {
 int getSize();
 Paint getPaint();
 }


 jack.



 --
 Got a little couch potato?
 Check out fun summer activities for 
 kids.http://us.rd.yahoo.com/evt=48248/*http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] NoMuchMethod - But there is!

2007-06-21 Thread Steven Williams

Hi Steven,

Looks like you are picking up the wrong org.eclipse.jdt.core jar at runtime.

cheers
Steve

On 6/19/07, Steven Waldren [EMAIL PROTECTED] wrote:


Hello,
I downloaded the JBoss Rules 4.0 Eclipse IDE.  I built a small project
with about 120 rules. My test asserts around 500 objects. When I try to add
one more rule (regardless of the content of the rule) I get the error below,
stating no such method error.  Even if I add the following rule, I still get
the error:

rule new rule
when
 Object()
then
 System.out.print(test);
end


What other problems can throw these errors?

Thanks,
Steven
--
Steven E. Waldren, M.D., M.S.
OpenHealth Data
Skype: steven.waldren

=== THE ERROR ==
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems
()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(
EclipseJavaCompiler.java:295)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:454)
at org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(
EclipseJavaCompiler.java:332)
at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(
JavaDialect.java:311)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:237)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(
PackageBuilder.java:157)
at com.sample.DroolsTest.readRule(DroolsTest.java:78)
at com.sample.DroolsTest.main(DroolsTest.java:37)
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems
()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(
EclipseJavaCompiler.java:295)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:454)
at org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(
EclipseJavaCompiler.java:332)
at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(
JavaDialect.java:311)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:237)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(
PackageBuilder.java:157)
at com.sample.DroolsTest.readRule(DroolsTest.java:78)
at com.sample.DroolsTest.main(DroolsTest.java:37)




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to stop a rule from firing?

2007-06-21 Thread Steven Williams

One simple way is:

 [when] condition3 = not condition2  \\someCondition;
 [then] assert the Object2 into Working Memory;

 [when] condition4 = not condition2  \\someCondition;
 [then] Set the Error Message.

Generally you should keep your rules independent of each other.

If this is just a naive example of a more complex problem maybe you should
look at the RuleFlow (in v4) or agenda groups.

On 6/22/07, McShiv [EMAIL PROTECTED] wrote:



Hi,

I am using Drools 3.0.6. The rule is given below.

Rule:

  [when] condition1 = \\someCondition;
  [then] assert the Object1 into Working Memory;

  [when] condition2 = \\someCondition;
  [then] set the Error Message.

  [when] condition3 = \\someCondition;
  [then] assert the Object2 into Working Memory;

  [when] condition4 = \\someCondition;
  [then] Set the Error Message.

By requirement is when the condition2 is satisfied, the error code should
be
set and the following rules should not fire. If the condition2 is not
satisfied, it goes to the condition3 and condition4. If condition4
satisfies, it should set the error code and stop firing the rules again.

I dont know how to stop the rules from firing after the error code is set
in
the condition2.

Can someone help me on this issue.

Thanks  Regards
McShiv.
--
View this message in context:
http://www.nabble.com/How-to-stop-a-rule-from-firing--tf3961519.html#a11242241
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] FW: Newbie: using a spreadsheet

2007-05-01 Thread Steven Williams

In your Action column you should have:

ACTION
blank
singleStatus.setAnswer($param);

cheers
Steve

On 5/1/07, Hehl, Thomas [EMAIL PROTECTED] wrote:


 OK, here's my rules table:



*RuleTable Court***



CONDITION

CONDITION

ACTION

singleStatus: SingleParticipantStatus

singleStatus: SingleParticipantStatus

singleStatus: SingleParticipantStatus

statusType

value

singleStatus.setAnswer($param);



And this generates a rule that looks like this, for example:



 then singleStatus: SingleParticipantStatus.singleStatus.setAnswer
(statusOnly);;



This generates an error b/c it doesn't know how to resolve
SingleParticipantStatus.singleStatus.setAnswer, which is where the error
below is coming from.



So I changed the rule table to simply say:



setAnswer($param);



Which generates:



  then

singleStatus: SingleParticipantStatus.setAnswer
(statusOnly);;



Which causes the non-static method error since setAnswer is an instance
method.



Can anyone tell me what I'm doing wrong?



Thanks.


 --

*From:* Hehl, Thomas
*Sent:* Monday, April 30, 2007 8:42 AM
*To:* 'rules-users@lists.jboss.org'
*Subject:* Newbie: using a spreadsheet



I've been following the ExamplePricePolicy example and am attempting to
build my own rules using a spreadsheet.



In my spreadsheet rules, I have the following:



ACTION

singleStatus: SingleParticipantStatus

singleStatus.setAnswer($param);



This throws:



org.drools.rule.InvalidRulePackage: Rule Compilation error
SingleParticipantStatus.singleStatus cannot be resolved

Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved

Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved

Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved

Rule Compilation error SingleParticipantStatus.singleStatus cannot be
resolved



When I googled on this error, most of the occurrences appeared to be
related to an import issue, but if I change the third line to:



setAnswer($param);



It blows up because it knows that setAnswer is not a static method, which
tends to tell me that it found my class.



I think I've parroted the example exactly and so I'm confused as to where
to go with this issue.



Thanks!

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Fetching Facts from WM...

2007-04-09 Thread Steven Williams

Two ways you could do it:

List list = workingMemory.getObjects(Target.class);

or use a query:

drl:
query target objects
   Target()
end

code:
QueryResults results = workingMemory.getQueryResults( target objects );

cheers
Steve




On 4/10/07, jdepaul [EMAIL PROTECTED] wrote:



Suppose my client code initially asserts two Facts into WorkingMemory
instance:  one Source object and one TargetOne object.  As the rules get
applied, some of the rules may assert additional Target facts into WM.
How
can I retrieve all of the Target facts (however many were created) from
the
WorkingMemory after fireAllRules() method was called (regardless of how
many
Target objects were created as a result)?!

I will not know the concrete type of the target object types that were
asserted into WM instance, as they can be as many as 7 class sub-types
(TargetOne, TargetTwo, TargetThree), though they will all share a common
super-class (com.mypackage.Target).  Can someone show an example on how to
fetch the resulting Target objects after fireAllRules() is called and
filter
out the Target objects?

Thanks in advance -
James

--
View this message in context:
http://www.nabble.com/Fetching-Facts-from-WM...-tf3550451.html#a9912199
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help : drools implementing

2007-04-05 Thread Steven Williams

J2EE does not allow File I/O so it may be that your app server does not
allow it by default and you need to give your application permission to do
it. This would generally be done in a policy file (in WebSphere it is
was.policy).

Steve

On 4/5/07, vista2007 [EMAIL PROTECTED] wrote:



I want to call rules from session bean. I implement this by calling a
utility
callss from the Session bean method.
That Utility class load the rule file as

final Reader source = new
InputStreamReader(BaseRuleImpl.class.getResourceAsStream(rulefile));

this gives the result as expected. But it throws an exception in the
server
as follows,(Server log)

java.lang.Throwable
at
com.sun.enterprise.loader.EJBClassLoader$SentinelInputStream.init(
EJBClassLoader.java:1123)
at

com.sun.enterprise.loader.EJBClassLoader$InternalJarURLConnection.getInputStream
(EJBClassLoader.java:1216)
at java.net.URL.openStream(URL.java:1009)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java
:1161)
at
com.sun.enterprise.loader.EJBClassLoader.getResourceAsStream(
EJBClassLoader.java:782)
at java.lang.Class.getResourceAsStream(Class.java:2030)
at org.drools.semantics.java.RuleBuilder.clinit(Unknown Source)
at org.drools.compiler.PackageBuilder.addRule(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackage(Unknown Source)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
Source)
at
com.argosoftware.rules.impl.BaseRuleImpl.readRule(BaseRuleImpl.java:29)
at com.argosoftware.rules.impl.RuleImpl.fireRule(RuleImpl.java:54)
at
com.argosoftware.rules.ejb.session.LogicHandlerBean.ruleHandler(
LogicHandlerBean.java:42)

I think this is because of the IO operation.
Can anybody kindly suggest a solution for this.?

--
View this message in context:
http://www.nabble.com/Help-%3A-drools-implementing-tf3530032.html#a9851208
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] java.lang.NoSuchMethodError:org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[

2007-02-19 Thread Steven Williams

you also need stringtemplate-2.3b6.jar

Steve

On 2/19/07, Nagabhushanam B [EMAIL PROTECTED] wrote:


hi
I am facing a problem while deployed it in websphere community edition.
My application is working fine when it is running in tomcat using jBoss
Rules... but the same thing if I deployed in Webspehere then its throwing
exception. i thought its because of antlr jar version mismatch , then i
replaced new version on antlr-2.7.6  antlr-3.0ea8... still its giving the
following exception...

CharScannar : Parse ClassNotFoundException :
org.antlr.stringtemplate.language.ChunkTocken


Can any of you solve my problem.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] conditional insert of 'exist' or 'not' keywords in decision table s

2007-02-19 Thread Steven Williams

Hi Vlad,

There is a very basic wiki page on it
(http://wiki.jboss.org/wiki/Wiki.jsp?page=DecisionTableTemplates
).

In terms of the functionality you mention you have your data having
knowledge of the rule templates whereas the current implementation is such
that the data has no knowledge of the templates. You can apply multiple rule
templates to the same data however (as in
ExternalSpreadsheetCompilerIntegrationTest):

   final ExternalSpreadsheetCompiler converter = new
ExternalSpreadsheetCompiler();
   final List listeners = new ArrayList();
   ExternalSheetListener l1 = new ExternalSheetListener(10, 3,
/templates/test_pricing1.drl);
   listeners.add(l1);
   ExternalSheetListener l2 = new ExternalSheetListener(30, 3,
/templates/test_pricing2.drl);
   listeners.add(l2);
   converter.compile(/data/ExamplePolicyPricing.xls, InputType.XLS,
listeners);

This example assumes two sets of data in the one sheet, however they could
both have been applied to the same set (ie. the second listener could also
point to row 10, column 3). Would that accomplish what you need?

Steve



On 2/20/07, Olenin, Vladimir (MOH) [EMAIL PROTECTED]  wrote:


 Thanks, Steve. That really seems to do the trick. Are there any wiki
pages on this new functionality? Or for now one should refer to the source
code  unit tests?



I also wonder what other functionality the new templating engine has? Is
it possible to define different 'types' of rules in the same 'rule' template
and refer to these types from 'Excel' data fields (eg, have one column per
rule where you can refer 'rule template XXX' from drl file; this value can
override some default value for example). If not, how such situations can be
handled? (ie, when one needs several type of rules driven by the same data?)



Thanks,



Vlad
 --

*From:* [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] *On Behalf Of *Steven Williams
*Sent:* 17 February 2007 04:25
*To:* Rules Users List
*Subject:* Re: [rules-users] conditional insert of 'exist' or 'not'
keywords in decision table s



Hi Vlad,

With the new decision table handling you could use the following template
to do it:

Given a table as follows:

exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive

the following template does what you want:

template header
driver[]
policy[]

package This_is_a_ruleset;
#generated from Decision Table
import example.model.Driver;
import example.model.Policy ;

template Driver policy
driver
policy

rule driver policy $row.rowNumber$
when
$driver0$
Driver(age = $driver1$, age = $driver2$)
$policy0$
Policy(type = $policy1$)
then
//do smth
end
end template

the code to call it was:
public void testColumnKeywords() {
final ExternalSpreadsheetCompiler converter = new
ExternalSpreadsheetCompiler();
final String drl = converter.compile( /data/TestWorkbook.xls,
/templates/test_keywords.drl,
  InputType.XLS, 1, 1 ); // DT
starts at Row 1, Column 1
System.out.println(drl);
}

cheers
Steve

On 2/17/07, *Olenin, Vladimir (MOH)*  [EMAIL PROTECTED]
wrote:

Hi,



I wonder if it's possible to pass some Column keywords as parameters from
template values, eg:



Condition

Condition

$1 Driver

$1 Policy

age = $2, age = $3

type

exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive



I'd expect the above table would generate two rules like:



Rule 1

When

exists Driver (age = 21, age = 25)

Policy(type == comprehensive)

Then

// do smth

End





Rule 2

When

not Driver (age = 64, age = 100)

exists Policy (type == comprehensive)

then

// do smth

End







The above example is just a mock up derived from one of the examples in
the documentation to demonstrate the point (meaning, the rules themselves
might not make sense from business point of view or can be implemented
differently for this particular case).



So, any way to achieve this? Whether in current version (3.0.x) or the
upcoming release (3.2)



Thanks,



Vlad


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference

Re: [rules-users] conditional insert of 'exist' or 'not' keywords in decision table s

2007-02-17 Thread Steven Williams

Hi Vlad,

With the new decision table handling you could use the following template to
do it:

Given a table as follows:

 exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive

the following template does what you want:

template header
driver[]
policy[]

package This_is_a_ruleset;
#generated from Decision Table
import example.model.Driver;
import example.model.Policy;

template Driver policy
driver
policy

rule driver policy $row.rowNumber$
   when
   $driver0$
   Driver(age = $driver1$, age = $driver2$)
   $policy0$
   Policy(type = $policy1$)
then
   //do smth
end
end template
the code to call it was:
   public void testColumnKeywords() {
   final ExternalSpreadsheetCompiler converter = new
ExternalSpreadsheetCompiler();
   final String drl = converter.compile( /data/TestWorkbook.xls,
/templates/test_keywords.drl,
 InputType.XLS, 1, 1 ); // DT
starts at Row 1, Column 1
   System.out.println(drl);
   }

cheers
Steve

On 2/17/07, Olenin, Vladimir (MOH) [EMAIL PROTECTED] wrote:


 Hi,



I wonder if it's possible to pass some Column keywords as parameters from
template values, eg:



Condition

Condition

$1 Driver

$1 Policy

age = $2, age = $3

type

exists, 21, 25

, comprehensive

not, 64, 100

exists, comprehensive



I'd expect the above table would generate two rules like:



Rule 1

When

exists Driver (age = 21, age = 25)

Policy(type == comprehensive)

Then

// do smth

End





Rule 2

When

not Driver (age = 64, age = 100)

exists Policy (type == comprehensive)

then

// do smth

End







The above example is just a mock up derived from one of the examples in
the documentation to demonstrate the point (meaning, the rules themselves
might not make sense from business point of view or can be implemented
differently for this particular case).



So, any way to achieve this? Whether in current version (3.0.x) or the
upcoming release (3.2)



Thanks,



Vlad**

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Convert logic to DRL rules

2007-02-17 Thread Steven Williams

In trunk I think you can use connective constraints:

$a : Person(age  35 |  25, zipCode == 23546 | == 68590)
then
$a.setStatus(KT);



On 2/18/07, Bill Zhang [EMAIL PROTECTED] wrote:


Hello,

I am a new Drools user trying to convert the following simple logic into
DRL:

IF (Person.Age  35 OR Person.Age  25) AND (Person.ZipCode = 23546 or
Person.ZipCode = 68590)
THEN
Person.Status = KT;

I found that it is not easy to convert the above logic into ONE DRL rule.

I tried something like this

when
$a: Person(age35) or Person (age25)
$b: Person(Zipcode==23456) or Person (ZipCode == 68590)
$c: $a and $b
Then
$c.setStatus(KT)

But looks like I can not use
$c: $a and $b
becaue in Drools, you can only bind variable to column, not to other
varaibles.

Please advise how to do this. I would imagine this should be quite
simple, maybe I missed something quite obvious.

I know that I can write custom Java method to do this, but if I do
that, I suppose I lose the power of RETEOO pattern matching (pattern
resuing,
etc.). So I prefer not to do that.

I also understand I can break the above logic into 4 rules and that
would be quite easy, but our business user is not used to think in
that way. Also, we have more complex logic than the above. So what I
want is to see if there is a way to convert this
kind of logic in ONE DRL rule.

Thanks in advance.

Bill
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to generate rules from decision tables whereLHS has no field constraints

2007-02-15 Thread Steven Williams

Hi Martin,

The decision tables on trunk do what you want and should be available in the
3.1 release (I think). The new code separates the rule template from the
data and is more flexible than the current version. There are some
integration tests that demonstrate how to use it (have a look at
ExternalSpreadsheetCompilerIntegrationTest).

For your example you would use the following template:

template header
cheese
smell

package com.cheese;

template calculateSmell
smell
rule calculateSmell $row.rowNumber$
 when
   cheese:Cheese()
 then
   cheese.setSmell($smell$);
end
end template

I will put up some further doco on the wiki tonight.

cheers
Steve


On 2/15/07, Martin Weidner [EMAIL PROTECTED] wrote:


Hi Michael,

Thanks for  your reply.

Leaving a cell empty results in the condition not being added to the rule
at all. Which is fine, cause then you're more flexible in grouping rules
with different conditions together in one decision table
I actually found a way yesterday, which seems to me more like a
workaround. But it works:

| 1 | RuleTable calculateSmell  |
| 2 |CONDITION| ACTION  |
| 3 | | cheese  |
| 4 | cheese:Cheese() | setSmell($param); |
| 5 | for every cheese| set smell to stinky |
| 6 | somevalue   | stinky  |

By declaring the variable not in the row right underneath below the
CONDITION cell, but in the row where you normally declare the conditions (
i.e. second row underneath the condition row
AND putting in some random value in the cell, that holds the parameter
value, you can generate the desired rule:

#From row number: 6
rule calculateSmell_6
when
cheese:Cheese()
then
cheese.setSmell(stinky);;
end

Leaving out the parameter value results in the when line being blank, so
you gotta fill in something.
I can live with that, but it seems to me more like a workaround, so I
would be kinda curious whether there is (or will be) an official way of
achieving this
Best regards,
Martin

Van: Michael Neale [mailto:[EMAIL PROTECTED]
Verzonden: donderdag 15 februari 2007 01:05
Aan: Rules Users List
Onderwerp: Re: [rules-users] How to generate rules from decision tables
whereLHS has no field constraints

you should be able to do that - just leave the constraint cells empty, or
put some comment in them.
On 2/14/07, Martin Weidner  [EMAIL PROTECTED] wrote:
Hello,
Maybe I have overlooked something, but I couldn't find a way to generate a
simple rule from an excel decision table, where the left hand side contains
no field constraints?
i.e.
rule do we have cheese
WHEN
cheese: Cheese()
THEN
RHS
End
Is there a way to achieve this?
Thanks in advance,
Martin
_
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Focus before assertion - for pattern matching

2007-02-14 Thread Steven Williams

I am pretty sure that all rules in all agenda groups run pattern matching
and only those in the current agenda-group execute (at least that is the
default behaviour). You can see this by using the audit logging feature.

cheers
Steve

On 2/15/07, Michael Neale [EMAIL PROTECTED] wrote:


not quite sure what you are asking, but I think the answer is yes, or it
*should* be yes and there is a current limitation.

On 2/14/07, Nirmal.R  [EMAIL PROTECTED] wrote:


 Hi,
 Can i set the focus to a particular agenda group where in  the engine
 tries
 to match the asserted object only to those set of rules

 Thank you
 Nirmal
 --
 View this message in context:
 
http://www.nabble.com/Focus-before-assertion---for-pattern-matching-tf3227311.html#a8965077
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help Needed

2007-02-12 Thread Steven Williams

Hi Shilpa,

You can pass your DAOs (or any other object) into the working memory as
globals and then use them in the consequence of your rules.

cheers
Steve

On 2/13/07, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:


 Hi,



I am using Drools 3.0 in our business logic. I need help in
the below situation





I will take the records from the database on daily basis and
each record is fact in the rule engine



I will check the fact against some constant value; if it
satisfies the condition then I need to update one field in the database.



I am using Ibatis as DAO framework.



How I can connect to database in *.drl* file?



Please help me.



Thanks  Regards

Shilpa



The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s) and
may contain proprietary, confidential or privileged information. If you are
not the intended recipient, you should not disseminate, distribute or copy
this e-mail. Please notify the sender immediately and destroy all copies of
this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses. The
company accepts no liability for any damage caused by any virus transmitted
by this email.

www.wipro.com

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users





--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users