Softwaretechnik Model Driven Architecture Meta Modeling

Similar documents
Softwaretechnik. Lecture 19: Model Driven Engineering. Peter Thiemann. University of Freiburg, Germany

Ingegneria del Software Corso di Laurea in Informatica per il Management. Introduction to UML

Metamodeling with Metamodels. Using. UML/MOF including OCL

A UML 2 Profile for Variability Models and their Dependency to Business Processes

Metamodeling. Janos Sztipanovits ISIS, Vanderbilt University

Models versus Ontologies - What's the Difference and where does it Matter?

Model Driven Development Unified Modeling Language (UML)

Unified Modeling Language 2

Construction of Complex UML Profiles

Design and Prototypical Implementation of a Pivot Model as Exchange Format for Models and Metamodels in a QVT/OCL Development Environment

Software Design, Modelling and Analysis in UML

Software Design, Modelling and Analysis in UML

Extending profiles with stereotypes for composite concepts 1

OMG Modeling Glossary B

All you need are models Anneke Kleppe, Klasse Objecten

Software Design, Modelling and Analysis in UML

Transformational Design with

UML Profiles Radovan Cervenka

Metamodeling directed relationships in UML

Index. business modeling syntax 181 business process modeling 57 business rule 40

Computation Independent Model (CIM): Platform Independent Model (PIM): Platform Specific Model (PSM): Implementation Specific Model (ISM):

Supporting and Applying the UML Conceptual Framework

Software Architecture

Model Driven Architecture Action Semantics and Action Languages

Metamodeling. 16. April 2012 Real-Time Systems Lab Prof. Dr. Andy Schürr Dr. Gergely Varró 1

UML PROFILING AND DSL

Model Querying with Graphical Notation of QVT Relations

Copying Subgraphs within Model Repositories

CWM: Model Driven Architecture

What is OCL? OCL/Context

CSSE 490 Model-Based Software Engineering: Introduction to Domain Engineering

Software Design, Modelling and Analysis in UML

Outline. A little history. Outline. The Unified Modeling Language Opportunities and Challenges for Formal Methods

Software Design, Modelling and Analysis in UML

Algebraic Semantics of EMOF/OCL Metamodels

Software Design, Modelling and Analysis in UML

Modelling in Enterprise Architecture. MSc Business Information Systems

A Tour of Language Customization Concepts COLIN ATKINSON University of Mannheim Mannheim Germany

Rich Hilliard 20 February 2011

Syntax. A. Bellaachia Page: 1

Software Design, Modelling and Analysis in UML

UNIT-II Introduction to UML

UNIT II. Syllabus. a. An Overview of the UML: Visualizing, Specifying, Constructing, Documenting

It s all Done with Mirrors Patterns and OCL. KMF Kent Modelling Framework D.H.Akehurst and O.Patrascoiu

Software Language Engineering of Architectural Viewpoints

CISC836: Models in Software Development: Methods, Techniques and Tools

UML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools

Model Driven Architecture - The Vision

Modellierung operationaler Aspekte von Systemarchitekturen. Master Thesis presentation. October 2005 March Mirko Bleyh - Medieninformatik

COSC 3351 Software Design. An Introduction to UML (I)

On the link between Architectural Description Models and Modelica Analyses Models

Metamodeling and Metaprogramming

Coral: A Metamodel Kernel for Transformation Engines

SUMMARY: MODEL DRIVEN SECURITY

Language engineering and Domain Specific Languages

8/22/2003. Proposal for VPI model PSL assertion extensions

OCL for the Specification of Model Transformation Contracts

UML big picture. Perdita Stevens. School of Informatics University of Edinburgh

A Metamodel-Based OCL-Compiler for UML and MOF

MODEL DRIVEN ARCHITECTURE (MDA)

02291: System Integration

UML 2.0 State Machines

Plan. Language engineering and Domain Specific Languages. Language designer defines syntax. How to define language

Model transformations. Overview of DSLE. Model transformations. Model transformations. The 4-layer architecture

Multidimensional Key, Version 1.0

Science of Computer Programming. Aspect-oriented model-driven skeleton code generation: A graph-based transformation approach

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

CHAPTER 1. Topic: UML Overview. CHAPTER 1: Topic 1. Topic: UML Overview

The Specifications Exchange Service of an RM-ODP Framework

Metamodeling and Metaprogramming

Enabling Component-Based Model Transformations with QVT. Li Dan

OCL Support in MOF Repositories

Unifying the Semantics of Models and Meta-Models in the Multi-Layered UML Meta-Modelling Hierarchy

The Substitution Model

Grammars. Prof. Andreas Prinz. Introduction, Compilers. Examples Meta-models vs. Grammars Summary

