43
Ontologi es Reasonin g Component s Agents Simulatio ns Basic Structural Basic Structural Modeling with Modeling with UML2 UML2 Jacques Robin

Ontologies Reasoning Components Agents Simulations Basic Structural Modeling with UML2 Jacques Robin

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

OntologiesReasoningComponentsAgentsSimulations

Basic Structural Basic Structural Modeling with UML2Modeling with UML2

Jacques Robin

OutlineOutline

UML2 x UML1 UML2 meta-model package structure UML2 Diagrams Classes Associations Objects and links Interfaces Packages Templates Active classes and objects

UML2: What is new?UML2: What is new?

New purposes: Model-driven development Whole life-cycle component based development Real-time systems engineering Fully refined modeling with semi-formal notation (OCL)

New diagrams: Component diagram Composite structure diagram Timing diagram

New design: Separates:

Abstract syntax, a MOF meta-model Visual syntax, the Diagram Interchange (DI) standard Semantics

Decomposes each part for reuse in a hierarchy of MOF packages linked by embedding and merge relationships

UML2: New usesUML2: New uses

UML2 is so comprehensive that it can be used for new purposes not initially envisioned by OMG

Agent-oriented software engineering and intelligent system development

Engineering semantic web ontologies and services Teaching course in any field through modeling and meta-

modeling the presented concepts to visually and precisely structure them

UML2: Internal StructureUML2: Internal Structure

Over 30 Sub-packages defining:• Classifiers (Classes, Interfaces, etc.)• Types• Associations• Packages• Properties• Constraints

UML2 Infrastructure

Over 50 Sub-packages defining:• Components• Composite structures• Deployments• Common behaviors (Times, Durations, Events, Signals, etc.)• Actions• Activities• Interactions• State machines• Use cases• Profiles• Templates

UML2 Superstructure

6 Sub-packages defining:• Types• Expressions• Type value semantic domains• Expression evaluation semantic do mains• Type value semantic mapping• Expression value semantic mapping

OCL2

Defines diagrams’ visual layout

Diagram Interchange

MOF2

EMOF CMOF

merge

UML2

merge

merge

merge

UML2: Internal StructureUML2: Internal Structure

UML2 Superstructure

Structure

Classes

CompositeStuctures

Components

Deployments

Behavior

CommonBehaviors

Activities

Actions

Interactions StateMachines UseCases

Supplement

AuxiliaryConstructs

Profiles

UML2 DiagramsUML2 Diagrams

Requirements Analysis Design Testing Deployment

Structural Modeling

Class (OCL)

Object

Component (OCL)

Class

Object

Composite structure

Class

Object

Composite structure

Component

Class (OCL)

Object

Component (OCL)

Deployment

Behavioral Modeling

Use-case

Activity

Protocol state machine

Activity

State machineBehavioralProtocol

InteractionSequenceCommunicationInteraction overview

Timing

Activity

State machineBehavioralProtocol

InteractionSequenceCommunicationInteraction overview

Timing

Use-case

Timing

Classes: AttributesClasses: Attributes

Common characteristics of the class members

Fields: Base or derived (isDerived) Visibility (public, protected,

private, package) Name Type (Primitive Built-In or

Used-Defined Enumerations) Initial default value Properties:

isReadOnly Object attributes: different

value for each object Class attributes: same value

for all objects Attributes for MDA: as many

fields as possible!

Classes: OperationsClasses: Operations

Common signature of services provided by the class members

Fields: Visibility Name Return type Properties: isQuery, isOrdered,

isUnique Input parameter

Direction Name Type Multiplicity Default value Properties

Object operations: called on objects Class operations: called to

manipulate class attributes Operations for MDA: as many fields

as possible!

AssociationsAssociations

Association: 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

Qualifier: needed to distinguish different instances of a one-to-many or many-to-many association

Navigation: Role if present Otherwise destination class name

Associations for MDA: as many fields as possible!

Association ClassesAssociation 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

Elevatorcontrol

