Hi,
I've got a strange behaviour when using Jess60b2 and the utility command batch. If it
is because of a bug or me missunderstanding something I dare not say.
The situation follows.
1. I have defined a rule in a clips-file which because of "misspelling" was erroneous.
The error was that I by misstake had forgotten to indicate a variable name with a ?
mark.
2. I read the file into the JESS-environment thru the batch command
(batch "H:/Ex-jobbet/JESS/Test-skript/GSM-R9-rules/instance_all_tables.clp")
MAIN::instance_all_tables: +1+1+1+1=1+1+2+2+t TRUE
3. I asserted a controlfact to make the rule go on the agenda (I watch all ... se
below)
Jess> (assert (CurrentTableIndex 0))
4. The error is noticed by the rule engine when trying to evaluate a test expression
present in the rule.
==> f-30 (MAIN::CurrentTableIndex 0) Jess reported an error in routine
Value.numericValue
while executing (< currentTableIndex (call currentMSC getNumberOfItems))
while executing 'test' CE
while executing rule LHS (Node2)
while executing rule LHS (MTELN)
while executing rule LHS (TECT)
while executing (assert (MAIN::CurrentTableIndex 0)).
Message: Not a number: "currentTableIndex" (type = ATOM).
Program text: ( assert ( CurrentTableIndex 0 ) ) at line 219.
at jess.Value.a(Unknown Source)
at jess.Value.a(Unknown Source)
at jess.Value.numericValue(Unknown Source)
5. I fix the problem in the file and save it.
6. I repeat my batch command. N.B. Wise from previous tests I remember to undefrule
the rule first in the file. Se below.
(batch "H:/Ex-jobbet/JESS/Test-skript/GSM-R9-rules/instance_all_tables.clp")
7. I still get the same error-message back as before.
Jess reported an error in routine Value.numericValue
while executing (< currentTableIndex (call ?currentMSC getNumberOfItems))
while executing 'test' CE
while executing rule LHS (Node2)
while executing rule LHS (MTELN)
while executing rule LHS (TECT)
while executing (batch
"H:/Ex-jobbet/JESS/Test-skript/GSM-R9-rules/instance_all_tables.clp").
Message: Not a number: "currentTableIndex" (type = ATOM).
Program text: ( batch
"H:/Ex-jobbet/JESS/Test-skript/GSM-R9-rules/instance_all_tables.clp" ) at line 221.
at jess.Value.a(Unknown Source)
at jess.Value.a(Unknown Source)
at jess.Value.numericValue(Unknown Source)
8. I try to debug the problem a bit for example by issuing:
(undefrule instance_all_tables)
FALSE
I get the response FALSE back which I have confirmed both experimentally and from
documentation means that the rule doesn't exist and of course can't be deleted.
I also check this via the (rules) command and it's consistent with the undefrule
command.
9. I have checked the file path and content of the modified file but the error still
occurs when I try to batch the file.
It almosts looks like Jess caches the file content internally without refreshing the
content when given the command again.Probably because of the error which makes the
rule exist in some kind of limbo state.
10. I finally exited JESS totally and tried again and the the rule file was accepted
(sole for the fact that I hadn't defclassed all java-classes that got extracted from
the MSC (Mobile Switch Control).
I attach the rule file content both before and after the modification
Any suggestions/clarifications?
erroneous file
<instance_all_tables>
(undefrule instance_all_tables)
(defrule instance_all_tables
"Rule which creates shadow facts for all existing tables in the current MSC"
(CurrentMSC ?currentMSC)
?currentTableIndexFact <- (CurrentTableIndex ?currentTableIndex)
(test (< currentTableIndex (call ?currentMSC getNumberOfItems)))
=>
(bind ?table (call ?currentMSC getTable ?currentTableIndex))
(bind ?tableType (call ?table getTableType))
(definstance (returnClassName (call ?table getClass)) ?table static)
(retract ?currentTableIndexFact)
(assert (CurrentTableIndex (+ ?currentTableIndex 1))))
EOF
Modified (hopefully correct) file
<instance_all_tables>
(undefrule instance_all_tables)
(defrule instance_all_tables
"Rule which creates shadow facts for all existing tables in the current MSC"
(CurrentMSC ?currentMSC)
?currentTableIndexFact <- (CurrentTableIndex ?currentTableIndex)
(test (< ?currentTableIndex (call ?currentMSC getNumberOfItems)))
=>
(bind ?table (call ?currentMSC getTable ?currentTableIndex))
(bind ?tableType (call ?table getTableType))
(definstance (returnClassName (call ?table getClass)) ?table static)
(retract ?currentTableIndexFact)
(assert (CurrentTableIndex (+ ?currentTableIndex 1))))
/best regards
Mikael Rundqvist
---------------------------------------------------------------------
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]
---------------------------------------------------------------------