public void setInsulinOn(boolean insulinOn) {
boolean oldValue = this.isInsulinOn();
this.insulinOn = insulinOn;
firePropertyChange("insulinOn", oldValue,
insulinOn);
}
The eventual call is
to fireRules which then calls executeRules in a callback. Previously,
I had a Boolean argument to the insert
statements and all
the code worked with the old RuleBase, RuleAgent objects. But since
changing to KnowledgeSession, the rules
do not appear to
fire. Here are the relevant methods:
public void
executeRules(WorkingEnvironmentCallback callback) {
StatefulKnowledgeSession
ksession = kbase.newStatefulKnowledgeSession();
callback.initEnvironment(ksession);
ksession.fireAllRules();
ksession.dispose();
}
public void fireRules(final GlucoseDecision
glucoseDecision, final
GlucoseDecisionState decisionState) {
rulesEngine.executeRules(new
WorkingEnvironmentCallback() {
public void
initEnvironment(StatefulKnowledgeSession workingMemory) {
workingMemory.insert(glucoseDecision);
workingMemory.insert(decisionState);
}
});
}
Message: 2
Date: Wed, 11 Feb 2009 10:26:06 -0500
From: Edson Tirelli <
tirelli@post.com>
Subject: Re: [rules-users] Shadow facts
To: Rules Users List <
rules-users@lists.jboss.org>
Message-ID:
<
e6dd5ba30902110726t2b09ee9dtdc7e85ed4217f80a@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Dean,
There are two unrelated things in here... the boolean flag for dynamic
facts means your fact supports the property change listeners and you
don't
need to call modify() when you change an attribute. ShadowFacts are a
complete different thing that should be mostly transparent to users.
If you can provide an example, it will be easier to help you.
[]s
Edson
2009/2/11 J Michael Dean <
mdean77@comcast.net>
I am migrating from 4.07 to 5 and my
previous DRL file does not function
correctly; I previousliy inserted facts
with the dynamic Boolean set true.
I understand that this is no longer done
because shadow facts are "not
needed" in Drools 5, but is it necessary to
do anything different in the RHS
when modifying facts? My fact POJOs have a
method for adding text to
themselves. I believe my rules are not
working properly because nothing is
being modified - only the initial
activation set fires and then nothing
happens.
Restated, the documentation talks about how
to "avoid" shadow facts in
Drools 4.07 - are the restrictions in this
part of the docs necessary in
Drools 5?
Thanks.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users