On Using UML Profiles in ATL Transformations

AUTHOR(S) Jacqueline Floch CLIENT(S) SINTEF Telecom and Informatics CLASS. THIS PAGE ISBN PROJECT NO. NO. OF PAGES/APPENDICES

Event Metamodel and Profile (EMP) Proposed RFP Updated Sept, 2007

OO Analysis and Design with UML 2 and UP

Implementing the eodl graphical representation

Compositional Model Based Software Development

Horváth Ákos Bergmann Gábor Dániel Varró István Ráth

Improving the Definition of UML

Softwaretechnik. Lecture 03: Types and Type Soundness. Peter Thiemann. University of Freiburg, Germany SS 2008

Lecture 22: Meta-Modelling

Orthographic Service Engineering

THIS DOCUMENT IS STILL UNDER STUDY AND SUBJECT TO CHANGE. IT SHOULD NOT BE USED FOR REFERENCE PURPOSES.

Web Engineering. Winter Term 2006/07 Prof. Dr. Gregor Engels. Chapter II: Modeling of Web Applications Part 2

Model-Driven Language Engineering

UML Semantics 2. Contents. Section Title. This chapter contains the following sections.

Developing Web-Based Applications Using Model Driven Architecture and Domain Specific Languages

CSCE 314 Programming Languages. Type System

Modelling Constraints

Metamodeling. What is Metamodeling? Dimensions on Metamodeling The Information Resource Dictionary Standard (IRDS) Repositories

with openarchitectureware

Model Driven Engineering (MDE)

Advanced Object-Oriented Analysis Concepts

A UML 2 Profile for Variability Models and their Dependency to Business Processes

Security Issues Formalization

MDD with OMG Standards MOF, OCL, QVT & Graph Transformations

Transcription:

Softwaretechnik Model Driven Architecture Meta Modeling Prof. Dr. Peter Thiemann Universität Freiburg 22.06.2009 PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 1 / 36

Metamodeling Intro What? meta = above Define an ontology of concepts for a domain. Define the vocabulary and grammatical rules of a modeling language. Define a domain specific language (DSL). Why? Concise means of specifying the set models for a domain. Precise definition of modeling language. How? Grammars and attributions for textbased languages. Metamodeling generalizes to arbitrary languages (e.g., graphical) PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 2 / 36

Metamodeling Uses Construction of DSLs Validation of Models (checking against metamodel) Model-to-model transformation (defined in terms of the metamodels) Model-to-code transformation Tool integration PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 3 / 36

Excursion: Classifiers and Instances Excursion: Classifiers and Instances Classifier diagrams may also contain instances Instance description may include name (optional) classification by zero or more classifiers kind of instance instance of class: object instance of association: link etc optional specification of values PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 4 / 36

Excursion: Classifiers and Instances Excursion: Notation for Instances Instances use the same notation as classifier Box to indicate the instance Name compartment contains name:classifier,classifier... name:classifier :classifier anonymous instance : unclassified, anonymous instance Attribute in the classifier may give rise to like-named slot with optional value Association with the classifier may give rise to link to other association end direction must coincide with navigability PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 5 / 36

Excursion: Classifiers and Instances Excursion: Notation for Instances (Graphical) Ship name : String gross weight : Integer country : String Sailor name : String rank : String <<instance of>> <<instance of>> <<instance of>> QE2 : Ship name = "QE2" gross weight = 70327 country = "GB" captainbates : Sailor name = "N. Bates" rank = "Captain" PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 6 / 36

Terminology Terminology/Syntax well-formedness rules abstract syntax just structure, how are the language concepts composed concrete syntax defines specific notation typical use: parser maps concrete syntax to abstract syntax PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 7 / 36

Terminology Terms/Abstract Syntax Example: Arithmetic expressions abstract syntax data Expr = Const String Var String Binop Op Expr Expr data Op = Add Sub Mul Div Binop Mul (Const "2") (Binop Add (Var "x") (Const "3")) concrete syntax 2 * (x + 3) E ::= c x E B E (E) B ::= + / PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 8 / 36

Terminology Terms/Abstract Syntax Example: UML class diagram concrete syntax Person name salary raise() abstract syntax :Class name = "Person" :Attribute name = "name" :Operation name = "raise" :Attribute name = "salary" PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 9 / 36

Terminology Terms/Static Semantics Static semantics defines well-formedness rules beyond the syntax Examples Variables have to be defined before use Type system of a programming language "hello" * 4 is syntactically correct Java, but rejected UML: static semantics via OCL expressions Use: detection of modeling/transformation errors PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 10 / 36

