Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)

Similar presentations


Presentation on theme: "1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)"— Presentation transcript:

1 1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1) (2) Object Modeling with OMG UML Tutorial Series -

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

3 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

4 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

5 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

6 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

7 Advanced Modeling with UML7 Meta-Models Models that describe other modelsClassClassAssociationAssociationObjects Model Meta-Model(M0)(M1) (M2) CustomerOrderCustomerOrderitemquantityitemquantityCustomerCustomeridid b:CustomerOrder b:CustomerOrder Mike:Customer Id= Mike:Customer c:CustomerOrderItem=batter Quantity= Quantity= c:CustomerOrderItem=batter

8 Advanced Modeling with UML8 The UML Meta-Model A UML Model that describes UML GeneralizableElementGeneralizableElement isRoot : Boolean isLeaf : Boolean isAbstract : Boolean isRoot : Boolean isLeaf : Boolean isAbstract : Boolean ClassClass isActive : Boolean ClassifierClassifier FeatureFeature visibility : {public, private, protected} protected} * not self.isAbstract implies self.allOperations->forAll(op | self.allMethods->exists(m | m.specification includes (op))) Well-formedness constraint (OCL) Meta-ClassMeta-Class

9 9 Four Layered Architecture LayerDescriptionExample Meta-metamodelDefines metamodelmetaClass, metaAttribute, metaOperation MetamodelAn instance of meta- Metamodel. Defines model Class, attribute operation, component modelLanguage for describing information domain. Defines a set of related objects that represent a concept. Employee, User objectAn instance of the model. An example information domain sally

10 OMG Modeling Infrastructure 10 M3 M2 M1 M0 Meta-Object Facility (MOF) UML Metamodel Modeling concepts User Data Instance_of

11 MetaModelsSWE UML Metamodel Features UML metamodel is managed by organizing it into packages. Each package groups related metaclasses

12 Advanced Modeling with UML 12 «metamodel» UML “Structural Elements” “Behavioral Elements” dependency package UML Metamodel Overview

13 Advanced Modeling with UML 13 “Structural Elements” Composite Structures Classes UML Overview ComponentsDeployments >

14 14

15 15

16 16

17 17

18 18

19 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.

20 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 21 A classifier is a classification of instances, it describes a set of instances that have features in common.

22 22

23 23

24 24

25 25 Example 1 PERSON CAR [0..1] [0..*] owns Model Layer Entity Association End 1 [0..*] [2..*]1 Cardinality range Rolename Name Meta Model Layer A meta-model is a conceptual model of a modeling technique !

26 26 Example 2 Association Property Class RelationshipClassifier 2..* 0..1 Owned end member end * Syntactically valid ?

27 27

28 28

29 29

30 30

31 The Java Metamodel 31

32 Advanced Modeling with UML32 Behavioral Elements of UML Metamodel

33 Interaction Diagram Metamodel (see handout) Can you derive the relationship between a message end and a lifeline? 2. Can you derive the relationship between a message and an operation? 2. Can you derive the relationship between a class and a lifeline?

34 34 Navigating the “MetaMuddle” Can you derive the relationship between a message end and a lifeline? ?

35 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

36 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

37 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 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 Integrator A systems integrator may have to integrate multiple modeling and other tools in a way that they appear like one tool. The meta-model determines how the tools can “speak” to each other... Modeler In evaluating modeling tools functionality is important (“this one does code generation”), but the supported concepts are even more important, which is essentially evaluating the meta- model Repository vendor A meta-model is a conceptual model for repositories, the inte- grating technology for tools

39 39 Metamodel Efforts Multi-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 …

40 Architecture metamodel

41 Extending UML? 41 Why is there a need to extend UML?

42 Advanced Modeling with UML, Selic et al.42 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 43 How UML Extensibility Works The standard UML semantics can be viewed as defining a space of possible interpretations Standard UML semantics refined semantics (valid) (valid) different semantics (NOT valid) different semantics (NOT valid) Advanced Modeling with UML, Selic et al.

44 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 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 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 concept Advanced Modeling with UML, Selic et al.

47 47 Example: Stereotype Definition Using a tabular form: StereotypeBase ClassTagsConstraints «capsule»Classlanguage isActive = true; self.feature->select(f | f.oclIsKindOf(Operation))-> forAll(o | o.elementOwnership.visibility = #protected) TagStereotypeTypeMultiplicity language«capsule»String Advanced Modeling with UML, Selic et al.

48 48 Stereotype Notation Several choices«capsule»aCapsuleClass«capsule»aCapsuleClass aCapsuleClassaCapsuleClass Stereotype icon (a) with guillemets (“gwee-mays”) (b) with icon (c) iconified form Advanced Modeling with UML, Selic et al.

49 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)ClassClassAssociationAssociationCustomerOrderCustomerOrderitemquantityitemquantityCustomerCustomeridid «capsule»aCapsuleClass«capsule»aCapsuleClass Advanced Modeling with UML, Selic et al.

50 50 Graphical Definition Alternative to the tabular form defined in a user (M1) model «metaclass» Class «stereotype» capsule Tags language : String «stereotype» 1.4 Advanced Modeling with UML, Selic et al.

51 51 Heuristic: Combining Stereotypes Through multiple inheritance: «stereotype» capsule Tags language : String Tags «metaclass»Package«metaclass»Package «stereotype» PackageCapsule «stereotype» 1.4 Advanced Modeling with UML, Selic et al.

52 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 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 54 Constrains Constraints formal or informal expressions must not contradict inherited base semantics ATM_WithdrawalATM_Withdrawal customer : id amount : Money {amount is multiple of $20} customer : id amount : Money {amount is multiple of $20} AccountAccount customer : id balance : Money customer : id balance : Money «constraint» {ATM_Withdrawal.customer = Account.customer} Account.customer}«constraint» {ATM_Withdrawal.customer = Account.customer} Account.customer} Advanced Modeling with UML, Selic et al.

55 TheEnd CSC550, Devon M. Simmonds, Computer Science Department, University of North Carolina Wilmington ??????????????? …CSC550 … Q u e s t i o n s ?


Download ppt "1 Devon M. Simmonds The UML Metamodel SLIDES include some from tvarious sources including: (1)"

Similar presentations


Ads by Google