Artificial Intelligence · AI Foundations
Semantic Nets, Frames and Inheritance
In AI because a lot of authored knowledge is 'this kind of thing has these slots, and that kind inherits them' — a graph of concepts, not a pile of propositions.
The Propositional Logic lesson talks in whole sentences: 'the lab has a waiting list'. A lot of campus knowledge is not one sentence, it is a record: a course has a code, a credit load, an instructor, and a lab course is a course with an extra hours slot. Semantic nets and frames are the diagrams and records for that kind of knowledge. Inheritance is the rule that copies a slot down an IS-A chain until a more specific filler stops it. This lesson is those three ideas, on one campus catalogue, and where they stop being a proof.
- Artificial Intelligence
- Medium level
- 5 concepts
1Knowledge as a labelled graph
A proposition is a closed sentence. A semantic net is a graph whose nodes are concepts or individuals and whose edges carry a relation name: IS-A, HAS-A, TAUGHT-BY. 'CS201 is a Course' is one edge. 'CS201 is taught by Priya' is another. The same Priya node can be the instructor of two courses without writing her name twice.
The graph is the knowledge. Looking up a fact is walking an edge; adding a fact is adding an edge. That is why nets were the working notation of early knowledge systems: a registrar can read the picture, and a program can traverse it. It is not yet a logic — there is no definition here of what the graph entails, only of what it stores.
Figure. Three relations, two kinds of edge. CS201 and LabCourse both IS-A Course. CS201 is TAUGHT-BY Priya. IS-A is kind-of; TAUGHT-BY is a role. Topology only.
| Walk | Reads as |
|---|---|
| CS201 —IS-A→ Course | CS201 is a kind of Course |
| CS201 —TAUGHT-BY→ Priya | Priya teaches CS201 |
| LabCourse —IS-A→ Course | a lab course is a course |
2IS-A is not HAS-A
IS-A says one concept is a kind of another: a LabCourse is a Course, so everything true of courses is a candidate to be true of lab courses. HAS-A (or a role edge like TAUGHT-BY) says a whole has a part or a participant: a Course has an instructor, a LabCourse has lab hours. The two edges look similar on the page and mean different things.
The classic bug is to draw HAS-A where IS-A belongs, or the reverse. If you mark Priya IS-A Course, inheritance will later try to give her a credit load. If you mark LabCourse HAS-A Course, you have said a lab course contains a course, not that it is one, and the credit slot will not flow. Read every edge's label before you walk it.
| Edge | Says | Campus instance |
|---|---|---|
| IS-A | Kind-of — inherit slots | LabCourse IS-A Course |
| HAS-A / role | Part or participant | CS201 TAUGHT-BY Priya |
3A frame is a node with slots
A frame is the same node, written as a record. The concept Course has slots — named places waiting for a filler: code, credits, instructor. CS201 is a frame whose fillers are CS201, 3, Priya. A LabCourse frame adds a slot, labHours, and still has the Course slots because of the IS-A drawn already.
Slots can carry defaults (credits = 3 unless filled), constraints (credits is a positive integer), and procedures that run when a filler is read or written. This lesson stays on defaults and inheritance; the procedure attachments are how some 1980s tools turned a frame into a small program, and they are not required to understand the record.
The type frame names the slots; the individual frame fills them.
| Slot | Course (type) | CS201 (individual) |
|---|---|---|
| code | (unfilled) | CS201 |
| credits | default 3 | 3 |
| instructor | (unfilled) | Priya |
4Inheritance, defaults, exceptions
Inheritance is the walk: to fill a slot, look on this frame, then walk IS-A to the parent and look there, and so on. CS201 does not restate that a course has credits; it inherits the slot, and it may inherit the default 3. A LabCourse inherits code, credits and instructor, and adds labHours.
An exception is a more specific filler that stops the walk. The usual picture is animals, and it is the right one: Bird carries flies = yes as a default; Penguin IS-A Bird and fills flies = no. The default on Bird stays — swans still fly — and the penguin frame does not delete it. Specificity wins. Two parents that disagree (a course that is both a LabCourse and a Seminar with different credit defaults) is a conflict the walk cannot settle; the knowledge engineer has to pick, or the net is ambiguous.
Figure. Two IS-A children of Bird. Swan inherits flies = yes. Penguin stops the walk with flies = no. The parent default is unchanged. Labels carry the fillers; the figure is topology, not a cladogram to scale.
Does this penguin fly?
Bird has slot flies with default yes. Penguin IS-A Bird and fills flies = no. Swan IS-A Bird and does not fill flies. Ask flies on each.
- Swan: no local filler, walk IS-A to Birdyes (default)
- Penguin: local filler presentno (stops the walk)
- Bird default after the penguin exceptionstill yes
Pro tip. The exception is local. If you 'fixed' Bird to flies = no because of the penguin, every swan would break. Override down the chain; do not edit the parent to match one child.
5What a net cannot prove
A net is a convenient store for records and defaults. It does not, by itself, give you the entailment of the last logic lesson: there is no definition of a model of a net, and walking IS-A is not a sound proof procedure unless you add one. Multiple inheritance conflicts, default cancellation, and 'most birds fly' as a statistical claim are all places the picture stays readable and the conclusion is no longer forced.
Use frames when the knowledge is naturally a catalogue of kinds and slots — courses, parts, diagnoses with typical findings. Move to first-order logic, next lesson, when you need 'every student who borrowed this book is a person' as a sentence with a precise semantics. The Knowledge Engineering and Hybrid Systems lesson is where those stores get maintained, and where a learned model takes over the cases no slot list will cover. Do not clone that lesson here: this one owns the notation.
Bird has flies = yes. Penguin IS-A Bird and fills flies = no. A classmate edits Bird to flies = no 'so the net is consistent'. What did they break?
- The default that every other bird still uses — an exception is a local filler, not a rewrite of the parent
- The IS-A edge, which cannot point at a default
- Entailment, because nets cannot store exceptions
- The TAUGHT-BY role, which inheritance also walks
Specificity wins by stopping the walk on Penguin. The parent default stays for Swan and every other bird. Nets can store exceptions; they just do not turn that store into a proof on their own.
Notes
- A semantic net is a labelled graph: nodes are concepts or individuals, edges are relations.
- A frame is a node with named slots and fillers — a record the net can inherit along IS-A.
- Inheritance copies a slot down an IS-A chain until a more specific filler overrides it.
Exam traps & shortcuts
- IS-A is not HAS-A: a LabCourse is a Course; a Course has an instructor — mixing the two edges is the classic net bug.
- An exception (penguins do not fly) is a local filler, not a reason to delete the default on Bird.
- A net does not give you entailment for free — it is a convenient store, and the next lessons are the logics that can prove from one.
Recap
Next: first-order logic.
- Net
- Nodes are concepts or individuals; labelled edges are relations. The graph stores facts; it does not yet prove them.
- IS-A vs role
- IS-A is kind-of and the inheritance walk. TAUGHT-BY is a participant. Mixing them assigns credits to a person.
- Frame
- A node as a record of slots and fillers. Types name slots; individuals fill them.
- Inheritance
- Walk IS-A until a filler appears. An exception is local; it does not rewrite the parent default.
Practise Semantic Nets, Frames and Inheritance
Reading is free and needs no account. Practice, mocks and progress live in the app.
- 1 quick check with worked explanations
- Timed mocks scored with the real marking scheme
- Readiness tracked per topic, kept on your device