Terminology Terms/Domain Specific Language (DSL) Purpose: formal expression of key aspects of a domain Metamodel of DSL defines abstract syntax and static semantics Additionally: concrete syntax (close to domain) dynamic semantics for understanding for automatic tools Different degrees of complexity possible configuration options with validity check graphical DSL with domain specific editor PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 11 / 36

Model and Metamodel Model and Metamodel PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 12 / 36

Model and Metamodel Model and Metamodel Domain of discourse Model Metamodel "real world" elements describes model elements describes metamodel elements Insight: Every model is an instance of a metamodel. Essential: instance-of relationship Every element must have a classifying metaelement which contains the metadata and is accessible from the element Relation Model:Metamodel is like Object:Class Definition of Metamodel by Meta-metamodel infinite tower of metamodels meta relation always relative to a model PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 13 / 36

Model and Metamodel Metamodeling a la OMG OMG defines a standard (MOF) for metamodeling MOF (Meta Object Facilities) used for defining UML Confusion alert: MOF and UML share syntax (classifier and instance diagrams) MOF shares names of modeling elements with UML (e.g., Class) Approach Restrict infinite number of metalevels to four Last level is deemed self-describing PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 14 / 36

Model and Metamodel Metamodeling and OCL <<metaclass>> UML::Attribute name: String [...] type: Type context Attribute: <<metaclass>> inv: Type.Name == "String" CM::ConfigParam OCL constraints are independent of the modeling language and the metalevel OCL on layer Mn + 1 restricts instances on layer Mn PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 15 / 36

OMG s Four Metalevels OMG s Four Metalevels describes M3: Meta Metamodel instanceof Typ: Classifier ID: 5346456 Name: Classifier describes M2: Metamodel describes M1: Model describes M0: Instances instanceof instanceof instanceof Typ: Classifier ID: 764535 Name: Klasse Features: Attributes, Operations, Assoc s,.. Typ: Klasse ID: 21436456 Name: Person Attribute: Name, Firstn. Operations:... Association:... Typ: Person ID: 05034503 Name: Doe Given name: John PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 16 / 36

OMG s Four Metalevels Layer M0: Instances Level of the running system Contains actual objects, e.g., customers, seminars, bank accounts, with filled slots for attributes etc Example: object diagram PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 17 / 36

OMG s Four Metalevels Layer M1: Model Level of system models Example: UML model of a software system Class diagram contains modeling elements: classes, attributes, operations, associations, generalizations,... Elements of M1 categorize elements at layer M0 Each element of M0 is an instance of M1 element No other instances are allowed at layer M0 PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 18 / 36

OMG s Four Metalevels Relation between M0 and M1 M1: Model of a System Customer title : String name : String Order number : String name : String <<instance of>> :Customer title = "Dr" name = "Joe Nobody" <<instance of>> :Customer title = "Mr" name = "Mark Everyman" <<instance of>> M0: System :Order number = "200604" name = "somename" PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 19 / 36

OMG s Four Metalevels Layer M2: Metamodel Model of Model Level of modeling element definition Concepts of M2 categorize instances at layer M1 Elements of M2 model categorize M1 elements: classes, attributes, operations, associations, generalizations,... Examples Each class in M1 is an instance of some class-describing element in layer M2 (in this case, a Metaclass) Each association in M1 is an instance of some association-describing element in layer M2 (a Metaassociation) and so on PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 20 / 36

OMG s Four Metalevels Relation between M1 and M2 M2: Model of a Model name: String UML Class name: String UML Attribute <<instance of>> <<instance of>> <<instance of>> M1: Model :UML Class name = "Customer" name = "Order" :UML Class :UML Attribute name = "number" PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 21 / 36

OMG s Four Metalevels Layer M3: Meta-Metamodel Level for defining the definition of modeling elements Elements of M3 model categorize M2 elements: Metaclass, Metaassociation, Metaattribute, etc Typical element of M3 model: MOF class Examples The metaclasses Class, Association, Attribute, etc are all instances of MOF class M3 layer is self-describing PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 22 / 36

OMG s Four Metalevels Relation between M2 and M3 MOF Class M3: Model of a Model of a Model name: String <<instance of>> <<instance of>> M2: Model of a Model :MOF Class name = "UML Class" :MOF Class name = "UML Attribute" PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 23 / 36

OMG s Four Metalevels Overview of Layers MOF Class name: String M3: Model of a Model of a Model <<instance of>> UML Class name: String <<instance of>> M2: Model of a Model UML Attribute name: String <<instance of>> <<instance of>> <<instance of>> <<instance of>> M1: Model of a System Customer title: String name: String Order number: String name: String <<instance of>> <<instance of>> <<instance of>> M0: System Customer Customer Order title = "Dr" name = "Joe Nobody" title = "Mr" number = "200604" name= "M. Everyman" name = "somename" PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 24 / 36

