MetaModeling the core of MDE and modeling in general UML

Slides:



Advertisements
Similar presentations
Three-Step Database Design
Advertisements

Chapter 3 : Relational Model
The Entity-Relationship Model Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
ENTITY RELATIONSHIP MODELLING
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
IT 244 Database Management System Data Modeling 1 Ref: A First Course in Database System Jeffrey D Ullman & Jennifer Widom.
Computing & Information Sciences Kansas State University Wednesday, 01 Oct 2008CIS 560: Database System Concepts Lecture 15 of 42 Wednesday, 01 October.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Database Systems Lecture # 7 8 th Feb, Conceptual and Logical Design Person buys Product name pricenamessn Conceptual Model: Relational Model: (plus.
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Entity-Relationship Model
Using COMET with Visio Visio UML Modeling. Creating a Drawing After opening Visio, you will see a list of templates available.
Databases Illuminated Chapter 3 The Entity Relationship Model.
Data modeling using ER1 Entity relationship diagrams.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
METAMODELING the core of MDE and modeling in general UML3-1 UML 1.class diagrams 2.object diagrams and constraints 3.metamodeling.
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Tutorial on E-R Diagrams 1.Learn basic terminology and symbols –See next four slides; refer to as needed in steps 2-4 below 2.Learn the basics of E-R diagramming.
OVERVIEW OF MDE AND IN CLASS EXAMPLES try your luck at modeling UML4-1 UML 1.class diagrams 2.object diagrams and constraints 3.metamodeling 4.examples.
The Relational Model Lecture #2 Monday 21 st October 2001.
Lecture 3 A short revision of ER and EER modelling See R. Elmasri, S.B. Navathe. Fundamentals of Database Systems (third edition) Addison-wesley. Chapter.
Copyright © 2014 Pearson Canada Inc. 5-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5a Database Design Part 2: Using Information Technology.
Entity-Relationship Data Model
COP Introduction to Database Structures
Introduction to Spatial Computing CSE 555
Comp 1100 Entity-Relationship (ER) Model
Entity/Relationship Modelling
Data Modeling Using the ERD
Let try to identify the conectivity of these entity relationship
Entity-Relationship Model
Entity Relationship Diagram
Enhanced Entity-Relationship and Object Modeling Objectives
Entity-Relationship Model
Business System Development
IS6125 Database Analysis and Design Lecture 5: Conceptual Data Modelling 2: ER Modelling and Beyond the Presentation Layer Rob Gleasure
Visit for more Learning Resources
Object-Oriented Analysis and Design
Entity-Relationship Model
Entity-Relationship Modelling
Chapter 7 Entity-Relationship Model
UML Class & Object Diagram II
Model Driven Engineering
Constraints in Entity-Relationship Models
CPSC-310 Database Systems
Entity-Relationship Modeling
Chapter 2: Intro to Relational Model
Constraints AND Examples
UML Diagramming with JUDE
Order Database – ER Diagram
Entity Relationship Diagrams
Entity-Relationship Modelling
The Entity-Relationship Model
Relational Database Design (Top Down)
Database Modeling using Entity Relationship Model (E-R Model)
Lecture 9: The E/R Model II
Chengyu Sun California State University, Los Angeles
Chapter 7: Entity-Relationship Model
Lesson Objectives Aims You should know about: 1.3.2:
IT 244 Database Management System
E.R. Examples.
Entity Relation Model Tingting Zhang.
Database Management system
Database Management system
Constraints AND Examples
Entity-Relationship Data Model
Database Dr. Roueida Mohammed.
Chapter 3: Multivalued Dependencies
Presentation transcript:

MetaModeling the core of MDE and modeling in general UML class diagrams object diagrams and constraints metamodeling examples MDE the core of MDE and modeling in general MetaModeling

Today’s Lecture Recall this slide from the last lecture:

Today’s Lecture Learn the importance of recursion

Terminology model meta-model Let 𝑥 be a model and 𝑋 be a metamodel; 𝑥 belongs to the domain of 𝑋 iff 𝑥 is an instance of 𝑋 if objects & refs satisfy the class diagram of 𝑋 and 𝑥 conforms to 𝑋 if 𝑥 satisfies all metamodel constraints of X. “Conforms to” is a much more difficult constraint to satisfy than “instance of”

Examples A Java program that is syntactically-correct is an instance of a Java Language Metamodel if it is type-correct and it conforms to the Java Language Metamodel Example: 2 instances and a model – only one instance conforms

Perspective Model to Instances You create a model M: age of every Employee > min age of department And now you create instances m1 and m2 that conform to the model M m1 M both conform. m2 m1 m2

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 m1 m2 M M m1 m2

MetaModels Here are 2 instances of a “graph”, which contains nodes and edges What is a class diagram of such graphs? n1 n2 g1 n6 n8 n9 g2