Queue Elevator

Difference with: ?

4

N-ary AssociationsN-ary Associations

Single association between N classes

Different from N-1 binary associations

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

Aggregation AssociationsAggregation Associations

Association with “part-whole” semantics

Associate composite class to its building blocks

Static, definitional characteristic of the “whole” class In contrast to composite

structure diagrams that model dynamic, configuration characteristic of the containing class

Shared aggregation: Many-to-many aggregation

Composition AssociationsComposition Associations

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

Class generalizationsClass 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 substituability)

Abstract ClassesAbstract 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

Generalization SetsGeneralization 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

Power TypesPower 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

Derived Attributes, Derived Attributes, Classes and AssociationsClasses and Associations

Some class diagram elements can be entirely derived from other primitive ones

Derivation rules provided in { } near the derived element or as OCL constraint

Explicit derivable information key and rules for it are key for MDA

Constrained AssociationsConstrained Associations

Properties and special graphical notation can express a limited set of constraints among associations

Other constraints expressed in OCL Constraints key for MDA

Objects and LinksObjects and Links

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

InterfacesInterfaces Classifier allowing to insulate classes, packages and components from one

another for plug-and-play assembly and substitution Concrete class: attributes + operation signatures + operation implementations

+ instances Abstract class: attributes + operation signatures + partial implementations +

(possibly but rarely) instances Interface: attributes + operation signatures A class realizes services specified in an interfaces, while it specializes the

structure and behaviors whose signature they inherit from an abstract class Other classifiers can use these services independently of how they are realized Explicit, class-based notation more precise and thus preferred for MDA

PackagesPackages

Group of elements creating a namespace A pure design-time entity, that might not be reflected at run-time Model element can only belong to a single package and is deleted

whenever its package is deleted Relations between packages:

Generalization Dependencies: nesting (sub-package), import, access (private import) and

merge

PackagesPackages

Package MergePackage Merge

Integrate elements of two packages into a resulting “merged” package, collapsing common elements into a single one

Redundancy-free cut and paste

TemplatesTemplates

Partially specified class, refined by instantiation of parameters Alternative way to define derived class Key for parametric patterns

Active Classes, Objects and PartsActive Classes, Objects and Parts

Active classes are associated to a thread

Active objects have pro-active behavior, executing an operation not invoked by any other object

Active objects execute concurrently

Active classes/objects can be composite structures, containing both active and passive classes/objects as parts

What is an agent? An active object that is

also a component instance!

Simplified MOF Meta-Model of itselfSimplified MOF Meta-Model of itself

InstanceSpecification

Parameter*

Generalization

*

AssociationClass

AssociationClass

DataType

PrimitiveType Enumeration

Interface*

1..*Relationship

Relationship

NamedElement

Constraint

*

TypedElementType

Property

ValueSpecification

Classifier

Feature Classifier

RedefinableElement

*

Element

*

BehavioralFeature

Operation

StructuralFeature

*

Prototypical Class Diagram ExamplePrototypical Class Diagram Example

+attr2:type10[multi18]...

Class2

+/attr3:type11[multi19]...

Class3

multi22 multi23

role1 role2assoc1

+attr1:type9[multi16]...

Class1

+attr4:enumType1...

Class4

compos1

whole1

part1

multi21

multi20

/aggreg1

aggreg2

whole2 whole3

sharedPart1

sharedPart3

multi24

multi25

multi26

multi27

<<enumeration>>enumType1

enumLit1...

context Class3::attr3derived OCLExp3

context Class1inv:inv2 OCLExp2

+attr5:type12[multi17]...

AssoClass1

context aggreg1derived OCLExp4

Class

DataTypeProperty

Generalization

AssociationClass

Property

Property

EnumerationLiteral

Enumeration

Association

Association

Association

Association

Constraint

Constraint

Constraint

ExpressionInOCL

ExpressionInOCL

ExpressionInOCL

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture

Kernel UML2.1 SuperstrutureKernel UML2.1 Superstruture