190 likes | 724 Views
CLASS FRAME. INSTANCE FRAME. Frame Name. Frame Name. Bird. Tweety. Properties. Properties. Frame-Based Representation. Frame : stereotypical knowledge knowledge of some concept. Frames. Hold Structure and Behavior of a class of objects/concepts Structure
E N D
CLASS FRAME INSTANCE FRAME Frame Name Frame Name Bird Tweety Properties Properties Frame-Based Representation Frame: stereotypical knowledge knowledge of some concept.
Frames • Hold Structure and Behavior of a class of objects/concepts • Structure properties/data/attributes • Behavior methods, rules defining how instances of the class typically behave • Generic structure and behavior defines at class level is specified in instances
Birds Canaries Sparrows Robins Bird1 Bird2 Bird3 Bird4 Bird5 Bird6 Inheritance • Structural and behavioral properties are inherited • from super-class to sub-classes • subclasses automatically carry the structure an behavior of super-class • exception handling (birds fly, but penguins do not) • multiple inheritance
class Bird color eats flies ... class Pet name veterinarian ... class Person age weight ... class Employee phone# salary ... class PetBird color eats flies name veterinarian talks ... Instance Jack age weight phone# salary Multiple Inheritance
Facets • Facets provide further information on a property/attribute • define constraints on property value (data type, range of values, etc.) • how to obtain a value for a property (IF-NEEDED method) • what to do if a value changes (IF-CHANGED method)
Properties and Facets: Example Object name: Refrigerator Class: Home Appliances - Initialize - from Database - from Procedure - Expert Rules - User specified - by Inheritance - Message passing from other objects
Communication between objects IF-CHANGED methods Defrost Timer Refrigerator Heating Coil
Rule Interaction with Objects • Frame properties as data IF Humans.Legs = 2 IF Jack.Legs=2 THEN humans can walk THEN Jack can walk • Modifying a property value IF Jack likes to swim THEN Jacks.Sports = swimming • Creating a new instance IF Lucy is mad at Jack because he doesn’t like hiking THEN MAKE Frame Bob Instance-of Humans WITH Sports = Hiking • Deleting a frame IF Lucy is really mad at Jack THEN RETRACT Frame Jack
Humans Bob Jack Lucy
?xx denotes variable Frame ?x instance-of Humans WITH Residence = Pittsburgh WITH Age = ?Age IF Frame ?x instance-of Humans WITH Residence = Pittsburgh WITH Age = ?Age THEN Frame ?x WITH Age = ?Age + 5 IF Frame ?person1 WITH Sex = Male WITH Sports = ?sports1 AND Frame ?person2 WITH Sex = Female WITH Sports = ?sports1 THEN Frame ?person1 WITH Likes = ?person2 Pattern Matching