Here is my problem with (facts) function :
(I use color to differenciate execution traces in black  from comments in blue.
I hope it is convenient ;-)
-------------------Execution trace
>java jess.Main

Jess, the Java Expert System Shell
Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation
Jess Version 5.0a4 3/18/99

Jess> (deffacts idle-fact (idle))
TRUE
Jess> (facts)
For a total of 0 facts.
Jess>
--------------------------------

Why (idle) fact is not taken into account ?

Second try :
-----------------------------------
Jess> (defrule facts-try
        ?idle <- (idle)
=>
        (facts)
        (retract ?idle)
)

TRUE
Jess> (run)
0
Jess> (assert (idle))
<Fact-0>
Jess> (run)
f-0   (idle)
For a total of 1 facts.
1
Jess>
--------------------------------

Third try , the same rule "facts-try" is used in a bigger program, in which
several user-modules are loaded using the suggested method :

------------------
String [] packages = { "jess.StringFunctions",
                         "jess.PredFunctions",
                         "jess.MultiFunctions",
                         "jess.MiscFunctions",
                         "jess.MathFunctions",
                         "jess.BagFunctions",
                         "jess.reflect.ReflectFunctions",
                         "jess.view.ViewFunctions" };

   for(int i=0; i< packages.length; i++) {
  try {
   rete.addUserpackage((Userpackage)
        Class.forName(packages[i]).newInstance());
  } catch (Throwable t) {
    /* Optional package not present */
    System.err.println("WARNING : package " + packages[i] + "not present.");
  }
-----------------------
And it produces the following trace :
-----------------------
FIRE facts-try f-1
Rete Exception in routine Context::expandAction while executing defrule facts-try.
  Message: Unimplemented function facts at line 0:  ( run 1 ) .
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Compiled Code)
        at jess.ReteException.<init>(ReteException.java:29)
        at jess.Context.expandAction(Compiled Code)
        at jess.Defrule.fire(Compiled Code)
        at jess.Activation.fire(Activation.java:60)
        at jess.Rete.run(Compiled Code)
        at jess.HaltEtc.call(Funcall.java:1591)
        at jess.Funcall.simpleExecute(Funcall.java:341)
        at jess.Funcall.execute(Compiled Code)
        at jess.Funcall.execute(Funcall.java:201)
        at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1413)
        at jess.Jesp.parseSexp(Jesp.java:171)
        at jess.Jesp.parse(Compiled Code)
        at jess.Rete.executeCommand(Rete.java:1347)
        at InteractionManager.run(Compiled Code)
------------------------------------

Any hints are welcome,
Olivier Causse --------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list. List problems? Notify [EMAIL PROTECTED] ---------------------------------------------------------------------

Reply via email to