SEMANTIC NETS ============= Introduction ------------ A Semantic Net consists of NODES and ARCS. An arc is used to express a relationship between the two nodes it connects. Thus, in the semantic net shown below, the nodes MAMMAL and WARM are connected by the arc BLOOD-TEMP. Alternatively, we could say that the MAMMAL is an OBJECT, with an ATTRIBUTE or PROPERTY: BLOOD-TEMP, which has a VALUE: WARM. BLOOD-TEMP MAMMAL ---------->----------- WARM | | ^ A-KIND-OF | | COLOUR ELEPHANT --------->----------- GREY | | ^ IS-A | | FAVOURITE-FOOD CLYDE ----------->---------- COOKIES In what follows, a relationship such as COLOUR ELEPHANT --------->----------- GREY will be represented simply as (ELEPHANT COLOUR GREY). With the semantic net above, the following queries about Clyde can be handled: Query Response ----- -------- (CLYDE COLOUR WHAT?) --> GREY * (CLYDE ISA MAMMAL) --> YES (CLYDE FAVOURITE-FOOD WHAT?) --> COOKIES (CLYDE BLOOD-TEMP WHAT?) --> WARM * (CLYDE ISA RIVER) --> NO The two responses marked with a * depend on inheritance, which is explained below. ---------- Inheritance ----------- There are two special types of arcs shown: IS-A and A-KIND-OF. IS-A denotes set membership: in the example shown above, CLYDE is a member of the set ELEPHANT. A-KIND-OF (often abbreviated to AKO) denotes set inclusion: the set ELEPHANT is a proper subset of the set MAMMAL. The A-KIND-OF slots form a tree structure or hierarchy. Properties are inherited through IS-A and A-KIND-OF: any member of a set inherits the properties of that set; thus, Clyde is grey in colour because he is an elephant. Also, sets inherit the properties of their supersets; thus, all elephants (including Clyde) are warm- blooded, because they are mammals. Objects may be members of several different sets, and set subsets of several different supersets: Clyde might be a circus performer in addition to being an elephant, and elephants are vegetarians as well as mammals. Other types of hierarchies are also possible, e.g. PART-OF. It might also be useful to inherit through properties which are NOT hierarchies, such as CONNECTED-TO: a pipe might ultimately be connected to itself, either directly or through some other pipes. Clearly, to retrieve or check an inherited value, search may be necessary. The details of the search process will be dealt with later, when we consider search strategies. ---------- Default Values -------------- Suppose we wish to know whether Porky, a prize pig, can fly. We know that pigs are mammals, and mammals cannot fly. Therefore, Porky cannot fly. But there is a snag here: some mammals (bats) can fly. It would be rather tedious to say that pigs, cows, dogs, cats, elephants, seals, whales, monkeys, and so on cannot fly. It would be worse if we decided to include people with pilots' licences. If someone doesn't have a pilot's licence, we would have to say so. Fortunately, there is a work-around. Defaults can be stored in the same way as values. The graph is searched from the most particular concepts upwards towards the most general, until the appropriate property is found. In the example below, it can be deduced that Tuxedo Sam cannot fly, as CAN-FLY has value NO on a object closer to TUXEDO-SAM (PENGUIN) than any object on which the same attribute has value YES (BIRD). CAN-FLY BIRD ------->----- YES | | ^ AKO | | CAN-FLY PENGUIN ------>----- NO | | ^ ISA | | TUXEDO-SAM ---------- Representing N-place Relations ------------------------------ So far, we have only been able to represent 2-place relations, i.e. those which can be represented in Predicate Calculus as attribute(object, value) It is easy to represent statements such as The favourite food of Clyde is cookies. Elephants are coloured grey. but less straightforward to represent statements such as John gave flowers to Mary. Professor Plum murdered Dr Black in the study with the rope last Thursday. These can both be represented in Predicate Calculus: gave(john, flowers, mary) murdered(plum, black, study, rope, thursday) To represent them in a semantic net, we need to define cases (similar to cases in inflective languages such as Latin or Russian), and add a node. First, note that the predicate calculus statements can be extended to isa(g1, give) ^ agent(g1, john) ^ object(g1, flowers) ^ recipient(g1, mary) isa(g2, murder) ^ agent(g2, plum) ^ object(g2, black) ^ location(g2, study) ^ instrument(g2, rope) ^ time(g2, thursday) Each of these 2-place relations can now be represented as an arc connecting two nodes in a semantic net, e.g. GIVE | | ^ ISA | AGENT | OBJECT JOHN -----<----- G1 ----->----- FLOWERS | | v RECIPIENT | | MARY ---------- Semantic Nets: Some Problems ---------------------------- It is sometimes difficult to know the meaning (semantics) of data held in a semantic net. When we talk about penguins, we can mean (1) The set of all Penguins. E.g. "Penguins live near the South Pole." (2) A particular penguin. "There is a penguin standing on my foot." (3) The word, "penguin". "Penguin" is derived from the Welsh words for "head" and "white". (4) The concept of a penguin. A penguin is a bird that cannot fly, but which swims very well. (5) We can even mean a chocolate biscuit. Worse still, arcs can have problems too: ISA and AKO are all too often confused. It is not clear whether or when an arc has an inverse, and so on. ---------- FRAME SYSTEMS ============= Introduction ------------ Frame systems are similar to semantic nets, but there are two important differences. One is a perception or "view" of them: whereas in a semantic network, the arcs are more important than the nodes, in a frame system, the nodes are more important. In a frame system, information is clustered about the nodes. The other, more important difference is that the procedural power of a frame system is contained in the frames themselves. In a semantic net, all of the procedural power is contained in the inference engine, and only data are held in the net itself. This "procedural attachment" is only possible in a language in which code and data can be mixed freely, such as LISP or Prolog. Languages such as C, Pascal or FORTRAN are unsuitable implementation languages for frame systems. ---------- Terminology ----------- The vocabulary used in frame systems is different from that used in semantic nets. Frames often represent "concepts". Each frame has several "slots", each with one or more "values". Values can be either data or procedures. If a value is a procedure, which is executed in response to a request for a value, or if a value is added or deleted, it is called a "demon". An example of a frame is given below: DAVE ---- ISA: (BOX TV-PERSONALITY) SHOW: "THE JASPER CARROT SHOW" LENGTH: 2.0 WIDTH: 1.5 HEIGHT: 1.0 There are three basic operations which can be performed on frames: (1) FGET(FRAME, SLOT) --> VALUE(S) FGET is a function which retrieves the values stored on the SLOT slot of the FRAME frame. FGET "knows" the format of the values: in the above example, DAVE's ISA slot can have multiple values, but his LENGTH slot is single-valued. (2) FPUT(FRAME, SLOT, VALUE) FPUT is a procedure which either replaces the value stored on the SLOT slot of the FRAME frame, or adds an extra value to the existing values on this slot, depending on whether the slot is single- or multi-valued. (3) FREMOVE(FRAME, SLOT, VALUE) FREMOVE is a procedure which deletes VALUE from the SLOT slot of the FRAME frame. ---------- Demons ------ Suppose we wish to know DAVE's VOLUME. There is, at present, no VOLUME slot on DAVE. DAVE's volume can easily be calculated, however: it is just the product of his LENGTH, WIDTH and HEIGHT slots. We can define an IF-NEEDED demon, which is activated whenever we wish to determine the volume of DAVE, or any other frame. VOLUME ------ ISA: (SLOT) FORMAT: SINGLETON IF-NEEDED: We have defined a frame to represent a slot. This is a simple example of metaknowledge, or "knowledge about knowledge". For example, we know that a frame can only have one value stored on its volume slot. Metaknowledge will be covered in more detail later. Now, when the value of the VOLUME slot of the DAVE frame is requested, FGET notices that it's not there explicitly, and so looks in the VOLUME frame for an IF-NEEDED slot. If one is found, it is evaluated and returned as the value of FGET(DAVE, VOLUME). IF-ADDED and IF-REMOVED slots can be also added to frames describing slots. For example, if DAVE's length slot were ever to change, it would be nice if an IF-ADDED demon were to check whether DAVE has a VOLUME slot, and if so, update it. Likewise, if DAVE's length slot were ever removed, his VOLUME slot should also be. FPUT and FREMOVE now check whether the frame describing the slot they are modifying has an IF-ADDED or IF-REMOVED slot respectively, and execute the demon attached to it, after putting or removing a value. ---------- Other Frame Systems ------------------- The frame system described above is based on RLL, developed by Greiner and Lenat. Other influential frame systems are KRL (Bobrow and Winograd), and FRL (Roberts and Goldstein). FRL has data stored in the format (FRAME SLOT FACET VALUE), where FRAME, SLOT and VALUE are as described above. A slot's FACET normally takes the values VALUE, DEFAULT or IF-NEEDED, etc. If no value is available on the VALUE facet of a slot, the DEFAULT facet is examined, and finally, perhaps, the IF-NEEDED slot. Incidentally, defaults can be represented in the frame system described earlier by adding a DEFAULT slot to a frame, e.g. BOX --- ISA: (CONTAINER) DEFAULT: (MATERIAL) MATERIAL: CARDBOARD The DEFAULT slot contains a list of slots on a particular frame whose values are not guaranteed. This is another example of metaknowledge. ---------- Object Oriented Systems ----------------------- Object oriented systems similar in many ways to frame systems. They contain "objects" (similar to frames), which can "send" messages to each other (this is something like FPUT). When a message is sent to an object, the sender does not have to worry about how the receiving object stores it. Objects have blocks of code called "methods" (similar to demons), which describe what can be done to the object. Several different objects might have different print methods. To print an object, you sent a message to it, telling it to print itself. The object then passes itself as a parameter to its own print method. Objects can be arranged into hierarchies, so that particular objects possess characteristics of their generalizations. ----------