Home

Prolog knowledge base

E-mail Print
Share/Save/Bookmark
In Prolog there are three basic constructs: facts, rules, and queries. A collection of facts and rules is called a knowledge base (or a database).
The main advantage of Prolog is simple questions asking about the information stored in the knowledge base.

Prolog knowledge base example - facts

parent(tea, jan).
parent(rok, jan).
parent(rok, ida).
parent(jan, ana).
parent(jan, eva).
parent(eva, vid).
female(tea).
female(ida).
female(ana).
female(eva).
male(rok).
male(jan).
male(vid).

Prolog query example

female(tea).
Prolog answers
yes

Prolog knowledge base example - rules

mother(tea,jan):-female(tea), parent(tea, jan).
Tea is Jans mother if she is female and his parent.
Hits: 2226
Comments (0)Add Comment

Write comment

busy
Last Updated ( Wednesday, 27 August 2008 13:09 )  

Donate

Do you find content useful? Please donate so I can cover my hosting expenses! Thanks!