Hi Jason,
thanks for your answer, one of errors I get
is throwed when I try to assert the next fact: (MAIN::call-method (id "13") (template call-method) (parent-method-id
"9") (parent-id "12") (params "10")).
Error Message is:
Jess reported an error in routine factid while executing (fact-id ?fact) while executing deffunction fact-slot-value while executing (fact-slot-value (fact-id ?fact) template) while executing (eq (fact-slot-value (fact-id ?fact) template) imple-method) while executing (or (eq (fact-slot-value (fact-id ?fact) template) imple-method) (eq (fact-slot-value (fact-id ?fact) template) global-method)) while executing (if (or (eq (fact-slot-value (fact-id ?fact) template) imple-method) (eq (fact-slot-value (fact-id ?fact) template) global-method)) then (return ?fact) else (if (eq (fact-slot-value (fact-id ?fact) template) class) then (return "-1") else (bind ?p-id (fact-slot-value (fact-id ?fact) parent-id)) (get-method-id ?p-id))) while executing deffunction get-method-id while executing (get-method-id ?p-id) while executing (if (eq (fact-slot-value (fact-id ?fact) template) class) then (return "-1") else (bind ?p-id (fact-slot-value (fact-id ?fact) parent-id)) (get-method-id ?p-id)) while executing (if (or (eq (fact-slot-value (fact-id ?fact) template) imple-method) (eq (fact-slot-value (fact-id ?fact) template) global-method)) then (return ?fact) else (if (eq (fact-slot-value (fact-id ?fact) template) class) then (return "-1") else (bind ?p-id (fact-slot-value (fact-id ?fact) parent-id)) (get-method-id ?p-id))) while executing deffunction get-method-id while executing (get-method-id ?parent-id) while executing (str-compare (get-method-id ?parent-id) (get-method-id ?param-id)) while executing (= (str-compare (get-method-id ?parent-id) (get-method-id ?param-id)) 0) while executing 'test' CE // The above functions are part of my rules, but the engine should not be running.... while executing rule LHS (Node2) while executing rule LHS (MTELN) while executing rule LHS (TECT). Message: No such fact-id: -1. at jess.MakeFactID.call(MiscFunctions.java:817) at jess.FunctionHolder.call(FunctionHolder.java:30) at jess.Funcall.execute(Funcall.java:266) at jess.FuncallValue.resolveValue(FuncallValue.java:33) at jess.Deffunction.call(Deffunction.java:164) at jess.FunctionHolder.call(FunctionHolder.java:30) at jess.Funcall.execute(Funcall.java:266) at jess.FuncallValue.resolveValue(FuncallValue.java:33) at jess.Eq.call(Funcall.java:1072) .......... on the follow engine status: ID: 0 (MAIN::initial-fact) ID: 1 (MAIN::default-type (id "1") (template default-type) (parent-id "-2") (name "E")) ID: 2 (MAIN::default-type (id "2") (template default-type) (parent-id "-2") (name "R")) ID: 3 (MAIN::default-type (id "3") (template default-type) (parent-id "-2") (name "N")) ID: 4 (MAIN::default-type (id "4") (template default-type) (parent-id "-2") (name "Cadena")) ID: 5 (MAIN::default-type (id "5") (template default-type) (parent-id "-2") (name "Objeto")) ID: 6 (MAIN::global-method (id "6") (parent-id "-1") (template global-method) (name "imprimir") (returned-type "-1") (params "7")) ID: 7 (MAIN::parameter (id "7") (template parameter) (parent-id "6") (name "cadena") (type "4") (value nil)) ID: 8 (MAIN::class (id "8") (template class) (name "Clase") (implementation-method "9") (field "11")) ID: 9 (MAIN::imple-method (id "9") (template imple-method) (method "-1") (name "metodo") (parent-id "8") (returned-type "1") (params "10") (body )) ID: 10 (MAIN::parameter (id "10") (template parameter) (parent-id "9") (name "param") (type "1") (value nil)) ID: 11 (MAIN::imple-field (id "11") (template imple-field) (name "field") (parent-id "8") (type "1") (value nil)) I get similar errors messages sometimes (these
errors are not shown always) when I modify facts. I modify and add facs from the
next java methods:
// To assert facts
public static void assertFact(Fact
f){
try { // This call is not outstanding f.setSlotValue("id",new Value(FactIdProvider.INSTANCE.getNewFactId(),RU.STRING)); engine.assertFact(f); facts.addFact(f); } catch (JessException e) { System.err.println( "Se produjo un error afirmando el hecho: " + f.toString()); e.printStackTrace(); } } // To modify slot values
public static void setSlotValue(
int factId, String slotName, String slotValue) { try { // Si esta vacio se establece a 'espacio en blanco' if (slotValue.equals("")){ slotValue = " "; } // Se ejecuta la
sentencia
engine.executeCommand( "(modify " + factId + " (" + slotName + " " + slotValue + "))"); } catch (JessException e) { System.err.println( "FactID como int: Se ha producido un error estableciendo el valor del slot " + slotName + " del hecho con id " + factId + " al valor " + slotValue); e.printStackTrace(); } } I hope this source code to help you to understand
what I'm trying to do, thanks againg,
Felix.
|
- JESS: Problem with Jess wake up in multi-threaded en... Steven Goncalo
- Re: JESS: Problem with Jess wake up in multi-th... ejfried
- JESS: How to stop firing rules (again) Félix Gómez Cordero
- Re: JESS: How to stop firing rules (again) Jason Morris
- Re: JESS: How to stop firing rules (aga... Félix Gómez Cordero
- Re: JESS: How to stop firing rules ... ejfried
- Re: JESS: How to stop firing r... Félix Gómez Cordero
- Re: JESS: How to stop firi... ejfried
- Re: JESS: How to stop ... Félix Gómez Cordero