Appendix: Inferences with a Semantic Net

Writing a simple semantic net program in Prolog -- that is, a program that will represent hierarchically structured facts and that will perform the kind of inferencing we have been considering -- is fairly straightforward. We first of all need to translate the facts into Prolog, and we can do this by assuming that links express relations between nodes, as is illustrated in figure 6.9. below:

Figure 9.

This is in fact exactly the practice we have followed for the examples in the previous chapters. We could easily have sketched out an ad hoc semantic network to represent facts about nearest underground stations (underground), proximity of locations (near), and containment (in). Only certain keywords, however, will enable inferences to be made; the ones we shall be using in the examples are connects and isa. In this section we shall not make a distinction between isa and inst links, though often it is wise to do so, as in some interpretations of nodes there may be properties of classes that will not also always be properties of individuals. For example, though we know that underground trains (in general) run regularly between Hammersmith and Upminster, and that train_119 is a train, we would not want to deduce that train_119 also runs regularly between Hammersmith and Upminster.

Our semantic net, then, will contain statements of the following form:

isa('the National Gallery', gallery).
isa('Westminster Abbey', church).
[@to be completed]