1 devon m. simmonds the uml metamodel slides include some from tvarious sources including: (1)

Post on 22-Jan-2016

220 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Devon M. Simmonds

The UML

Metamodel

SLIDES include some from tvarious sources including: (1) http://www.econ.kuleuven.ac.be/public/ndbaa30/SWMGT/ (2) Object Modeling with OMG UML Tutorial Series - http://www.omg.org/technology/uml/uml_tutorial.htm

2

Outline Introduction UML metamodel Class diagram metamodel Interaction diagram metamodel Benefits of metamodels UML extension mechanisms

UML

The UML specification consists of two interrelated parts: UML Semantics. A metamodel that

specifies the abstract syntax and semantics of UML object modeling concepts.

UML Notation. A graphic notation for the visual representation of the UML semantics.

3

UML The abstract syntax for the UML

Semantics is expressed using a small subset of the UML Notation.

The UML Notation describes the mapping of the graphic notation to the underlying semantics.

4

UML The UML metamodel is described in a

semi-formal manner using three views: Abstract syntax Well-formedness rules Semantics

The abstract syntax is provided as a model described in a subset of UML, consisting of a UML class diagram and a supporting natural language description.

5

UML The well-formedness rules are provided

using a formal language (Object Constraint Language) and natural language (English).

The semantics are described primarily in natural language, but may include some additional notation.

6

Advanced Modeling with UML 7

Meta-Models Models that describe other models

ClassClass AssociationAssociation

Objects

Model

Meta-Model

(M0)

(M1)

(M2)

CustomerOrderCustomerOrder

itemquantityitemquantity

CustomerCustomer

idid

b:CustomerOrder b:CustomerOrder Mike:Customer

Id= 12345

Mike:Customer

Id= 12345c:CustomerOrderItem=batterQuantity=<5 tons>

c:CustomerOrderItem=batterQuantity=<5 tons>

Advanced Modeling with UML 8

The UML Meta-Model A UML Model that describes

UML

GeneralizableElementGeneralizableElement

isRoot : BooleanisLeaf : BooleanisAbstract : Boolean

isRoot : BooleanisLeaf : BooleanisAbstract : Boolean

ClassClass

isActive : BooleanisActive : Boolean

ClassifierClassifier

FeatureFeature

visibility : {public, private,protected}visibility : {public, private,protected}

*

not self.isAbstract implies self.allOperations->forAll(op | self.allMethods->exists(m | m.specification includes (op)))

not self.isAbstract implies self.allOperations->forAll(op | self.allMethods->exists(m | m.specification includes (op)))

Well-formedness constraint (OCL)

Meta-ClassMeta-Class

9

Four Layered ArchitectureLayer Description Example

Meta-metamodel Defines metamodel metaClass, metaAttribute, metaOperation

Metamodel An instance of meta-Metamodel. Defines model

Class, attribute operation, component

model Language for describing information domain. Defines a set of related objects that represent a concept.

Employee,

User object An instance of the model. An example information domain

sally

OMG Modeling Infrastructure

10

M3

M2

M1

M0

Meta-Object Facility (MOF)

UML Metamodel

Modeling concepts

User Data

Instance_of

Instance_of

Instance_of

MetaModels SWE 699 11

UML Metamodel Features

UML metamodel is managed by organizing it into packages.

Each package groups related metaclasses

Advanced Modeling with UML 12

«metamodel»UML

“StructuralElements”

“Behavioral Elements”

dependency

package

UML Metamodel Overview

Advanced Modeling with UML 13

“StructuralElements”

Composite Structures

Classes

UML Overview

Components

Deployments

<<imports>><<imports>>

<<imports>>

14

15

16

17

18

19

Slots are shown using similar notation to that of the corresponding structural features. Where a feature would be shown textually in a compartment, a slot for that feature can be shown textually as a feature name followed by an equal sign (‘=’) and a value specification. Other properties of the feature, such as its type, can optionally be shown.

Slots

20

A slot specifies that an entity modeled by an instance specification has a value or values for a specific structural feature.

Slots are shown using similar notation to that of the corresponding structural features. Where a feature would be shown textually in a compartment, a slot for that feature can be shown textually as a feature name followed by an equal sign (‘=’) and a value specification. Other properties of the feature, such as its type, can optionally be shown.

21

A classifier is a classification of instances, it describes a set of instances that have features in common.

22

23

24

25

Example 1

PERSON

CAR

[0..1]

[0..*]

owns

Model Layer

Entity

AssociationAssociation

End

1

