| I have a Jess file with a simple template for a patient: (deftemplate patient "Patient object - has age and weight" (slot age) (slot weight) (slot miscellaneous)) and a simple template for a glucose measurement: (deftemplate currentGlucoseValue "Glucose level at current timepoint" (slot measurementTime) (slot value)) and a rule: (defrule current-glucose-range "Define current glucose status" (currentGlucoseValue (value ?value)) (patient) => (if (and (>= ?value ?*lowTargetLimit*) (<= ?value ?*highTargetLimit*)) then (assert(currentGlucoseInRange)) else (if (< ?value ?*lowTargetLimit*) then (assert(currentGlucoseBelowRange)) (printout t "The patient is hypoglycemic." crlf) else (assert(currentGlucoseAboveRange)) (printout t "The patient is hyperglycemic." crlf) ))) When I include the following in my file and execute this as a Jess program, the rule fires and "The patient is hyperglycemic" is displayed (because the glucose level is high). (assert (patient (age 33) (weight 3))) (assert (currentGlucoseValue (value 245))) But when I have embedded the rule file in Java, eliminating the two assertions shown above, and instantiate patient from a Java Bean that is more complicated than the simple patient template shown above, the rule current-glucose-range does not activate. The actual patient object is instantiated with rete.add(object) and Jess has constructed it thus: ==> f-1 (MAIN::Patient (age 36) (birthdate <Java-Object:java.util.GregorianCalendar>) (birthdateString "December 15, 1969") (class <Java-Object:java.lang.Class>) (decisions <Java-Object:org.hibernate.collection.PersistentBag>) (firstName "HypoButInsulinOn") (gender <Java-Object:edu.utah.cdmcc.entities.Gender>) (height 72.86) (id 5) (lastName "Adult") (medRecNum "56-34-56") (miscellaneous nil) (name "Adult, HypoButInsulinOn") (trialDbCode "ST02CHOM0005") (version 0) (weight 67.8) (OBJECT <Java-Object:edu.utah.cdmcc.entities.Patient>)) I tried changing the Jess file to capitalize Patient, but then I received a Jess error in routine definstance, stating unknown object class Patient. Any comments will be appreciated. - Mike |
- JESS: Fact template conflicts? mdean77
- Re: JESS: Fact template conflicts? friedman_hill ernest j
- Re: JESS: Fact template conflicts? mdean77
- Re: JESS: Fact template conflicts? friedman_hill ernest j
- Re: JESS: Fact template conflicts? mdean77
- Re: JESS: Fact template confl... friedman_hill ernest j
- Re: JESS: Fact template c... mdean77
- Re: JESS: Fact templa... mdean77
- JESS: Ordering execut... erich.oliphant
- Re: JESS: Ordering ex... Henrique Lopes Cardoso
