The following Jess code (after the ######################### is in a batch
file excuted from within the following snippet of a Java program
(postSignalProcessor is called from the Java Main.)  The first rule merely
prints out a couple of the shadow facts' slot values. The second rule I
attempt with various methods (all failing) to change the value of a slot -
see errors below)

private static void postSignalProcessor(Event event, Subject subject) throws
JessException {

Rete rete = new Rete();

// Read in the rules

rete.executeCommand("(batch kb_jess/phs3_signal/post_signal_change.clp)");

rete.executeCommand("(reset)");

// Create the Beans

Event e = event;

Subject s = subject;

// Tell Jess about them

Funcall f = new Funcall("definstance", rete);

f.add(new Value("event", RU.ATOM));

f.add(new Value(e));

f.execute(rete.getGlobalContext());

f = new Funcall("definstance", rete);

f.add(new Value("subject", RU.ATOM));

f.add(new Value(s));

f.execute(rete.getGlobalContext());

//rete.executeCommand("(run)");

System.out.println("...event.getUpdatedReason()->"+event.getUpdatedReason()+
"<-");

//while ("testing".equals(event.getUpdatedReason())) {

System.out.println("...rete.executeCommand...");

rete.executeCommand("(run)");

//}


##################################################

;; -*- clips -*-

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Register Java classes for matching like deftemplates.

(defclass event com.phs3.data.ojb.EventImpl )

(defclass subject com.phs3.data.ojb.SubjectImpl )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; This fact will be used to sleep when idle

(deffacts idle-fact

(idle))

(watch all)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; report the status of Subject and Event

(defrule report-subject-and-event-status

?s <- (subject (subjectId ?sId) (caseStatusId ?csId))

?e <- (event (eventId ?eId) (conditionCodeId ?ccId))

=>

(printout t "***********************************************" crlf)

(printout t "* Subject " ?sId " has a status: " ?csId crlf)

(printout t "* Event " ?eId " has a condition code: " ?ccId crlf)

(printout t "***********************************************" crlf)

;;(retract ?s)

;;(retract ?e)

;;(call java.lang.Thread sleep 1000)

;;(assert (idle))

)

(defrule change-something-in-PHS3

?s <- (subject (subjectId ?sId) (caseStatusId ?csId))

?e <- (event (eventId ?eId) (conditionCodeId ?ccId) )

=>

(printout t "* Condition Code ID for event " ?eId " is changing to : 9999 "
crlf)

;;(bind ?event event)

(printout t ?e crlf)

(facts)

;;(call event setConditionCodeId 9999)

(modify 2 (conditionCodeID 9999))


(facts)

(retract ?s)

(retract ?e)

(call java.lang.Thread sleep 1000)

(assert (idle))

)

##############################################################

The problem is I cannot seem to modify the value in any of the slots of one
of the defclasses (the rules are firing as I get the printouts), getting the
error, for example:

Jess reported an error in routine modify

while executing (modify 2 (conditionCodeID 9999))

while executing defrule MAIN::change-something-in-PHS3

while executing (run).

Message: No such slot conditionCodeID in template MAIN::event.

Program text: ( run ) at line 1.

Yet conditionCode ID is clearly one of the slots:

f-2 (MAIN::event (act <External-Address:com.phs3.data.ojb.ActImpl>)
....(conditionCodeId 1008)

Note that the other method I tried to change the value of a slot ,by calling
a method on the defclass event: (call event setConditionCodeId 9999) also
fails as follows:

Jess reported an error in routine call

while executing (call event setConditionCodeId 9999)

while executing defrule MAIN::change-something-in-PHS3

while executing (run).

Message: No method named 'setConditionCodeId' found in class
java.lang.String.

Program text: ( run ) at line 1.



Thoughts?

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to