DEVELOPING YOUR OWN MODELING LANGUAGE Teaching Material for the Book Model-Driven Software Engineering in Practice by Marco Brambilla, Jordi Cabot, Manuel Wimmer

DEVELOPING YOUR OWN MODELING LANGUAGE Teaching Material for the Book Model-Driven Software Engineering in Practice by Marco Brambilla, Jordi Cabot, Manuel Wimmer

Chapter 7 DEVELOPING YOUR OWN MODELING LANGUAGE Teaching material for the book Model-Driven Software Engineering in Practice by Marco Brambilla, Jordi Cabot, Manuel Wimmer. Morgan & Claypool, USA, 2012. Copyright © 2012 Brambilla, Cabot, Wimmer. www.mdse-book.comMarco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Content • Introduction • Abstract Syntax • Graphical Concrete Syntax • Textual Concrete Syntax Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. INTRODUCTION www.mdse-book.comMarco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Introduction What to expect from this lecture? . Motivating example: a simple UML Activity diagram . Activity, Transition, InitialNode, FinalNode ad Course workflow Attend lecture Study content Write exam . Question: Is this UML Activity diagram valid? . Answer: Check the UML metamodel! . Prefix „meta“: an operation is applied to itself . Further examples: meta-discussion, meta-learning, … . Aim of this lecture: Understand what is meant by the term „metamodel“ and how metamodels are defined. Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Introduction Anatomy of formal languages 1/2 . Languages have divergent goals and fields of application, but still have a common definition framework Formal languages Semantics Meaning of 1..1 language elements Language elements, i.e., grammar 1..* Abstract Syntax 1..* Notation of language elements 1..* Concrete Syntax Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Introduction Anatomy of formal languages 2/2 . Main components . Abstract syntax: Language concepts and how these concepts can be combined (~ grammar) . It does neither define the notation nor the meaning of the concepts . Concrete syntax: Notation to illustrate the language concepts intuitively . Textual, graphical or a mixture of both . Semantics: Meaning of the language concepts . How language concepts are actually interpreted . Additional components . Extension of the language by new language concepts . Domain or technology specific extensions, e.g., see UML Profiles . Mapping to other languages, domains . Examples: UML2Java, UML2SetTheory, PetriNet2BPEL, … . May act as translational semantic definition Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. ABSTRACT SYNTAX www.mdse-book.comMarco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Introduction Spirit and purpose of metamodeling 1/3 . Metamodel-centric language design: All language aspects based on the abstract syntax of the language defined by its metamodel Modeling Constraints Model 2 Model Textual Transformations Concrete Syntaxes Metamodel Model 2 Text Graphical Transformations Concrete Syntaxes Models Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Introduction Spirit and purpose of metamodeling 2/3 . Advantages of metamodels . Precise, accessible, and evolvable language definition . Generalization on a higher level of abstraction by means of the meta-metamodel . Language concepts for the definition of metamodels . MOF, with Ecore as its implementation, is considered as a universally accepted meta-metamodel . Metamodel-agnostic tool support . Common exchange format, model repositories, model editors, model validation and transformation frameworks, etc. Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Introduction Spirit and purpose of metamodeling 3/3 4-layer Metamodeling Stack Examples «conformsTo» defines Meta- M3 Meta-Metamodel MOF, Ecore Language «conformsTo» Language Language defines Engineering M2 Metamodel Language UML, ER, … «conformsTo» represents M1 Model System UniSystem, … «conformsTo» Domain Domain Model represents A UniSystem Engineering System M0 Instance Snapshot Snapshot Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. MOF – Meta Object Facility Language architecture of MOF 2.0 . Abstract classes of eMOF Taxonomy of abstract classes . Definition of general properties . NamedElement Object . TypedElement Element . MultiplicityElement . Set/Sequence/OrderedSet/Bag NamedElement . Multiplicities name:String Type 0..1 type TypedElement isInstance(element:Element): Boolean MultiplicityElement isOrdered: Boolean = false isUnique: Boolean = true lower: Integer upper: UnlimitedNatural Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. MOF – Meta Object Facility Language architecture of MOF 2.0 . Core of eMOF . Based on object-orientation . Classes, properties, operations, and parameters TypedElement MultiplicityElement Type Property Class isReadOnly: Boolean = false ownedAttribute isAbstract: Boolean default: String [0..1] 0..1 * 0..1 isComposite: Boolean = false opposite isDerived: Boolean = false TypedElement MultiplicityElement TypedElement MultiplicityElement 0..1 superclass * ownedParameter Operation Parameter * * ownedOperation raisedException Type * Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Example 1/9 . Activity diagram example . Concepts: Activity, Transition, InitialNode, FinalNode . Domain: Sequential linear processes ad Course workflow Attend Study Write lecture content exam . Question: How does a possible metamodel to this language look like? . Answer: apply metamodel development process! Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Example 2/9 Identification of the modeling concepts Example model = Reference Model ad Course workflow Attend Study Write lecture content exam Notation table Syntax Concept ad name ActivityDiagram FinalNode InitialNode name Activity Transition Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Example 3/9 Determining the properties of the modeling concepts Example model ad Course workflow Attend Study Write lecture content exam Modeling concept table Intrinsic Extrinsic Concept properties properties ActivityDiagram Name 1 InitialNode 1 FinalNode Unlimited number of Activities and Transitions FinalNode - Incoming Transitions InitialNode - Outgoing Transitions Activity Name Incoming and outgoing Transitions Transition - Source node and target node Nodes: InitialNode, FinalNode, Activity Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Example 4/9 Object-oriented design of the language MOF Class Attribute Association Concept Intrinsic properties Extrinsic properties ActivityDiagram Name 1 InitialNode 1 FinalNode Unlimited number of Activities and Transitions FinalNode - Incoming Transition InitialNode - Outgoing Transition Activity Name Incoming and outgoing Transition Transition - Source node and target node Nodes: InitialNode, FinalNode, Activity outgoing Metamodel 1..* 1 Transition0..1 incoming incoming 1 1 outgoing 1 ActivityDiagram target 0..1 0..1 source name : String 1..* Activity name : String 1 FinalNode target 0..1 InitialNode 0..1 1 source Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Example 5/9 outgoing * Transition 1 Overview incoming 1 incoming 1 1 outgoing ActivityDiagram target 0..1 0..1 source name : String * Activity name : String Metamodel 1 target FinalNode 0..1 “uni-directional link” InitialNode 0..1 1 source Abstract syntax 2:InitialNode 3:FinalNode 1:ActivityDiagram 7:Transition 8:Transition 9:Transition 10:Transition name=“Course workflow” 4:Activity 5:Activity 6:Activity name=„Attend..” name=„Study…“ name=„Write…“ Model Concrete ad Course workflow syntax “bi-directional link” Attend Study Write lecture content exam Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Example 6/9 Applying refactorings to metamodels transitions * Transition incoming 0..1 0..1 outgoing ActivityDiagram target 1 1 source name : String * Node nodes name : String Metamodel FinalNode InitialNode ActivityNode context ActivityDiagram inv: self.nodes -> exists(n|n.isTypeOf(FinalNode)) inv: self.nodes -> exists(n|n.isTypeOf(InitialNode)) context FinalNode inv: self.outgoing.oclIsUndefined() context InitialNode OCL Constraints OCL inv: self.incoming.oclIsUndefined() context ActivityDiagram inv: self.name <> '' and self.name <> OclUndefined … Marco Brambilla, Jordi Cabot, Manuel Wimmer. Model-Driven Software Engineering In Practice. Morgan & Claypool 2012. Changes: Example 7/9 . Deletion of class Activity Impact on existing models . Addition of class ActivityNode . Deletion of redundant references * Transition incoming 1..* 1..* outgoing ActivityDiagram target 1 1 source name : String * Node name : String Metamodel FinalNode InitialNode ActivityNode Abstract syntax 2:InitialNode 3:FinalNode 1:ActivityDiagram 7:Transition 8:Transition 9:Transition 10:Transition name=“Course workflow” 4:Activity 5:Activity 6:Activity Model name=„Att…“ name=„Study…“ name=„Write…“ Validation

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    76 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us