Module 3

Representing information, search strategies and simple rules


The previous Module introduced the structured object and showed how they could be used to store information in a similar way to a database. Queries with more than one goal were used to retrieve information held in more than one object. This module shows how rules can be written that encapsulate general knowledge within programs.

Representing information
This introduces a simple network that is used for several examples in these Modules. This part deals with how to represent the network as Prolog facts.

Route finding
This builds on material from Module 1, where it was shown that queries could be made up of several goals, linked to each other by the comma. In this part, it is shown that the routes can be found round the network by writing queries with one or more goals.

More general route finding
It is shown that it is possible to draw a diagram of all the possible routes through the network in the form of a tree. Two methods of working through the tree to find all the possible routes from a to b are given. These methods can be thought of as algorithms, and are commonly known as "breadth-first" and "depth-first".

Writing rules
Rules are introduced. They have a head followed by a body which could be made up of several goals, linked to each other by the comma. Prolog rules are gathered into procedures which are referred to by their functor and their arity.


Navigation Menu

These Pages are maintained by Dr Peter Hancox

Last updated October 1998