Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-Oriented Knowledge Representation

Similar presentations


Presentation on theme: "Object-Oriented Knowledge Representation"— Presentation transcript:

1 Object-Oriented Knowledge Representation
Jacques Robin

2 Outline Review of object-oriented concepts
History of object-oriented languages UML2 as a knowledge representation language

3 Review of Key Object-Orientation Concepts
Class (or concept, or category): abstract representation of a set of individuals with common structural and/or behavioral properties A class defines a complex type Object (or individual, or instance): individual instance of a given class An object conforms to the complex type defined by its class An object is created by instantiating its class (constructor method) Each object has a unique identifier (oid) that distinguishes it from other instances of the same class sharing the same properties The structural properties of a class are a set of attributes (also called fields or slots), which value is constrained to be of a certain subset of types (primitive types or classes) The structural properties of an object are specific values for these attributes within the ranges defined by its class The behavioral properties of a class are a set of operations (also called methods, procedures, deamons or functions) that its instances can execute The signature of a class is the set of type constraints on its attributes and on the parameters and return value of its operations The properties of a class have various visibilities such as public, protected and private allowing their encapsulation Classes are organized in a generalization (specialization) hierarchy Properties are inherited down the hierarchy from a class to its subclasses and its objects

4 Inheritance Allows concise knowledge representation through reuse of specifications and implementations among classes and objects down a specialization hierarchy Types of inheritance: Structural inheritance Attribute signature inheritance (constraint inheritance) Value inheritance Behavioral inheritance Operation signature inheritance (constraint inheritance) Operation code inheritance Inheritance multiplicity Simple inheritance (each class restricted to having a single super-class, and each object restricted to belong to a single class) Multiple inheritance of different properties from different sources Multiple inheritance of same property from different sources Inheritance monotonicity Monotonic inheritance: simple without overriding Non-monotonic inheritance: with overriding, logically equivalent to default reasoning, semantics beyond Classicial First-Order Logic

5 History of Object-Oriented Languages
Software Engineering Programming Databases Knowledge Representation Distributed Systems 1965 Simula Sketchpad Smalltalk UML1 Semantic Networks Frames Description Logics C++ OQL Java Frame Logics C# SQL’99 OCL1 MOF1 OWL OCL2 UML2 MOF2 Semantic Web CHORD SWSL 2006

6 UML as KR Language Class diagram: Activity diagram
Modern, well-founded version of semantic networks Activity diagram Modern, well-founded version of flow charts Graphical syntax for procedures Class diagrams + Activity diagrams : Graphical syntax of expressive power approximately equivalent to that of Frames Strengths: Universal standard, well-thought, well-known and well-tooled (CASE) Facilitates convergence between software and knowledge engineering Limitations: Lack of full UML compilers to executable languages Lack of inference engine to automatically reasoning with knowlege represented only as UML models No mathematically defined formal semantics yet Thus: Only useful at the knowledge level Need to be used in conjunction with other language(s) that provide the formalization and/or implementation level

7 UML Class Diagram Categories represented as classes (nodes)
Classes encapsulates: Primitive type properties, attributes Behaviors, operations Relationships between classes represented as associations (edges) Special associations for: Specialization-Generalization relationship partOf relationship (aggregation and compositions) Reified relationships represented as association classes Role names and cardinality constraints on associations Many other logical constraints built-in class diagram syntax Arbitrary logical constraints relating any part of the class diagram using Object Constraint Language (OCL)

8 Classes: Attributes Common characteristics of the class members
Fields (slots): Base or derived Visibility (public, protected, private) Name Type (Primitive Built-In or Used-Defined Enumerations) Initial default value Property Object attributes: different value for each object Class attributes: same value for all objects Attributes for KR: as many fields as possible!

9 Classes: Operations Common signature of services provided by the class members Fields: Visibility Name Input parameter Direction Type Multiplicity Default value Property Return type Object methods: called on objects Class methods: called to manipulate class attributes Operations for KR: as many fields as possible!