[0..*]

[2..*] 1

Cardinality range

Rolename

Name

Name

Meta Model Layer

A meta-model is a conceptual model of a modeling technique !

26

Example 2

AssociationPropertyClass

RelationshipClassifier

2..* 0..1

0..1

0..1

x..y v..w

(A) (B)

Owned end

member end

0..10..*

Syntactically valid ?

27

28

29

30

The Java Metamodel

31

Advanced Modeling with UML 32

Behavioral Elements of UML Metamodel

Interaction Diagram Metamodel

(see handout)

33

1. Can you derive the relationship between a message end and a lifeline?

2. Can you derive the relationship between a messageand an operation?2. Can you derive the relationship between a classand a lifeline?

34

Navigating the “MetaMuddle”

NamedElement(from Kernel)

name:Stringvisibility:VisibilityKind

Lifeline

TypedElement(from Kernel)

Type(from Kernel)

ConnectableElement(from InternalStructures)

+type

0..1

+represents0..1

*

ConnectorEnd(from InternalStructures

Connector(from InternalStructures)

*

2..*

Message

/messageKind:MessageKindmessageSort:MessageSort

0..1

*

MessageEnd

+sendEvent+recieveEvent

0..1

0..1

0..1

0..1

OccurenceSpesificatoin

0..1

MessageOccurenceSpecification

*

ExecutionOccurenceSpecification

ExecutionSpecification

+/signatur

Operation(from Kernel)

Signal(from Communications)

ValueSpecification +argument

*

+start +finnish

Element(from Kernel)

+/owner

+/ownedelement

Comment(from Kernel)

0..1

*0..1

*

+/ownedComment

MessageEvent(from Communications)

*

SendSignalEvent

SendOperationEvent

1

*

*

1

1

Event(from Communications)

*

1

Can you derive the relationship between a message end and a lifeline?

?

Benefits of Metamodels Meta-models should enable the following

benefits: Share system information across applications & tools

during its life cycle Enable a multi-user integrated tools environment Enhance information sharing and communication Consolidate and eliminate redundant specifications Increase systems integrity Simplify systems maintenance/modification Enable combining tools from multiple vendors Simplify migrations and conversions ...

35

Benefits of Metamodels Provide a platform for integration of

tools Make sure that tools can work together on

the same software project - tool inter-operability.

Provide a means to manage software components in a shared application development environment. Make sure that people can work together on

the same software project – Basis for Software Configuration Management 36

Benefits of Metamodels Provide a “standard” documentation format for

describing methods and techniques for software development.

Define the semantics of a notation Compare methods and techniques on a uniform basis

Provide a platform for software reuse Reuse software by populating the meta-model

Provide a basis for knowledge sharing in Data Warehouses

Make sure that people (may) give the same meaning to shared data elements

37

38

Metamodel Users?• TOOL vendor

The meta-model describes the capabilities of the tool...Tool vendors often extend standard metamodels or implement only a subset!

• Systems IntegratorA systems integrator may have to integrate multiple

modelingand other tools in a way that they appear like one tool. Themeta-model determines how the tools can “speak” to eachother...

• ModelerIn evaluating modeling tools functionality is important

(“thisone does code generation”), but the supported concepts

areeven more important, which is essentially evaluating the

meta-model

• Repository vendorA meta-model is a conceptual model for repositories, the

inte-grating technology for tools

39

Metamodel EffortsMulti-vendor• The UML Meta-model (Object Management Group

OMG)• The MOF specification (OMG)• XMI (XML-based Interoperability of tools, OMG)• …

Single vendor• The Microsoft OPEN Information • The PTECH meta-model• The CAYENNE meta-model …

Architecture metamodelSoftware

Architecture

Software Architecture Description

Architectural view

is made of

is represented by

Architecture Design Process

produces

Form

Component

Connection

Architectural Pattern

is a

is made of

Software Architects

are actors in

Logical view

Process view

Implemen- tation view

Deployment view

Requirements

satisfies

Architectural style

has

has

has

is a

System architecture

is part of

Architecture Style guide

Constraints

constrains

constrains

Use case view

relates to

Architectural Blueprint

depicts

Extending UML?

41

Why is there a need to extend UML?

Advanced Modeling with UML, Selic et al. 42

Extensibility Mechanisms Extensibility Mechanisms

Allow Modelers to refine the semantics of UML for a specific domain

Extensions cannot violate the standard UML semantics Enforces a consistent core of

concepts and semantics for every variation

Prevents meta-model explosion (Using UML to model everything and anything)

43

How UML Extensibility Works

The standard UML semantics can be viewed as defining a space of possible interpretations

Standard UML semanticsStandard UML semantics

refined semantics(valid)refined semantics(valid) different semantics

(NOT valid)different semantics(NOT valid)

Advanced Modeling with UML, Selic et al.

44

The Basic Extensibility Mechanisms

Stereotypes used to refine meta-classes (or other

stereotypes) by defining supplemental semantics

Constraints predicates (e.g., OCL expressions) that

reduce semantic variation can be attached to any meta-class or

stereotype Tagged Values

individual modifiers with user-defined semantics

can be attached to any meta-class or stereotype

Advanced Modeling with UML, Selic et al.

45

Stereotypes Used to define specialized model elements

based on a core UML model element Defined by:

Base metaclasses (or stereotype) What element is specialized?

Constraints: What is special about this stereotype?

required tags (0..*) What values does this stereotype need to know?

icon How should I appear in a model?

A model element can be stereotyped in multiple different ways

1.4

Advanced Modeling with UML, Selic et al.

46

Example Capsule: A special type of concurrent

object used in modeling certain real-time systems

By definition, all classes of this type: are active (concurrent) have only features (attributes and

operations) with protected visibility have a special “language” characteristic

used for code generation purposes In essence, a constrained form of the

general UML Class conceptAdvanced Modeling with UML, Selic et al.

47

Example: Stereotype Definition Using a tabular

form:Stereotype Base Class Tags Constraints

«capsule» Class language

isActive = true;

self.feature->select(f | f.oclIsKindOf(Operation))-> forAll(o | o.elementOwnership.visibility = #protected)

Tag Stereotype Type Multiplicity

language «capsule» String 0..1

1.4

Advanced Modeling with UML, Selic et al.

48

Stereotype Notation

Several choices«capsule»aCapsuleClass

«capsule»aCapsuleClass aCapsuleClassaCapsuleClass

Stereotypeicon

Stereotypeicon

(a) with guillemets(“gwee-mays”)

(b) with icon

(c) iconified form

Advanced Modeling with UML, Selic et al.

49

Extensibility Method Refinements are specified at the Model

(M1) level but apply to the Meta-Model level (M2) avoids need for “meta-modeling” CASE tools can be exchanged with models

«Capsule»«Capsule»(M1)

(M2)ClassClass AssociationAssociation

CustomerOrderCustomerOrder

itemquantityitemquantity

CustomerCustomer

idid

«capsule»aCapsuleClass

«capsule»aCapsuleClass

Advanced Modeling with UML, Selic et al.

50

Graphical Definition Alternative to the tabular form

defined in a user (M1) model

«metaclass»Class

«stereotype»capsule

Tagslanguage : String

«stereotype»

1.4

Advanced Modeling with UML, Selic et al.

51

Heuristic: Combining Stereotypes

Through multiple inheritance:

«stereotype»capsule

«stereotype»capsule

Tagslanguage : String

Tagslanguage : String

«metaclass»Package

«metaclass»Package

«stereotype»PackageCapsule

«stereotype»PackageCapsule

«stereotype»

1.4

Advanced Modeling with UML, Selic et al.

52

When to Use Stereotypes? Why not use normal subclassing

instead? Use stereotypes when:

additional semantic constraints cannot be specified through standard M1-level modeling facilities

e.g. “all features have protected visibility” the additional semantics have significance

outside the scope of UML e.g. instructions to a code generator

“debugOn = true”Advanced Modeling with UML, Selic et al.

53

Tagged Values Consist of a tag and value pair Typed with a standard data type or M1

class name Typically used to model stereotype

attributes Additional information that is

useful/required to implement/use the model May also be used independently of

stereotypes e.g., project management data

(“status = unit_tested”)

1.4

Advanced Modeling with UML, Selic et al.

54

Constrains

Constraints formal or informal expressions must not contradict inherited base

semanticsATM_WithdrawalATM_Withdrawal

customer : idamount : Money{amount is multiple of $20}

customer : idamount : Money{amount is multiple of $20}

AccountAccount

customer : idbalance : Moneycustomer : idbalance : Money

«constraint»{ATM_Withdrawal.customer = Account.customer}

«constraint»{ATM_Withdrawal.customer = Account.customer}

Advanced Modeling with UML, Selic et al.

The End

CSC550, Devon M. Simmonds, Computer Science Department, University of North Carolina Wilmington

???????????????

…CSC550 …

Q u e s t i o n s ?

top related