LHS use of from with a static method
by Heyns, Juan
Hello everyone
I have a rule:
rule "my rule name"
no-loop
when
Object1( $property1: property1 );
Object2( testvalue == "Test String" )
from StaticClass.aMethod($property1)
then
aFunction();
end
I cannot seem to get the StaticClass.aMethod to return anything but
null. I have a test case for this method somewhere else and it seems to
work fine. Is this a legal operation? Could it be that the version I am
using (jbossrules-4.0.0.11754MR2-bin) still does not have support for
this?
Regards
Juan
"Employees of Lonmin Platinum ("Lonplats") are not authorised to conclude
electronic transactions or to enter into electronic agreements on behalf
of Lonplats. Any electronic signature (other than an advanced electronic
signature as defined in the Electronic Communications and Transactions
Act of 2003) added to a data message (such as an email or an attachment
to an (email) ostensibly on behalf of Lonplats by a Lonplats employee shall
not be legally binding on Lonplats and Lonplats shall incur no liability of
any nature whatsoever, directly or indirectly, arising from such act on the
part of it's employee. It is further recorded that nothing (other than an
advanced electronic signature) inserted into any data message
emanating from Lonplats shall be construed as constituting an electronic
signature"
17 years, 4 months
Re: Production rules vs. ECA Rules
by qmars765@gmx.de
Hi Mark,
in which constellations i should select ECAs? What is the difference between events in ECAs and the occurrence of a certain set of facts in WorkingMemory in case of production rules?
In following document they classify ECAs and production rules both as reactive rules, but they state they are somehow different:
http://www.pms.ifi.lmu.de/publikationen/PMS-FB/PMS-FB-2007-8/PMS-FB-2007-...
And they state that JBoss Rules is only for production rules.
So can I use JBoss Rules for implementing ECAs?
Thanks and best regards,
Kioumars
Date: Mon, 30 Jul 2007 19:20:51 +0100
From: Mark Proctor <mproctor(a)codehaus.org>
Subject: Re: [rules-users] Production rules vs. ECA Rules
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID: <46AE2C03.8090701(a)codehaus.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
ECA is really a specialised subset of Product Rules; focusing more on
generic event generation and event handling.
Mark
qmars765(a)gmx.de wrote:
> Dear List,
>
> In JBoss Rules documentation it is written that they can be used for production rules. But I frequently read also in other sources about ECA rules.
>
> Is there any significant difference between “ECA†and “Production†Rules?
> If yes, what?
>
> Thanks in advance for your feedback and best Regards,
>
> Kioumars
>
>
--
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
17 years, 4 months
nested accessors with Sets
by mark.mcnally@comcast.net
Hello,
Please excuse me if I have double posted - my first did not seem to appear.
I am wondering if the following is valid rule syntax. I am getting a stacktrace when the rules fire that points to a ClassCastException on a HashSet
I am using v4.0 GA.
Thank you, Mark
rule StateMatch
when
$ca:CandidateAssociation(nurseDetails.stateLicensures excludes patientDetails.state )
then
retract( $ca );
end
public class CandidateAssociation {
private PatientDetails patientDetails;
private NurseDetails nurseDetails;
private int overlapHours;
public CandidateAssociation( PatientDetails patientDetails, NurseDetails nurseDetails) {
super();
this.patientDetails = patientDetails;
this.nurseDetails = nurseDetails;
overlapHours = participantDetails.getNumberOverlapHourCnt(nurseDetails);
}
[...]
}
public class NurseDetails {
private Set stateLicensures = new HashSet();
[...]
}
public class PatientDetails {
private String state;
[...]
}
------------------------------------------------------
Firing Rules
**********
org.drools.RuntimeDroolsException: Exception executing predicate org.drools.base.mvel.MVELPredicateExpression@27d6bfb
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:197)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:121)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:317)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:159)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:64)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:58)
at org.drools.examples.Rule_InitializeCandidateForEachNurse_0.consequence(Rule_InitializeCandidateForEachNurse_0.java:13)
at org.drools.examples.Rule_InitializeCandidateForEachNurse_0ConsequenceInvoker.evaluate(Rule_InitializeCandidateForEachNurse_0ConsequenceInvoker.java:25)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:503)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:467)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:403)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:384)
at primarynursePOC.PrimaryNursePOC.selectPrimaryNurse(PrimaryNursePOC.java:136)
at primarynursePOC.PrimaryNursePOC.main(PrimaryNursePOC.java:91)
Caused by: java.lang.ClassCastException: java.util.HashSet
at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:35)
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:191)
... 17 more
org.drools.RuntimeDroolsException: Exception executing predicate org.drools.base.mvel.MVELPredicateExpression@27d6bfb
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:197)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:121)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:317)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:159)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:64)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:58)
at org.drools.examples.Rule_InitializeCandidateForEachNurse_0.consequence(Rule_InitializeCandidateForEachNurse_0.java:13)
at org.drools.examples.Rule_InitializeCandidateForEachNurse_0ConsequenceInvoker.evaluate(Rule_InitializeCandidateForEachNurse_0ConsequenceInvoker.java:25)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:503)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:467)
at org.drools.common.AbstractWorkingMemory.doOtherwise(AbstractWorkingMemory.java:430)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:412)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:384)
at primarynursePOC.PrimaryNursePOC.selectPrimaryNurse(PrimaryNursePOC.java:136)
at primarynursePOC.PrimaryNursePOC.main(PrimaryNursePOC.java:91)
Caused by: java.lang.ClassCastException: java.util.HashSet
at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:35)
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:191)
... 18 more
Exception in thread "main" org.drools.spi.ConsequenceException: org.drools.RuntimeDroolsException: Exception executing predicate org.drools.base.mvel.MVELPredicateExpression@27d6bfb
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:507)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:467)
at org.drools.common.AbstractWorkingMemory.doOtherwise(AbstractWorkingMemory.java:430)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:412)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:384)
at primarynursePOC.PrimaryNursePOC.selectPrimaryNurse(PrimaryNursePOC.java:136)
at primarynursePOC.PrimaryNursePOC.main(PrimaryNursePOC.java:91)
Caused by: org.drools.RuntimeDroolsException: Exception executing predicate org.drools.base.mvel.MVELPredicateExpression@27d6bfb
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:197)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:121)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:317)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:159)
at org.drools.reteoo.Rete.assertObject(Rete.java:175)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:772)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:64)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:58)
at org.drools.examples.Rule_InitializeCandidateForEachNurse_0.consequence(Rule_InitializeCandidateForEachNurse_0.java:13)
at org.drools.examples.Rule_InitializeCandidateForEachNurse_0ConsequenceInvoker.evaluate(Rule_InitializeCandidateForEachNurse_0ConsequenceInvoker.java:25)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:503)
... 6 more
Caused by: java.lang.ClassCastException: java.util.HashSet
at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:35)
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:191)
... 18 more
17 years, 4 months
Multiple independent Assertions
by Arjun Dhar
Hi,
In "stateless" Session:
If List of A1,B1,C1 are executed - execute(List)
and at the same time in a paralell thread A2,B2,C2 are executed - execute(List)
In "Theory" (Conceptually), I want to confirm if A1 will interfere with the
rule using A2? Just want to ensure what is appropriate or expecteed behavior.
...assuming both threads hit the same session for that "delta t" period of time.
thanks,
arjun
17 years, 4 months