You are on page 1of 24

Semantic Networks

The idea behind a semantic network is that knowledge is often best understood as a set of concepts that are related to one another.
The meaning of a concept is defined by its relationship to other concepts. A semantic network consists of a set of nodes that are connected by labeled arcs. The nodes represent concepts and the arcs represent relations between concepts.

Common Semantic Relations

There is no standard set of relations for semantic networks, but the following relations are very common: INSTANCE: X is an INSTANCE of Y if X is a specific example of the general concept Y. Example: Elvis is an INSTANCE of Human
ISA: X ISA Y if X is a subset of the more general concept Y. Example: sparrow ISA bird

HASPART: X HASPART Y if the concept Y is a part of the concept X. (Or this can be any other property) Example: sparrow HASPART tail

Inheritance is a key concept in semantic networks and can be represented naturally by following ISA links. In general, if concept X has property P, then all concepts that are a subset of X should also have property P. But exceptions are pervasive in the real world! In practice, inherited properties are usually treated as default values. If a node has a direct link that contradicts an inherited property, then the default is overridden.

Multiple Inheritance
Multiple inheritance allows an object to inherit properties from multiple concepts. Multiple inheritance can sometimes allow an object to inherit conflicting properties. Conflicts are potentially unavoidable, so conflict resolution strategies are needed.


d o g


Representing Events
Jack kidnapped Billy on August 5
Kidnapping Event Kidnap1 perpetrator: Jack victim: Billy date: August 5

Representing predicates
score(Mavs, Bulls, 120-101)
Game Instance: Game17 hometeam: Mavs Visiting team: Bulls Score: 120-121

Representing Relations
height Height1 greater-than

height height2

A frame represents an entity as a set of slots (attributes) and associated values. Each slot may have constraints that describe legal values that the slot can take. A frame can represent a specific entity, or a general concept. Frames are implicitly associated with one another because the value of a slot can be another frame.

Mammal isa: ANIMAL *haspart: HAIR *breathes: AIR

NBA_BASKETBALL_PLAYER isa: ADULTMALE cardinality: 400 *height: > 6' *salary: > $200,000

HUMAN isa: MAMMAL cardinality: 6 million *haspart: LEGS(2) ADULTMALE isa: HUMAN cardinality: 2 million *gender: male



An asterisk (*) means that the slot can be inherited.

One of the main advantages of frames is the ability to include demons to compute slot values. A demon is a function that computes the value of a slot on demand.
HUMAN isa: (MAMMAL) mortal: (yes :inheritable yes) cardinality: (6 million :inheritable no) age: (:inheritable yes :demon compute_age) MARY instance: HUMAN gender: FEMALE birthday: 11/04/60 int Compute_Age (frame) return(today- (query birthday slot));

Features of Frame Representations

Frames can support values more naturally than semantic nets (e.g. the value 25) Frames can be easily implemented using object-oriented programming techniques. Demons allow for arbitrary functions to be embedded in a representation. But a price is paid in terms of efficiency, generality, and modularity! Inheritance can be easily controlled.

Comparative Issues in Knowledge Representation

The semantics behind a knowledge representation model depends on the way that it is used (implemented). Notation is irrelevant!
Whether a statement is written in logic or as a semantic network is not important -- what matters is whether the knowledge is used in the same manner.

Most knowledge representation models can be made to be functionally equivalent. It is a useful exercise to try converting knowledge in one form to another form. From a practical perspective, the most important consideration usually is whether the KR model allows the knowledge to be encoded and manipulated in a natural fashion.

Expressiveness of Semantic Nets

Some types of properties are not easily expressed using a semantic network. For example: negation, disjunction, and general non-taxonomic knowledge. There are specialized ways of dealing with these relationships, for example partitioned semantic networks and procedural attachment. But these approaches are ugly and not commonly used. Negation can be handled by having complementary predicates (e.g., A and NOT A) and using specialized procedures to check for them. Also very ugly, but easy to do. If the lack of expressiveness is acceptable, semantic nets have several advantages: inheritance is natural and modular, and semantic nets can be quite efficient.

As we stated before, semantic networks and frames are often used because inheritance is represented so naturally. But rule based systems can also be used to do inheritance! How?
Semantic networks (and frames) have an implementation advantage for inheritance because special-purpose algorithms can be used to follow the ISA links.

Comparative Summary
Rules are appropriate for some types of knowledge, but do not easily map to others. Semantic nets can easily represent inheritance and exceptions, but are not wellsuited for representing negation, disjunction, preferences, conditionals, and cause/effect relationships. Frames allow arbitrary functions (demons) and typed inheritance. Implementation is a bit more cumbersome.

And just when you thought it was safe to go out.Networks cont. (implementation)
We see hierarchical organizations in the real world all the time. They may not be "pure" hierarchies, but they're hierarchical in spirit at least. It might be easier to think of these things as "networks" instead of hierarchies. Take for example the common dictionary. At first glance, it looks like a very linear organization of the words in our language. But what a dictionary really specifies is a very complex and somewhat hierarchical map of the relationships between the words in our language. Here are some sample definitions:

dog: any of a large and varied group of domesticated animals related to the fox, wolf, and jackal chihuahua: any of an ancient Mexican breed of very small dog with large, pointed ears bird: any of a class of warm-blooded, two-legged, egg-laying vertebrates with feathers and wings penguin: any of an order of flight-less birds found in the Southern Hemisphere, having webbed feet and paddle-like flippers for swimming and diving ostrich: a large, swift-running bird of Africa and the Near East; the largest and most powerful of living birds; it has a long neck, long legs, two toes on each foot, and small useless wings canary: a small yellow songbird of the finch family, native to the Canary Islands

Notice that these definitions all relate the thing being defined to some larger class of things, and then goes on to try to distinguish that thing from other similar things. Note also that as the things being described stray further and further from what we might think of as being norms or stereotypes, the definitions get longer and more detailed. For example, compare the canary (a stereotypical bird) to an ostrich (an extremely non-stereotypical bird). When we take the time to look at the dictionary in this way, we uncover what is essentially a bunch of pointers from one word to others.

In any case, we can use our high-level data abstraction, the directed graph, to make these relationships a bit more visual. For example, from the bird definitions, we can construct the following abstraction:
vertebrate ^ | is-a has-part /------------- wings / reproduction | /--------------- egg-laying | / body-temp | /----------------- warm-blooded bird--< no. of legs ^ ^ ^ \----------------- 2 / | \ \ covering is-a / | \ \--------------- feathers / | \ \ movement color / | \ \------------- flight yellow ------canary size / | is-a \ is-a small -----/ | \ movement | ostrich---------- run movement | \ size swim ----------penguin \--------- big |

How to represent your networks in LISP

Hey, it's simple. Use an association list. (defun *database* () '((canary (is-a bird) (color yellow) (size small)) (penguin (is-a bird) (movement swim)) (bird (is-a vertebrate) (has-part wings) (reproduction egg-laying) ) ))

You'd use the "assoc" function with a key of "canary" to extract all the information about the "canary" type.

OrAs property lists

(setf (get 'bird 'isa) 'mammal) MAMMAL
CL-USER 3 > (setf (get 'mammal 'has-a) 'feet-2) FEET-2

ThenGetting the properties and values

defun get-object (obj prop) (cond ((equal (get obj 'has-a) prop) t) (t (get-object (get obj 'isa) prop))))
(get-object 'bird 'feet-2) T