One Solution Model What is “normalized” database design? What is a perfectly good Java representation of this meta model? note arrow ends added to meta model class Node { private String Name; private Set<Edge> edge; } class Edge { private node connects[2];

Fundamentals of MetaModeling RULE: ANY graph can be viewed as an object diagram Here are 2 instances of another kind of graph or object diagram 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?

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 Determine attributes of each class Determine relationships & constraints among classes Fire up Visio!

Step 1. Identify Shapes Given instance: What are the shapes that you can drag onto a canvas? they are classes in your metamodel I see boxes and lines. that’s really all that I see now. (Of course, they each have attributes, and attributes are something that will become objects that I can “drag” onto my design canvas)

Step 2. Identify Attributes Given instance: What are the shapes that you can drag onto a canvas? they are classes in your metamodel I see boxes and lines. that’s really all that I see now. (Of course, they each have attributes, and attributes are something that will become objects that I can “drag” onto my design canvas)

Step 3. Identify Associations Look at model instance: Here is its metamodel MM 1 3 2

Step 4. Beautify (Rename) Rename elements, add names to roles, etc. This is almost a metamodel of class diagrams! what is missing?

Step 5. Add Constraints Association cardinalities usually turn into constraints attribute-class: verify an Attribute tuple points to an existing Class tuple assocEnd-class: verify an AssocEnd tuple points to an existing Class tuple assocEnd-association: verify every AE points to an existing A tuple association-assocEnd: every A must have 2 AEs attribute-class assocEnd-class assocEnd-association association-assocEnd // every A must have 2 AEs ErrorReport er = new ErrorReport(); er.printReport(System.out); no two attributes of a class have the same name Also no two anchor ends associated to the same class have the same name. And no anchor end of a class has the same name as an attribute of the class. association.stream() .filter(t-> assocEnd.stream(). .filter(x->x.is(“aid”,t.get(“aid”))).count()!=2) .forEach(t->er.add(t.get(“aid”) + “ does not have 2 association ends”);

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! conforms to or is an instance of M M m1 m2

Diagram-2-Table Mapping Notes # Table Attribute/Field Class c# name Attribute at# visibility? attrOf AssocEnd ae# visible? cardinality anchoredAt endOf Association k# Table # Attribute Class c# name at# visibility? attrOf AssocEnd ae# visible? cardinality anchoredAt endOf Association Table # Attribute Class c# name AssocEnd Association Table # Attribute Class AssocEnd Association Table # Attribute Class c# name at# visibility? attrOf AssocEnd Association

Tabular Representation Attribute 2 Class 1 a# name visibility attrOf # Name Visibility AttrOf a1 name - cl a2 at a3 visibility? a4 ae a5 visible? a6 cardinality # Name cl Class at Attributes ae AssociationEnd as Association c# name AssocEnd Association ae# name vis? card anchAt endof # name vis? card anchAt endof ae1 attrOf - 1 cl k1 ae2 hasAttr * at ae3 anchoredAt k2 ae4 anchors ae ae5 as k3 ae6 hasEnd 2 4 Create each table + attributes Then fill in (as much as possible) Class and Attribute tables Then AssocEnd and Association Table. Filling in the attributes then becomes more like a puzzle. # k1 k2 k3 k# 3

Your Turn: Entity-Relationship Model precursor to UML Class Diagrams Entity sets classes are boxes & have unique names Attributes are bubbles; underlined attributes are keys Relationships are diamonds with unique names connecting 2 or more boxes Attributes are associated with only one Entity or one Relationship Entity set must have 1+ key attribute; Relationships >0 or more attributes

A Solution 1st stab at a solution: Constraints? Problem:

A Solution Not Association Normalized 1st stab at a solution: Constraints? Problem: Constraints (beyond cardinality constraints) C1. Each Bubble belongs to a Box OR Diamond, but never both C2. Each Box has at least 1 keyed attribute C3. Each Diamond has 0+ attributes, 0+ keyed attributes C4. Each Box has a unique name C5. Each Diamond has a unique name C6-7. Bubble names for each box (each diamond) are unique Not Association Normalized

A Solution continued... Normalizing Box-Diamond association yields: Tables? Constraints (beyond cardinality constraints) C1. Each Bubble belongs to a Box OR Diamond, but never both C2. Each Box has at least 1 keyed attribute C3. Each Diamond has 0+ attributes, 0+ keyed attributes C4. Each Box has a unique name C5. Each Diamond has a unique name C6-7. Bubble names for each box (each diamond) are unique

A Database Diamond Box Bubble BoxDiamond b# name # name e Employee d 1 2 b# name # name e Employee d Department u University d# name d# name wi worksin dis disciplines Bubble 4 BoxDiamond a# name key? belongsTo a# name key? belongsTo a1 empNo yes e a2 age no a3 deptName d a4 building a5 phone a6 address u a7 3 bd# e# r# bd1 e wi bd2 d bd3 dis bd4 u bd# e# r#