10 Associations Association: Fields: Navigation:
Generic relation between N classifiers Fields: One or two Names Navigation direction Two Ends, each with: One Multiplicity Range (default = 1) Zero to One role Zero to one Qualifier Navigation: Role if present Otherwise destination class name Associations for KR: as many fields as possible!

11 N-ary Associations Single association between N classes
Different from N-1 binary associations Different from one binary association class Example: Ca has objects A1, A2 Cb has objects B1, B2 Cc has objects C1, C2 No link in the ternary association Ca-Cb-Cc corresponding to pair of links A1-B1, B2-C1

12 Association Classes Class connected to an association and not to any of its ends Allows associating properties and behaviors to an association One object of the association class for each link of the connected association A one-to-many or many-to-many association class cannot be substituted by a simple class and a pair of simple associations Example: Ca has objects A1, A2, A3, A4 Cb has objects B1, B2, B3, B4 Extent of association class Cc between Ca and Cb with * multiplicity at both ends has necessarily 16 instances Class Cc associated to Ca through association Aca and to Cb through association Acb could have only 4 instances Difference with: ? 4 Elevator control Queue Elevator

13 Aggregations and Compositions
Association with “part-whole” semantics Associate composite class to its building blocks Static, definitional characteristic of the “whole” class Composition: Special case of one-to-one or one-to-many aggregation where part(s) cannot exist(s) without the unique whole Deletion of the whole must therefore always be followed by automatic deletion of the parts

14 Class generalizations
Taxonomic relation between a class and one of its more general direct super-class Special case of generalization between any two classifiers Several generalizations form a taxonomic tree free of generalization cycles Sub-classifier inherits the features from all its direct super-classifiers Private attributes and operations not accessible from sub-classes Protected attributes and operations accessible from sub-classes but not from associated classes UML generalizations allow multiple inheritance and overriding Instances of a sub-class must satisfy all the constraints on all its super-classes (principle of substitutability)

15 Abstract Classes Class that cannot be instantiated
Only purpose: factor gradual refinements of common and distinct structures and behaviors down a taxonomic hierarchy Abstract operation: common signatures of distinct implementations specified in subclasses Supports polymorphism: generic call signature to distinct operations, with automatic dispatch to the implementation appropriate to each specific call instance

16 Generalization Sets Subclass set that can be labeled as:
complete or incomplete overlapping or disjoint Complete and disjoint generalization sets form a partition of the super-class Sub-subclass can specialize members of two overlapping generalization sets

17 Power Types Generalization set of a super-class defined in terms of a class associated to it Subclasses of each power type inherits features from the associated class of the super-class that defines the power type Allows separation of orthogonal concerns Useful for MDA as a rich modeling element

18 UML Object Diagrams Object Diagram contains:
Specific (named) or generic (named after role, unnamed) instances of classes Possibly several instances of the same class Specific instances of associations (links) among objects Possibly several instances of the same association Illustrates specific instantiation patterns of associated class diagram

19 Meta-Object Facility (MOF)
Structural meta-knowledge representation language Reuses UML class diagrams to specify, in an object-oriented way, the abstract syntax of computational languages Advantages over BNF grammars: Visual clarity Abstract Terminals with internal structure and behaviors Richer variety of relation semantics among non-terminals: specialization, aggregation, composition and simple associations instead of merely linearization order Reuse through inheritance, package import and package merge A MOF specification of the abstract syntax of a language L is called a meta-model of L

20 Simplified MOF Meta-Model of itself
NamedElement BehaviorallFeature StructuralFeature Operation Parameter * Property * Classifier Feature TypedElement Type ValueSpecification 1..* Relationship RedefinableElement * NamedElement Element * InstanceSpecification Constraint * Generalization * Association Class AssociationClass DataType PrimitiveType Enumeration Interface


Download ppt "Object-Oriented Knowledge Representation"

Similar presentations


Ads by Google