The object behind the shadow fact is available in the slot OBJECT. Simply bind that slot to a Jess variable: (MC ... (OBJECT ?mcObj)) --- (call ?mcObj setPassed TRUE)
If MC is sufficiently beanish you have a slot Passed and can use modify with some variable bound to the fact which will update the Java object; but if you call the method: does it trigger the update of the shadow fact? The Jess manual's section 5.3 contains more useful hints on shadow facts. -WL vanhaabe wrote:
Hi, This is probably easy onem, but I can't figure it out. I need to do object validation, and have flag "passed" set from within my rule. _________________________________________________________ This is my cpl file (import com.mycompany.yadda.yadda.MC) (deftemplate MC(declare (from-class MC))) (defrule mcrule "Rule 11" (MC {fg == "P"}) => (printout t "Rule 11" crlf) (call ?MC setPassed TRUE) ) _______________________________________________________________ and this is how I call it from Java: engine.resetToMark(marker); MC mc = new MC(); mc.setfg("P"); MC mc1 = new MC(); mc1.setfg("D"); engine.add(mc); engine.add(mc1); engine.run(); return engine.getObjects(new Filter.ByClass(MgmtChars.class)); _____________________________________________________________________ Rules are validated correctly, but when it executes method setPassed it throws exceptions: "No such variable MC", and that is correct. I simply don't know how to reference/access object that rule is currently executed on. If you can shed some light on it that would be really appreciated. Thanks, Ed -- View this message in context: http://www.nabble.com/Jess-newbie-does-not-know-how-to-....-tp15837006p15837006.html Sent from the Jess mailing list archive at Nabble.com. -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
-------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------