|
WWWGENI - An expert system on the WEBIn the Visual Prolog subdirectory WWW\WWWGENI on the Visual Prolog distribution CD-ROM you will find an example that show how to create a small expert system that works on the Internet as a CGI Script through a WEB server. You can try out this example on the Visual Prolog homepages by clicking Demo examples and Geni. GENI is an extremely simple knowledge representation also shown under \TXTEXAMP and VPI\PROGRAMS. In GENI there are some rules that are satisfied if a number of conditions are true. 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 that is 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 running a recursive procedure. 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 to store the states as hidden fields in the HTML form which are sent to the browser each time an anwer is returned from the application. So it is the user who carries the information from page to page. As the CGI program GENI.EXE is restarted each time an answer is recieved, 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 asserts 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. The following is a summary of the operations of GENI on the WEB (take a look at the source code):
The result of running the inference engine is 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. One of the special feaures in expert systems is the possibility of asking 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. |