About for and inheritance
by Chris Woodrow
Hi,
I recently find out a few issues using for, and I wanted to share it with
you. I made a simple exemple to illustrate my purpose.
My classes are (I did not represent accessors & constructors):
public class Cheese {
protected String name;
}
public class FrenchCheese extends Cheese{
private String smell;
}
public class Person {
private Cheese likes;
}
Here is my rule set :
package rules
rule "likes cheese"
when
$person : Person ()
Cheese( ) from $person.getLikes()
then
System.out.println("likes cheese");
end
rule "likes french cheese"
when
$person : Person ()
FrenchCheese( ) from $person.getLikes()
then
System.out.println("likes french cheese");
end
First test :
Cheese cheese = new FrenchCheese("good", "camembert");
Person person = new Person();
person.setLikes(cheese);
Output :
likes french cheese
likes cheese
Wich is expected...
Second test :
Cheese cheese = new Cheese();
Person person = new Person();
person.setLikes(cheese);
Output :
likes french cheese
likes cheese
That's the first strange thing. As far as I am concerned, rule "likes french
cheese" should not match (since a Cheese is not a FrenchCheese).
I made a change to the second rule :
rule "likes french cheese"
when
$person : Person ()
FrenchCheese( smell == "good" ) from $person.getLikes()
then
System.out.println("likes french cheese");
end
Third test :
Cheese cheese = new Cheese();
Person person = new Person();
person.setLikes(cheese);
output :
It throwed an exception : Exception in thread "main"
java.lang.ClassCastException: rules.Cheese
I am not saying the ClassCastException is not to expect in such a case but I
think I would simply expect it not to match (as far as a Cheese is not a
FrenchCheese).
Chris
13 years, 11 months
Drools 4.0, Support for multiple pattern in accumulate source pattern
by Juergen
It appears as if accumulate does support only a single pattern CE as
source pattern, e.g.:
Number() from accumulate(
Cheese(
price : price
),
sum( price )
)
Is it possible to have more than one pattern in the source pattern, e.g.:
Number() from accumulate(
Cheese(
price : price,
type : type
)
Person(
favouriteCheese == type,
age > 30
),
sum( price )
)
The same could be said for collect, but there the problem to specify
which item of a matching tuple is to be collected, but this could be
handled recreating collect via accumulate, e.g.:
Collection() from accumulate(
cheese : Cheese(
type : type
)
Person(
favouriteCheese == type,
age > 30
),
collect( cheese )
)
14 years
Blurring the lines of jBPM and Drools
by keithnielsen
I have been researching both jBPM and Drools for sometime now and am
wondering what the future holds for jBPM. This is based on my research of
Drools 5, which is bringing what I would consider more BPM constructs into
the core engine, things such as Wait States, Human Tasks, etc. One of the
main things I don't see yet is the whole persistence and support of long
running processes. My question is will the trend with Drools continue,
eventually consuming jBPM?
I must say that my perception is that Drools is more active which makes me
wonder if I should go with Drools hoping that it builds out more BPM
features going forward.
Thanks
--
View this message in context: http://www.nabble.com/Blurring-the-lines-of-jBPM-and-Drools-tp20099731p20...
Sent from the drools - user mailing list archive at Nabble.com.
14 years, 2 months
Decision Tree input?
by Wilson O Ojwang
All,
Is there something in the works to support Decision Tree Inputs in
addition to Decision Table?
Regards
Wilson
14 years, 5 months
java.lang.NoSuchMethodError on every Action node
by Ana F Santos
Hi everyone.
I've been trying to use Drools for the past month, and sometimes I have
problems I can't guess anymore how to solve.
This time, every action I try to insert in a ruleflow, I receive a
java.lang.NoSuchMethodError. I'm even trying a really simple ruleflow with
just one simple action - like System.out.println("Test"); - and all I get
is a java.lang.NoSuchMethodError.
[
The stack trace:
java.lang.NoSuchMethodError:
br.com.pst.packages.ruleflows.Process_br_com_pst_packages_ruleflows_0.action0(Lorg/drools/spi/KnowledgeHelper;Lorg/drools/spi/ProcessContext;)V
at
br.com.pst.packages.ruleflows.Process_br_com_pst_packages_ruleflows_0Action0Invoker.execute(
Process_br_com_pst_packages_ruleflows_0Action0Invoker.java:20)
at
org.drools.workflow.instance.node.ActionNodeInstance.internalTrigger(
ActionNodeInstance.java:54)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(
NodeInstanceImpl.java:111)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerConnection(
NodeInstanceImpl.java:142)
at
org.drools.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(
NodeInstanceImpl.java:128)
at
org.drools.workflow.instance.node.StartNodeInstance.triggerCompleted(
StartNodeInstance.java:49)
at
org.drools.workflow.instance.node.StartNodeInstance.internalTrigger(
StartNodeInstance.java:41)
at org.drools.workflow.instance.impl.NodeInstanceImpl.trigger(
NodeInstanceImpl.java:111)
at
org.drools.ruleflow.instance.RuleFlowProcessInstance.internalStart(
RuleFlowProcessInstance.java:16)
at org.drools.process.instance.impl.ProcessInstanceImpl.start(
ProcessInstanceImpl.java:185)
at
org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.start(
WorkflowProcessInstanceImpl.java:230)
at org.drools.common.AbstractWorkingMemory.startProcess(
AbstractWorkingMemory.java:1639)
at org.drools.common.AbstractWorkingMemory.startProcess(
AbstractWorkingMemory.java:1604)
at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(
StatefulKnowledgeSessionImpl.java:267)
at br.com.pst.packages.ServicePackages.main(
ServicePackages.java:99)
]
Actually, the beginning problem was with my project, with a process and
subprocess. The subprocess works fine, but the main process throws a
java.lang.NoSuchMethodError always on any node I put after a specific
RuleFlowGroup node. Everyting used to work before, but when I begin to
enlarge it, nothing seems to work anymore. And, as I told, I can't always
guess the exact problem as the thrown exceptions are very generic.
Hope anyone could help me!
Thanks a lot
ANA FLÁVIA FONSECA DOS SANTOS
Analista de Desenvolvimento de Software
PST Eletrônica S/A
Phone: +55 19 3787 6379
aflavia(a)pst.com.br
www.pst.com.br
www.positron.com.br
14 years, 5 months
Drools Roadmap - Planned Release 5.1 release date
by McDonald, Daniel
Hi,
I was wondering if there is a planned release date for Release 5.1?
Thank you,
Daniel McDonald
Fidelity National Information Services - Research & Development
Office phone: (972) 691-6593
Mobile phone (214) 697-8163
_____________
The information contained in this message is proprietary and/or confidential. If you are not the
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose,
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition,
please be aware that any message addressed to our domain is subject to archiving and review by
persons other than the intended recipient. Thank you.
_____________
14 years, 7 months
ANT Compile issues
by Bhamidi, Krishna
Hi,
I am using DROOLs 5.0.0 CR1 and use the compiler from Drools-Ant. When I attempt to execute the rules using a rule agent, I get an exception that in part reads
java.lang.NullPointerException
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1820)
(Full stack follows this e-mail.) However, when I download the pkg file for the same ruleset from Guvnor and use it in the rule agent, it runs fine.
I use the following for building -
<taskdef name="compiler" classname="org.drools.contrib.DroolsCompilerAntTask" classpathref="compiler.classpath" />
<compiler srcdir="../${rulesDirectory}" tofile="../${buildDirectory}/${projectName}_rules.pkg"
classpath="../${buildDirectory}/${projectName}_rules.jar"
binformat="package">
<include name="*.drl" />
<include name="*.brl" />
<include name="*.xml" />
<include name="*.dslr" />
<include name="*.xls" />
</compiler>
What I should do to compile correctly?
Full Stack
java.lang.NullPointerException
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1820)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.rule.DialectRuntimeRegistry.readExternal(DialectRuntimeRegistry.java:41)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.rule.Package.readExternal(Package.java:197)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:189)
at org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:158)
at org.drools.agent.FileScanner.readPackage(FileScanner.java:136)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:82)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:56)
at org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:69)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:410)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:362)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:347)
at org.drools.agent.RuleAgent.init(RuleAgent.java:247)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:187)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:147)
14 years, 7 months
Extending the "validation of rules" functionality in Guvnor
by Premkumar Stephen
Hello everyone,
Currently, the validate functionality ensures that rules have proper
syntax.
it is possible to extend this functionality so that business use cases might
also be validated? Is there an API/examples to do that.
For eg, in our domain, an object X can be evaluated for 3 criteria ( a, b,
c )
However, we would need to prevent rules written which combine criteria b and
c
Rules can have the combinations ( a,b,c, ab, ac ). Combinations ( bc and abc
) should not be allowed.
Regards,
Prem
14 years, 8 months
Performance of compiler
by Christian Nedregård
Hi.
My environment: Win XP SP3, 2x2.13 GHz cpu, 3GB RAM, Drools 4.0.7, JDK
1.4.2_11, java compiler: JANINO, dialect: java.
We have about 850 drl's with 5 - 10 conditions in each. 0 -2 evals in each.
The drl's only contain one rule each.
We are using Drools programatically by compiling the drls using
PackageBuilder.addPackageFromDrl and adding them to a RuleBase using
RuleBase.addPackage(PackageBuilder.getPackage())
When we are building our rule base we are never able to compile more than 1
-2 rules per second, which means we need over 10 minutes (at 100% cpu) to
build our rulebase.
Profiling shows 68% cpu time in
org.drools.rule.builder.GroupElementBuilder.build and 18% cpu time in
org.codehaus.janino.Compiler.compile.
We have experimented by changing the compiler to ECLIPSE and the dialect to
mvel but the results are the same.
We have experimented using one PackageBuilder instance per drl or grouping
drls by package and sharing a builder per package. Same result in both
scenarios.
We have also expermimented with compiling concurrently in serveral threads.
Again, about the same result.
My question is: Is this the performance we can expect from the compiler or
are we doing something fundamentally wrong?
Below is an example of one of our drls. This one contains no evals, but
still takes more than 1 second to compile. If anyone can spot some issues
with the way we are doing things the feedback would be much apreciated :)
------------------------------------
package domain.core.productoffer.rules.subscriptiontype
import type.productoffer.ProductOfferRuleEvent
import domain.core.subscription.Subscription
import domain.core.subscription.SubscribedService
import type.subscription.ActionTypeEnum
import domain.core.productoffer.ProductOffer
import domain.rules.RuleEvent
global domain.core.productoffer.RuleValidationReport validationResult
rule "RequiredVProducts"
when
ProductOfferRuleEvent(id == '3')
ProductOffer(id.value == 31963)
$subscription:Subscription()
not ( SubscribedService(status != ActionTypeEnum.REMOVE_CANCEL &&
productId.value in (57, 69) ) from
$subscription.getAllChildSubscribedServices())
then
validationResult.addValidationMessage("2069", "For product offer
rule event with id '3' and product offer with id=31963 subscription must
have one of the following VProducts: 57, 69.");
end
------------------------------------
Regards
Christian Nedregård
14 years, 9 months
Re: [rules-users] Using work items in the Eclipse ruleflow editor
by Jeremy Ary
Mike,
I ran into a similar issue when I began working with ruleflows a few weeks ago. Some of this may not be necessary and it's certainly not all causal, but this was what I noted when working my issue out:
1) If you're working in JBoss Dev Studio, it's possible that you have a conflict between the code you added as a runtime and what's already there, so try the process with a fresh install of eclipse
2) Ensure that any projects you currently have open do not have build/lib/classpath issues (I had the drools projects checked out and open and build errors caused unnecessary complications for me)
3) Be sure that your project has a META-INF on the classpath and that it's set up correctly
4) Place your drools.rulebase.conf & custom definitions .conf that it looks for are both in your META-INF under resources (src/main/resources/META-INF )
5) Once you're sure this much is correct, give Eclipse a restart - my project did not pick up my custom WI's until I restarted
If you're still having issues, I'll be on the IRC channel for the next 5 hours or so as jary - feel free to reply here or look me up there.
(well, I'm heading to lunch very soon, so back in around an hour)
Jeremy
----- Original Message -----
From: "Mike Gill" <mgill(a)modusoperandi.com>
To: rules-users(a)lists.jboss.org
Sent: Monday, September 21, 2009 11:27:46 AM GMT -06:00 US/Canada Central
Subject: [rules-users] Using work items in the Eclipse ruleflow editor
I am using Eclipse to build my Drools rulefow file. I am trying to add custom work items, but I cannot seem to get anything (other than Email and Log) to show up in my Work Items palette.
Does anyone know how to get the existing work items (such as FileFinder or Exec) to show up on the palette in eclipse?
Eventually I will need to add custom work items to the flow, so this is make-or-break Drools functionality for my team.
In pursuit of a solution to this I have combed the documentation, this mailing list archive, as well as endless Google results to no avail. Any help would be very valuable!
Thanks,
Mike
_______________________________________________ rules-users mailing list rules-users(a)lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
14 years, 11 months