[Next] [Up] [Previous]
Next: Exercises Up: Appendix: Inferences with a Previous: The connects Link

The isa Link

 

The new procedures are more powerful than the simple database ones, as we can now use them to carry out property inheritance via isa links. Given the following database,

 
[ 		 [animal has skin]

[bird isa animal]

[bird can fly]

[bird has wings]

[canary isa bird]

[canary can sing]

[canary colour yellow]

[tweetie isa canary]] -> database;

spresent can carry out inferences like

spresent([tweetie can fly])=>
** <true>

The spresent procedure works by recognizing the keyword isa in the the entries

[tweetie isa canary]
[canary isa bird]

and then associating the attributes of `bird' with `tweetie', as if the entry

[tweetie can fly]

was in the database.

The same kind of inference is also performed by sallpresent. just as spresent looks for single facts that are either in the database or that can be inferred from it, so sallpresent looks for collections of facts that are stored in, or can be inferred from, the database:

 
sallpresent([ 		 [tweetie has wings]

[tweetie has skin]

[tweetie can sing]]) =>

** <true>

For further examples, we shall use the property inheritance mechanism to work out the fare to any station from Victoria, given the fare zone of the station.

In order to work out the fare for a London Underground journey, we need to know certain facts. These are

  1. London Underground stations are grouped into `fare zones'.
  2. The fare for a journey depends on how many fare zones you pass through on the journey.
  3. If you are at Victoria, in Zone 1, and you want to go to a station in some other zone, the fare depends upon the zone you are going to.
  4. Starting from Victoria (which is in Zone 1), the fare to any station in Zone 2 is 60 pence, and the fare to any (other) station in Zone 1 is 40 pence.

We can represent this by a database containing entries with fares for particular fare zones, and the fare zone for each station.

[[zone1 station] fare [40 pence]]
[[zone2 station] fare [60 pence]]
[[green park] isa [zone1 station]]
[[picadilly circus] isa [zone1 station]
[IMAGE ]
[[shepherds bush] isa [zone2 station]
[[goodge street] isa [zone2 station]]
[[brixton] isa [zone2 station]]
[IMAGE ]

Now we can ask, ``Is the fare to Brixton 60 pence?'' or in POP-11

spresent([[brixton] fare [60 pence]])=>
** <true>

In semantic network terms, the [brixton] node has inherited the 60 pence fare property from the [zone2 station] node. It is more likely that the tourist in London will want to ask something like ``What is the fare to Brixton?'' in which case the argument to spresent will be a pattern containing a variable:

vars fare;
spresent([[brixton] fare ?fare])=>
** <true>

The value of the variable is the required fare:

fare =>
** [60 pence]

Providing that the database entries are in the form of triples, with the connects and isa links where appropriate, then the Tourist Guide as it stands so far can be altered to carry out inferencing simply by substituting spresent for present and sallpresent for allpresent within the answer procedure.


[Next] [Up] [Previous]
Next: Exercises Up: Appendix: Inferences with a Previous: The connects Link

Cogsweb Project: luisgh@cogs.susx.ac.uk