Introspector/KifTutorial

This is a short example based tutorial of Knowledge Interchange Format. It's not complete nor very correct, but it should give you an idea about what you can do with KIF.

The knowledge base I'm using here is a simple representation of human relations. Basically two types of relation exist: family and friends. There are three kinds of family: father, mother, child. There is only one kind of friend. For our purposes partners are also friends. Let's start by entering some data:

Now to querying, getting information from the knowledge base. Here are a few queries with their result behind the =>.

(male Fred) => true
(female John) => false

That were simple queries that only return true or false. Note that your implementation may display the results in a different way (since I'm not using an interpreter at all (except my brains) while writing this it's kinda logical actually).

(male ?x) => ?x = Fred, ?x = John

Here we ask the system: for each object (known as ?x for now) in the universe of discourse the set which contains every object that exists) that is a male ((male ?x) => true) tell me what the value of ?w is.

Now to 'bottom'. Sometimes you want to say: this can be anything, but I don't care what it is. KIF supports this through bottom. If you write bottom you're saying: this can be anything, but you will not be informed of what it is. For example: