WWWGENI - An expert system on the WEB

In the <VIP_root>\ WWW\Programs\GENI sub-directory you will find an example, that demonstrates, how to create a little expert system that works on the Internet as a CGI Script through a WEB server.
GENI is extremely simple knowledge representation also shown under \TXTEXAMP and VPI\PROGRAMS, where there are some rules that are satisfied if a list of conditions are true.

rule(1,"carnivore","cheetah",[1,2],"")
rule(2,"carnivore","tiger",[1,3],"")
rule(3,"ungulate","giraffe",[5,2,4],"")
cond(1,"it has tawny color","")
cond(2,"it has dark spots","")
cond(3,"it has black stripes","")

GENI can primarily be used for classification. The goal of GENI is to illustrate, how things are working, not to implement an advanced inference engine. However the same principles can be used to build more complex shells like the ESTA expert system included with Visual Prolog.

The example is supplied along with 3 knowledge bases (*.GNI files): Animals , Starting and Tyreproblem.

In the non-web based version of GENIE, questions are asked and answers given while the program is using recursion. This is not possible, when working, with a GCI script, on the net, because a CGI program cannot run constantly during the consultation. The big problem is how and where to store the previous state of the consultation!

The solution used here is that the state stored as hidden fields in the HTML form which are sent to the browser each time an answer is returned from the application. So it is the user who carries the information from page to page. When the CGI program GENI.EXE is restarted each time an answer is received, it must reinitialize the answers from the hidden parameters. The list of parameters is retrieved by the predicate call cgi_GetString, and the call to assert_conditions assert yes/no facts for all previous answered conditions.

The very first hidden parameter specifies the name of the knowledge base as a .GNI file which must be consulted.

A summary of the operation of GENI on the WEB is: (Take a look at the source code)

  1. Retrieve the CGI parameter list cgi_GetString.
  2. Convert the String to a list of parameter names together with values.
  3. Consult the knowledge base specified in the first hidden parameter.
  4. Assert the conditions from the hidden parameters.
  5. Re-invoke the inference engine.

The result of running the inference engine is that it writes out an HTML page which contains a FORM with the hidden parameters and the question relating to the next condition.

When a solution is found GENI writes a final HTML page containing an answer.

For each condition it is possible to specify either some HTML code or a file in order to customize the question.

A specialty of expert systems is that it must be possible to ask WHY. In this case GENI prints out the rules it is using and the conditions already answered.

We send our special thanks to Mr. Leo Jensen, who is the head of Prolog Development Center, and who was very helpful to us during this project.

The students :

Abdirazak Hersi, Throstur Gudmundsson and Niels Hass.