Jess, Java Expert System Shell

Extendable

can be extended using Userfunction

Embeddable

can embeded in a Java program:
    import jess.*;
    public class ExPt
    {
        public static void main(String[] unused) throws JessException
        {
            Rete r = new Rete();
            r.executeCommand("(batch jess/scriptlib.clp)");
            r.executeCommand("(deftemplate point \"A 2D point\" (slot x) (slot y))");
            r.executeCommand("(assert (point (x 37) (y 49)))");
            r.executeCommand("(facts)");
        }
    }

Executing a Jess File

    import jess.*;

    // ...

    // Create a Jess engine
    Rete rete = new Rete();

    // Open the file test.clp
    FileReader fr = new FileReader("test.clp");

    // Create a parser for the file, telling it where to take input
    // from and which engine to send the results to
    Jesp j = new Jesp(fr, rete);
    try
    {
        // parse and execute one construct, without printing a prompt
        j.parse(false);
    }
    catch (ReteException re)
    {
        // All Jess errors are reported as 'ReteException's.
        re.printStackTrace(rete.getErrStream());
    }

Example 1: fixed rule-base file name

Example 2: user-specified rule-base file name

Object Support

Create and manipulate Java objects directly from Jess,
   (bind ?ht (new java.util.Hashtable))
   (call ?ht put "key1" "element1")
   (call ?ht put "key2" "element2")
   (call ?ht get "key1")

Run-time Environment

1. Command Line

    java jess.Main

2. Graphics Console

    java jess.Console

3. Applet Console

4. Servlet Console

Jess Examples

Previous Message Handlers   Up TOC   Next Object Support