OMG s Four Metalevels Excerpt from MOF/UML Model Element Import Namespace Constraint Tag Feature generalizes Generalizable Element Behavioral Feature Package Classifier Operation Exception can throw Association Class PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 25 / 36

Extending UML Designing a DSL Extending UML Designing a DSL PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 26 / 36

Extending UML Designing a DSL Designing a DSL Definition of a new M2 language from scratch too involved Typical approach: Extension of UML Extension Mechanisms Extension of the UML 2 metamodel applicable to all MOF-defined metamodels Extension using stereotypes (the UML 1.x way) Extension using profiles (the UML 2 way) PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 27 / 36

Extending UML Designing a DSL Extending the UML Metamodel Extended UML Metamodel MOF UML::Class CM::Component <<instanceof>> <<instanceof>> MOF::Classifier <<instanceof>> generalizes MOF sanctions the derivation of a new metaclass CM::Component from UML::Class CM::Component is an instance of MOF::Classifier the generalization is an instance of MOF s generalizes association PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 28 / 36

Extending UML Designing a DSL Extending the UML Metamodel/Concrete Syntax (1) (2) (4) <<CM::Component>> CustomAdmin::Person <CM::Component>> CustomAdmin::Person {metaclass=cm::component} <<instanceof>> CustomAdmin::Person (3) <<component>> CustomAdmin::Person (5) CustomAdmin::Person 1. Explicit instance of metaclass 2. Name of metaclass as stereotype 3. Convention 4. Tagged value with metaclass 5. Own graphical representation (if supported) PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 29 / 36

Extending UML Designing a DSL Adding to a Class UML::Class <<CM::Component>> CustomAdmin::Person {transactional = true} CM::Component transactional: boolean just inheriting from UML::Class leads to an identical copy Adding an attribute to the CM::Component metaclass leads to an attribute value slot in each instance notation: tagged value (typed in UML 2) PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 30 / 36

Extending UML Designing a DSL Extension Using Stereotypes (UML 1.x) <<metaclass>> UML::Class <<stereotype>> <<stereotye>> CM::Component {<<taggedvalue>> transactional} Simple specialization mechanism of UML No recourse to MOF required Tagged Values untyped No new metaassociations possible PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 31 / 36

Extending UML Designing a DSL Extending Using Profiles (UML 2) definition use <<metaclass>> UML::Class <<stereotype>> CM::Component transactional: boolean <<CM::Component>> CustomAdmin::Person {transactional = true} Extension of the stereotype mechanism Requires Extension arrow as a new UML language construct (generalization with filled arrowhead) Not: generalization, implementation, stereotyped dependency, association,... Attributes typed tagged values Multiple stereotypes possible PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 32 / 36

Extending UML Designing a DSL More on Profiles Profiles make UML into a family of languages Each member is defined by application of one or more profiles to the base UML metamodel Tools should be able to load profiles and corresponding transformations Profiles have three ingredients stereotypes tagges values constraints Profiles can only impose further restrictions Profiles are formally defined through a metamodel PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 33 / 36

Extending UML Designing a DSL Profile Metamodel PackageImport Package appliedprofile {subsets 1 importedpackage} n ProfileApplication n Profile imported Profile {subsets importedpackage} 1 Association 1 {subsets ownedmember} Class 1 /metaclass /extension n Extension 1 Property 1 owned Stereotype n Stereotype type 1 n ExtensionEnd PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 34 / 36

Extending UML Designing a DSL Example Profile for EJB <<profile>> EJB Component <<stereotype>> Bean context Bean: inv: realization > select( hasstereotype( "Remote" )) >size()=1 && realization > select( hasstereotype( "Home" )) >size()=1 <<stereotype>> EntityBean <<stereotype>> SessionBean kind: StateKind Artifact <<stereotype>> JAR <<enumeration>> stateful stateless StateKind Interface <<stereotype>> Remote <<stereotype>> Home PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 35 / 36

Extending UML Designing a DSL Further Aspects of Profiles Stereotypes can inherit from other stereotypes Stereotypes may be abstract Constraints of a stereotype are enforced for the stereotyped classifier Profiles are relative to a reference metamodel e.g., the UML metamodel or an existing profile Most tools today do not enforce profile-based modeling restrictions, so why bother with profiles? constraints for documentation specialized UML tools validation by transformer / program generator PT (Univ. Freiburg) Softwaretechnik Model Driven Architecture Meta Modeling 22.06.2009 36 / 36