Web expert system for Visual Prolog (2)

Source: Internet
Author: User
Tags knowledge base

Web Expert System Wwwgeni

In the catalogue <Vip_root>\www\programs\geni, there is a case that shows how to create a small expert system that works on the internet with CGI scripts supported by a Web server.
GENI uses very simple rules to express knowledge, and these rules apply when certain conditions are met.

Rule (1, "Carnivore", "Cheetah", [Up], "")
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 is mainly used for the classification of things. Its goal is to describe things, not to implement advanced deductive engines. However, with its working principle, it can also build a complex expert system shell, which functions like the visual Prolog's own tool ESTA.

Geni has 3 Knowledge base (*. GNI files), involving animals, car start-up, tires, and other issues.

Non-network version of the Geni, question and answer, in a recursive manner. You cannot do this in a network version that uses CGI scripts. Because, in the question and answer consultation process, the CGI script work is intermittent incoherent. The biggest problem is how to save intermediate data for the consulting process

The existing solution is to save each user's answer in the hidden type variable of the Web page form. These intermediate data are passed backward by page. This CGI program GENI.EXE, each time you receive a user answer to start again, you must use the hidden variable to save the data, reinitialization. These intermediate data, retrieved by the predicate cgi_getstring and assert_conditions by the predicate, add the yes/no answer to the fact base. The fact base holds the previously answered conclusion, which is the precondition for the next inference.

The initial hidden variable, specifying the Knowledge base. The name of the GNI file. This is a necessary document for the consultation process.

The Web version Geni performs the following tasks (see Cheng code):

    1. Use predicate cgi_getstring to get the relevant CGI variable string.
    2. Converts the string to a list of structure data consisting of "name, value".
    3. Query the Knowledge Base. The knowledge base name, specified by the first hidden variable.
    4. The value of the relevant hidden variable is stored in the fact database as a precondition for further reasoning.
    5. Restart the inference engine.

The result of the inference machine running produces an HTML page containing a Hedden variable in the Form,form, and a query about the next inference precondition.

If the inference conclusion is obtained, Geni will generate the end page and give the result of the consultation.

Based on the reasoning prerequisites, new queries are constructed using HTML files or parts of the code.

A feature of the expert system, the user has the right to understand why the system is asking a question. The answer to this question, Geni, is to show the inference rules it is using, and the reasoning prerequisites that the user has previously answered.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.