Download presentation
Presentation is loading. Please wait.
Published byWilliam Berry Modified over 8 years ago
1
METAMODELING the core of MDE and modeling in general UML3-1 UML 1.class diagrams 2.object diagrams and constraints 3.metamodeling
2
Terminology UML3-2 model meta-model
3
Examples A Java program that is syntactically-correct is an instance of a Java Language Metamodel if it is type-correct, it conforms to the Java Language Metamodel Example: 2 object instances and a model – only one instance conforms UML3-3
4
Perspective: Model to Instances You create a model M: And now you create instances that conform to the model Here are two instances collections of objects m1 and m2 Question: do m1, m2 conform to M? UML3-4 m1 m2
5
Perspective: Instances to Model You have a collection of instances, such as m1 and m2 What is a model M to which m1 and m2 conform? Called metamodeling UML3-5 m1 m2 M
6
MetaModels Here are 2 instances of a “graph”, which contains nodes and edges What is a class diagram of such graphs? UML3-6 n1n2 n6n8 n9 g1 g2
7
One Solution Model Java Representation UML3-7 class Node { private String Name; private Set edge; } class Edge { private node connects[2]; } What is “normalized” database design?
8
Hints on MetaModeling Here are 2 instances of another kind of graph called a UML Class Diagram For simplicity, there are no methods and there are any # of attributes, no inheritance relationships What is a UML class diagram to which these instances conform? UML3-8
9
Hint: Think Visio Drawing Tool Each “template” icon on left represents a class of objects dragging icon onto canvas creates an instance of that class so there are 2 classes of objects in a UML class diagram that we’re using 1.Determine attributes of each class 2.Determine relationships & constraints among classes UML3-9
10
Step 1: Identify Shapes Given instance: What are the shapes that you can drag onto a canvas? they are classes in your metamodel UML3-10
11
Step 2: Identify Attributes Given instance: What are the attributes of each of your classes? they may become classes in your metamodel, too UML3-11
12
Step 3: Identify Associations Look at model instance: Each AssociationEnd is anchored at connectedTo a Class box Yields metamodel MM UML3-12
13
Step 4: Beautify (Rename) Rename elements, add names to roles, etc. UML3-13
14
Step 5: Add Constraints Implied uniqueness constraints No two classes can have the same name Another constraint is?? UML3-14 findPair(C1,C2,N):-class(C1,N),class(C2,N),@C1 @< @C2. uniqueNames:-forall(findPair(_,_,N), isError('unique names constraint violated: ',N)). badAssocEnd(E):-associationEnd(E,_,_,_,C),not(class(C,_)). legalAnchor:-forall(badAssocEnd(E), isError('association end unbound: ',E)).
15
Note! Common for a metamodel to be an instance of itself! model MM conforms to MM Not an oddity! Requirement for advanced models make sure that you understand what this slide says! UML3-15 conforms to or is an instance of
16
Diagram-2-Table Mapping Notes UML3-16 Table#attributes class attributes assocEnd association Table#attributes classc#name attributes assocEnd association Table#attributes classc#name attributesat#namevisibility?attrOf assocEnd association Table#attributes classc#name attributesat#namevisibility?attrOf assocEndae#namevisible?cardinalityanchoredAtendOf association Table#attributes classc#name attributesat#namevisibility?attrOf assocEndae#namevisible?cardinalityanchoredAtendOf associationk#
17
Tabular Representation UML3-17 #Name clClass atAttributes aeAssocEnd asAssociation # k1 k2 k3 #NameVisibilityAttrOf a1name-cl a2name-at a3visibility-at a4name-ae a5visible-ae a6cardinality-ae #namevis?cardanchAtendof ae1attrOf-1clk1 ae2hasAttr-*atk1 ae3anchoredAt-1clk2 ae4anchors-*aek2 ae5endof-1ask3 ae6hasEnd-2aek3 Class Attributes AssocEnd Association c#name a#namevisibilityattrOf ae#namevis?cardanchAtendof k# Look at handout! 1 2 3 4
18
Your Turn: Entity-Relationship Model precursor to UML Class Diagrams Entity sets classes are boxes Entities can have attributes bubbles ; underlined attributes are keys Relationships are diamonds that connect 2 or more distinct boxes Attributes are associated with only one Entity UML3-18
19
A Solution UML3-19
20
#e#r# er1ewi er2dwi er3ddis er4udis #name wiworksin disdisciplines #name eEmployee dDepartment uUniversity A Solution UML3-20 Entity Relationship #namekey?belongsTo a1empNoyese a2agenoe a3deptNameyesd a4buildingnod a5phonenod a6addressnou a7nameyesu Attribute e#name a#namekey?belongsTo er#e#r# ERPair r#name 1 2 3 4
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.