Pyke logic programming (13): Knowledge Base

Source: Internet
Author: User
Knowledge Base

A knowledge base is a named "repository" that stores structured knowledge ". The knowledge base is like the file directory on the hard disk, but the knowledge base structure cannot be nested. Therefore, the Knowledge Unit in the knowledge base has two-layer structure names: Knowledge Base name and Knowledge Unit name.

In a web server program, we may see some actual examples:

header.cookie('session=123456789;remember=the_alamo')cookie.session(123456789)cookie.remember(the_alamo)header.accept_encoding(gzip)header.accept_encoding(deflate)request.path('/my/site.html')request.path_segment(0, my)request.path_segment(1, 'site.html')request.path_segment(-2, my)request.path_segment(-1, 'site.html')

Note that there are three different knowledge bases (both the response Library) named header, cookie, and request, each with some fact statements.

The second part of the knowledge base name is the name of the Knowledge Unit. The knowledge unit can be considered as the type or topic of a fact statement:

  • Request:Knowledge Base name.
  • Request. path_segment:
    • The name of a knowledge unit or fact topic.
  • Request. path_segment (-1, 'site.html '):
    • A detailed statement about the theme request. path_segments of a knowledge unit.
Usage of Knowledge Base

In the end, Pyke aims to prove the authenticity of a fact statement. For example, to answer the question: "is a statement true ?". There are several different types of knowledge bases, and their usage is also different:

  • As shown in the preceding example, a series of simple fact statements are called the Statement Library.

    • They are known facts that can be used to test the authenticity of other statements.
  • A rule repository composed of if-then rules.
    • Run their if-then rules to determine whether a statement is true.
    • A rule repository can contain forward and reverse inference rules.
  • It may be necessary to use another knowledge base to determine the authenticity of the statement. Pyke has two countermeasures:
    • "Question Bank" refers to the statement that asks the end user.
    • A special knowledge base contains some knowledge units for one-time use to do special things. For example, run the underlying system command to check its output data and the exit status.
      • This knowledge base only provides an example called special.

The knowledge base name is dedicated. No matter whether it is of the same type or not, each knowledge base must use a separate name.

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: 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.