Introduction
Semantic networks and frames provide intuitive, structured approaches to representing knowledge. Rather than using pure logic, these formalisms organize knowledge into networks of concepts and relationships (semantic networks) or object-oriented structures with properties (frames). This article explores these representation methods and their applications.
Semantic Networks
Structure
Nodes: Concepts or entities Edges: Relationships between concepts Labels: Describe relationship types
Example:
Dog
โ is-a
Fido
โ color
Brown
Relationship Types
is-a: Inheritance relationship part-of: Composition relationship has-property: Attribute relationship related-to: General relationship
Inference
Inheritance: Properties inherited from parent concepts Spreading Activation: Activate related concepts
Example:
Dog is-a Animal
Animal has-property breathes
Therefore: Dog has-property breathes
Therefore: Fido has-property breathes
Frames
Structure
Frame: Object-oriented representation Slots: Attributes or relationships Values: Specific values or constraints Defaults: Default values for slots
Example:
Frame: Dog
Slots:
- species: Canine
- legs: 4
- sound: bark
- color: (any)
- owner: (any Person)
Inheritance
Single Inheritance: Frame inherits from one parent Multiple Inheritance: Frame inherits from multiple parents
Example:
Frame: ServiceDog
Inherits from: Dog, WorkingAnimal
Slots:
- training: specialized
- handler: Person
Demons (Triggers)
Idea: Procedures triggered when slot accessed or modified
Example:
Frame: BankAccount
Slots:
- balance: number
- deposit: (trigger: update-balance)
- withdraw: (trigger: check-sufficient-funds)
Comparison
| Aspect | Semantic Networks | Frames |
|---|---|---|
| Structure | Graph | Object-oriented |
| Expressiveness | Limited | More expressive |
| Efficiency | Good for queries | Good for inheritance |
| Intuitiveness | Visual | Structured |
| Reasoning | Spreading activation | Slot-based |
Practical Example: University Domain
Semantic Network
University
โโ has-part โ Department
โโ has-part โ Library
โโ employs โ Faculty
โโ enrolls โ Student
Department
โโ part-of โ University
โโ offers โ Course
โโ employs โ Faculty
Faculty
โโ employed-by โ Department
โโ teaches โ Course
โโ advises โ Student
Student
โโ enrolled-in โ University
โโ takes โ Course
โโ advised-by โ Faculty
Frames
Frame: University
Slots:
- name: string
- location: string
- departments: list of Department
- faculty: list of Faculty
- students: list of Student
Frame: Department
Inherits from: Organization
Slots:
- name: string
- university: University
- faculty: list of Faculty
- courses: list of Course
- budget: number
Frame: Faculty
Inherits from: Person
Slots:
- faculty-id: string
- department: Department
- courses: list of Course
- students-advised: list of Student
- office: string
- phone: string
Frame: Student
Inherits from: Person
Slots:
- student-id: string
- university: University
- major: Department
- courses: list of Course
- advisor: Faculty
- gpa: number
Advantages and Disadvantages
Semantic Networks
Advantages:
- Intuitive visual representation
- Efficient for certain queries
- Natural for hierarchical knowledge
Disadvantages:
- Limited expressiveness
- Ambiguous semantics
- Difficult to handle complex constraints
Frames
Advantages:
- Organized, structured representation
- Supports inheritance
- Efficient for property lookup
Disadvantages:
- Limited reasoning capabilities
- Complexity with multiple inheritance
- Difficult to handle exceptions
Glossary
Demon: Procedure triggered by slot access Frame: Object-oriented knowledge representation Inheritance: Property inheritance from parent Semantic Network: Graph-based knowledge representation Slot: Attribute or relationship in frame Spreading Activation: Activate related concepts
Practice Problems
Problem 1: Create a semantic network for a restaurant domain.
Solution:
Restaurant
โโ serves โ Food
โโ has โ Menu
โโ employs โ Staff
โโ located-in โ City
Food
โโ served-by โ Restaurant
โโ has-ingredient โ Ingredient
โโ is-type โ CuisineType
Problem 2: Design frames for a library system.
Solution:
Frame: Library
Slots:
- name: string
- location: string
- books: list of Book
- members: list of Member
Frame: Book
Slots:
- title: string
- author: string
- isbn: string
- copies: number
- available: number
Frame: Member
Slots:
- member-id: string
- name: string
- borrowed-books: list of Book
- max-books: 5
Problem 3: Explain how inheritance works in frames.
Solution: A frame can inherit slots from a parent frame. If a slot is not defined in the child frame, it uses the parent’s definition. This allows code reuse and organization.
Related Resources
- Semantic Networks: https://en.wikipedia.org/wiki/Semantic_network
- Frames: https://en.wikipedia.org/wiki/Frame_(artificial_intelligence)
- Knowledge Representation: https://en.wikipedia.org/wiki/Knowledge_representation_and_reasoning
- Ontologies: https://en.wikipedia.org/wiki/Ontology_(information_science)
- Inheritance: https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)
- Graph Databases: https://en.wikipedia.org/wiki/Graph_database
- Object-Oriented Programming: https://en.wikipedia.org/wiki/Object-oriented_programming
- AI: https://en.wikipedia.org/wiki/Artificial_intelligence
- Expert Systems: https://en.wikipedia.org/wiki/Expert_system
- Knowledge Graphs: https://en.wikipedia.org/wiki/Knowledge_graph
- Reasoning: https://en.wikipedia.org/wiki/Automated_reasoning
- Logic Programming: https://en.wikipedia.org/wiki/Logic_programming
- Formal Methods: https://plato.stanford.edu/entries/formal-methods/
- Data Structures: https://en.wikipedia.org/wiki/Data_structure
- Databases: https://en.wikipedia.org/wiki/Database
Conclusion
Semantic networks and frames provide intuitive, structured approaches to knowledge representation. While less formally rigorous than pure logic, they offer practical advantages for organizing and reasoning about knowledge in AI systems.
Understanding these representation methods is essential for anyone working with knowledge bases, ontologies, or AI systems. The combination of semantic networks and frames with logical reasoning creates powerful knowledge representation systems.
Comments