Ingnierie des principes modles aux outils Jean Bzivin
Ingénierie des principes modèles : aux outils Jean Bézivin & Marcos Didonet del Fabro [Jean. Bezivin|Marcos. Didonet]{no. Spam. At}univ-nantes. fr ATLAS Group (INRIA & LINA), University of Nantes, France http: //www. sciences. univ-nantes. fr/lina/atl/ Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Schedule • Model Driven Engineering: – Scope & Applicability – Principles – Deployment (AMMA) • An example of MDE tool – The ATLAS Model Weaver Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The playground MOF, 2000 today, AMMA Tools UML, 1995 Standards Principles s. Nets, 1990 tomorrow Teaching Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Principles, standards and tools Principles Model-Driven Engineering (MDE) Standards MDA™ Model-Driven Architecture (OMG) Tools Eclipse EMF GMF MIC Model Integrated Computing GME Software Factories (MS) Other Standards Microsoft Visual Studio Team system DSL Tools Other Tools Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
IBM on MDA : Three complementary ideas 1. Direct representation 2. Automation 3. Standards Direct representation => multiple languages Danger of fragmentation Need coordination How to coordinate? Short answer: metamodel But what is a metamodel? Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Agenda Scope & Applicability Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Introduction • The industrial evolution (OMG MDA™, IBM EMF, Microsoft Software Factories) and the MDE trend • The need for sound principles (models as first class entities) • Technology spaces or why MDE is not sufficient Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The initial move: from Middleware to Modelware Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Latest tentative to define MDA Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Steve Cook (OOPSLA 2004 panel) Suggests that MDA proponents fall into the following three camps: 1. The UML PIM camp: MDA involves the use of UML to build Platform Independent Models (PIMs) which are transformed into Platform Specific Models (PSMs) from which code is generated. 2. The MOF camp: MDA does not involve the use of UML, but instead the crucial technology is MOF, and the definition of modelling languages and language transformations using MOF. 3. The Executable UML camp: MDA involves building a UML compiler, making it a first class programming language. Ref: Steve Cook Blog @: http: //blogs. msdn. com/stevecook Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
OMG Proposal M 3 The MOF(Meta Object Facility) meta-meta model The UML and a collection of metamodels M 2 metamodel Some UML and other models. M 1 model M 0 Various usages of these models "the real world" Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
MDA in a nutshell : PSM = f(PIM) M 3 M 2 - One unique Metamodel (the MOF) - An important library of compatible Metamodels, each defining a DSL - Each of the models is defined in the language of its unique metamodel M 1 Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The initial MDA conjecture : PSM = f(PIM) PIM branch PIMs (Platform Independent Models) Merging phase PDM branch weaving ? M PSMs (Platform Specific Models) PDMs (Platform Description Models) PSM branch Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Two missing links in the OMG architecture PIM PDM PSM = f(PIM, PDM) or after currying: PSM = f. PDM(PIM) PSM “numeric” values: PDM = Dot. Net PDM = EJB Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Microsoft Software Factories • SDK (Team System) released in late 2004 – First presentation at OOPSLA, Vancouver, Oct. 2004 – See S. Cook, S. Kent, J. Greenfield and K. Short Blogs • Aims to be closer to a meta. CASE tool than Eclipse – (however follow GMF Borland) • Not UML-based (nor MOF, nor XMI) • Models strongly tied to code – Reverse engineering/synchronization – Reliance on Microsoft’s platforms (Visual studio) … Modeling is the future … Bill Gates Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
MDE@Microsoft • Microsoft is releasing a suite of tools to make it easy to construct graphical designers hosted in Visual Studio for editing domain specific languages (DSL). Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Creating the Petri net DSL (Hillairet-Piers project) v Petri metamodel Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Creating the Petri net DSL (Hillairet-Piers project) v On lance un nouveau projet DSL. v On choisit le template Blank Language pour commencer notre métamodèle. v On nomme notre projet Reseaude. Petri. Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Creating the Petri net DSL (Hillairet-Piers project) Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Creating the Petri net DSL (Hillairet-Piers project) v Une fois le métamodèle totalement défini, on effectue les opération suivantes v Generate all code : génère le code C# qui va être utilisé par l’éditeur de modèle, il est généré à partir des fichiers. dmd et. dd. v Build solution : compilation du code généré. v Start : lancement de l’éditeur de modèles. Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Creating the Petri net DSL (Hillairet-Piers project) Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Multiple technical spaces Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The notion of TS (Technology Space) as a tool for collaboration • Description logic A Technology Space corresponds to: Java – A uniform representation system • • – – • • Syntactic trees XML trees Sowa graphs UML graphs MOF graphs Categories Graph Grammars Prolog C++ Corba XML documentware WWW A working context A set of concepts A shared knowledge and know how etc. It is usually related to a given community with an established expertise, know-how and research problems It has a set of associated tools and practices, etc. Corba MDA Modelware Ontologies RDBMS Graph Theory – Protégé, Rational Rose, … Semantic WEB Linux Grammarware Journées Académiques Microsoft 2005 - Paris OOBMS etc. © 2005 ATLAS Nantes
Abstract Syntax Systems Compared Technology #1 Technology #2 Technology #3 Technology #4 (formal grammars (MOF + OCL) (XML Meta-Language) (Ontology engineering) attribute grammars, etc. ) M 3 EBNF MOF M 2 Pascal Language Grammar The UML meta-Model M 1 A specific Pascal Program A Specific UML Model A specific execution of a Pascal program A Specific phenomenon corresponding to a UML Model Journées Académiques Microsoft 2005 - Paris etc. © 2005 ATLAS Nantes
A technical space is organized around a set of concepts Spaces may be connected via bridges Spaces are often similarly organized Grammar Schema Syntax XML Program Document Meta-Model MDA Model Schema DBMS Data Top Level O. Ontology engineering Ontology Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
But also: UML MM ~ Visio Stencil Grammar Schema Syntax XML Program Document Meta-Model MDA Model Stencil Visio Drawing FORM Info. Path Content Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Models revisited • Everything is a model – – – A -model meaning any specific TSpace An XML document is an XML-model A Java source program is a Java-model An UML model is a MDA-model etc. • Each TSpace is rooted in a metamodel defining a representation scheme and basic type system. • Distinguish between intra-space and inter-space operations Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Technical Spaces and Working Contexts • Technical Spaces – Examples: MDE, MDA, MS/SF, EBNF, XML, DBMS, ontologies, etc. – Conjecture: • Each TS is represented by a metamodel • Each TS is organized in a 3 metalevel architecture • Working contexts – Local • MM specific – Global • TS specific, MM independent – Universal • Across several TSs (extended MIME notation) – Mof 1. 4/UML/mymodel – Microsoft. DSL/Petri. Net/My. Net – ECORE/Petri. Net/My. Net – EBNF/Pascal/My. Prog – XML/Music. ML/My. Music – M 3/M 2/M 1 Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Agenda Applicability Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Some examples of transformations • Classical – UML 2 Java – UML 2 RDBMS • But also tool to tool (more important) – UML Activity Diagrams to MS Project Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The KM 3 metamodel* *The KM 3 metamodel used in this presentation has been simplified. However, it still contains enough concepts to be usable. Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
KM 3 definition of the KM 3 metamodel NOT XMI package KM 3 { abstract class Model. Element extends Located. Element { attribute name : String; reference "package" : Package opposite. Of contents; } class Package extends Model. Element { reference contents[*] ordered container : Model. Element opposite. Of "package"; } class Classifier extends Model. Element {} class Data. Type extends Classifier {} class Class extends Classifier { attribute is. Abstract : Boolean; reference supertypes[*] : Class; reference structural. Features[*] ordered container : Structural. Feature opposite. Of owner; } -- continued on next slide Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Java to Excel Transformation (call graph) First. Class. java public class First. Class { public void fc_m 1(){ } public void fc_m 2(){ this. fc_m 1(); } } Second. Classs. java public class Second. Class { public void sc_m 1(){ First. Class a = new First. Class(); a. fc_m 1(); } public void sc_m 2(){ this. sc_m 1(); } } Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Java and Table Metamodels Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
UMLDI 2 SVG Semantic Preserving Transformation? Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Tool Interoperability Tool X Tool Y • Tool interoperability • Build a metamodel of each tool • Write a transformation • Two kinds of Metamodels • Data stream oriented • Event oriented AMMA ATL AMW AM 3 ATP Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Agenda Principles Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
What about the stability of MDA? • Missing foundations may cause big problems ahead Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Just an academic issue anyway? Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Enter the "metamuddle" Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Model of a model Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The MDA metamuddle • A very rapidly growing industrial application field since november 2000, • … but … • We badly need a unifying theory of models Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Credits and MDA compliance Language engineering MDE Ontology engineering Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The "representation" relation ? rep. Of System and System elements Model and Model elements Simple set interpretation of the rep. Of relation is probably as correct as simple set interpretation of the instance. Of relation in object technology. Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The "conformance" relation meta the MOF M meta-meta 3 model The MOF M 3 The UML metamodel M 2 metamodel Some UML Models meta M 1 M 0 model "the real c 2 Various usages world" of these models source Class destination c 2 meta Association meta the UML Meta. Model M 2 1 Class c 2 * meta Attribute meta a UML Model M 1 Client Name : String Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Research agenda: Everything is a model • What is a model? – A model is a representation of a system – A model is written in the language of its unique metamodel – A metamodel is written in the language of its unique metamodel • The unique MMM of the MDA is the MOF • MS/DSLTools has an implicit MMM – A model is a constrained directed labeled graph – A model may have a visual representation • Where do models come from? • What are the various kinds of models? Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Transformations as models (QVT) Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Uniform access to models and metamodels MMa MMt MMb Ma Mt Mb Transformation Engine Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Summary • The definition of a model is TSpace-dependent • Generally a model is a graph • Which kind of graph is defined by the metamodel (M 3) of the technical space. – For MOF-models it is non oriented graphs with labeled end of edges – For ECORE-models it is slightly different – For Microsoft-DSL-models it is completely different • It is thus possible to cope with different M 3 – Then it will be important to distinguish between M 2 level transformations and M 3 level transformations Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Agenda Deployment Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
AMMA: A Lightweight Architectural Style for Generic Model Management Platforms • • • ATLAS Model Management Architecture Build around a minimal set of sound principles Defines the conventions for the various connected tools to interoperate Lightweight : Not reinventing CORBA Model-based interoperability and not Middelware-based interoperability Four basic blocks: AMMA ATL AMW AM 3 ATP Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Atlas Model Management Architecture • Modeling in the small – Working at the level of model and metamodel elements • Modeling in the large – Working with models and metamodels as global entities, for what they represent, and their mutual relations, independently of their content – A megamodel is a model which elements represents models, metamodels and other global entities (ako model registry with metadata on models and metamodels). A megamodel has a metamodel. Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
ATL: a model transformation language, engine and IDE • ATL: a MOF/QVT compliant model transformation language • For more info see: http: //www. sciences. univnantes. fr/lina/atl/ Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
ATL editor (part of ATL Integrated Development Environment) Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The standard OMG model transformation language ATL is a QVT-like language Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
The Model Weaver: principles Stub MM extends Left MM Weaving MM Operation. Port maps. To - Fixed mapping metamodels are not sufficient - We need support for extensible variable metamodels Right MM Operation. Type c 2 Weaving model Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
AM 3: ATLAS Mega. Model Management Tool • • Megamodel: a model with elements corresponding to models, metamodels, services, tools and more generally to any global resource available in the scope of an AMMA session. A registry for model engineering resources as well as a metadata repository Megamodel with different metamodels Megamodels beyond typing systems MM version. Of MM’ extension. Of type. Of M MM’ type. Of Service input output Parameter implements M intput T Tool Journées Académiques Microsoft 2005 - Paris etc. © 2005 ATLAS Nantes
Some fragments of the Megamodel’s Metamodel Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Initial Metamodel Proposal for AMMA Megamodel Components Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Megamodel Resource Navigator for model components • • Extension of Resource View According to metadata, tools may be available for an element Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
MS/Office Simulink Matlab etc. ATP: TS and projectors XMI JMI CMI etc. ATLAS Technical Projectors π1 TSpace #2 EBNF grammar TSpace #4 SQL program data. Schema TSpace #1 MDA data mmodel TSpace #3 XML π3 π2 XMLschema document Journées Académiques Microsoft 2005 - Paris Java Corba SVG NLP, etc. © 2005 ATLAS Nantes
Conclusions: AMMA on top of Eclipse and MS/DSL tools AMMA EMF Team System Eclipse Visual Studio ATL MTF KM 3 Emfatic etc. Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Conclusions • Transformations are models • Weavings (correspondences) are models • Megamodels are models • (meta-)Models everywhere – – – A file format A tool internal data A Visio stencil An Infopath Form An API etc. • Pragmatics of model transformation are important • EMF and MS/DSL may be considered as two TSpaces, based on different M 3 Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
ATLAS Model Weaver Using weaving to define generic model correspondences Marcos Didonet Del Fabro marcos. didonet-del-fabro @ univ-nantes. fr Ph. D student (2004 - 07) Supervisors: Jean Bézivin and Patrick Valduriez Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Overview • Model weaving – Models – Use cases • Data mapping – Weaving as models • Model Weaver workbench – Common weaving core – Representations • DSL Tools, Eclipse EMF Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Models • Model – set of elements and associations • Associations (intra model relationships) Model E 1 has. A E 3 E 2 references Semantic defined in the metamodel inherits E 4 – Correspondences (inter model relationships) Model 1 Model 2 E 1 is. A E 3 E 2 E 1 E 3 E 4 Semantics undefined Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Model weaving • Model weaving – Establishes correspondences with semantics • Use cases – Transformation specifications – Data exchange – Heterogeneous data integration – Schema integration Library (RDBMS) Books ISBN Title Author. ID Publisher Author AID Name Data mapping Library (XML) Books ISBN Title Publisher. ID Authors AID Name Publisher PID Name Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Data mapping today • SQL - View integration - SQL statements - SQL-like queries - Matching algorithms (Sem. Int, Similarity Flooding, etc) • XSLT • Ontology mapping – Ontology bridges – Ontologies for business integration • Generic model management – Morphisms • Model weaving – Creates a weaving model Requirements: Expressiveness, Performance, Adaptability, Matching, … Application X: which is the most adapted solution? Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Weaving as models • Use of same model management primitives! – Add, delete, update, navigation. • Expressiveness – Attach semantics – Foreign keys, nested constraints, ordering, etc. • Hard to express with 1 -1 correspondences Library (RDBMS) Books ISBN Title Subject. ID Publisher FK Constraint Subjects SID Description Weaving model Library (XML) Nested Books Constraint ISBN Title Publisher. ID Subjects SID Description New ID Publisher PID Name Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Weaving as models • Performance – Weaving (mapping) definition, not execution • Same weaving to produce: – ATL –> model transformation language – XSLT –> XML – SQL –> relational databases – Morphisms -> generic model management – etc. • Adaptability • Minimal metamodel + extensions • Matching based extensions Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Weaving metamodel • Minimal weaving metamodel – links and correspondences – extended to be used in different applications Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Metamodel extensions • Several mapping DSLs (Domain Specific Languages) • Adding extra semantics – Concatenation, foreign keys, nested, ordered, equals, containment, supplier/consumer, etc. Model 2 Model 1 Equals E 1 E 2 • E 2 E 1 Concat E 3 E 4 String Weaving model + ( 1 – N ) woven models Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Model weaving implementation • DSL tools, Eclipse EMF – DSL metamodel • Concepts, role, relationships • Object model (a single. dmd file) – EMF metamodel • Ecore • • EMF Injectors <-> DSL Tool Extractor DSL Tool Injector <-> EMF Extractor Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Textual representation weaver. dmd and mwcore. ecore Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Weaving metamodel Visualization (DSL tools and EMF) Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
AMW example: RDBMS to XML • Metamodel extensions Weaving metamodel represented in KM 3 Extension de base: correspondences, models, links Extension DBMXML: FK, nested, equals Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
AMW example: RDBMS to XML Semantics XML schema represented in Ecore SQL schema represented in Ecore Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Same weaving, many representations ATL and XSLT Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
ATL XMI and ATL text Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
XSLT Ecore and XSLT text Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
AMW example result IN: RDBMS representation in XMI <? xml version="1. 0" encoding="UTF-8"? > <Root: Database xmi: version="2. 0" xmlns: xmi="http: //www. omg. org/XMI" xmlns: Root="http: //relational. Meta. Schema. ecore" xmi: id="Database 1"> <books xmi: id="Books 6"> <book. Rcds xmi: id="Book. Rcd 7" ISBN="4455: 33446: FR" Title="Model Weaving" Author="Myself" SID="1"/> <book. Rcds xmi: id="Book. Rcd 8" ISBN="44: 55: 66: US" Title="Data mapping" Author="Ralf" SID="2"/> </books> </Root: Database> OUT: XML document <? xml version="1. 0" encoding="ASCII"? > <Root: Root xmi: version="2. 0" xmlns: xmi="http: //www. omg. org/XMI" xmlns: Root="Root"> <books ISBN="4455: 33446: FR" Title="Model Weaving" Author="Myself"> <subjects Subject. ID="1" Description="MDD"/> </books> <books ISBN="44: 55: 66: US" Title="Data mapping" Author="Ralf"> <subjects Subject. ID="2" Description="Data mapping"/> </books> </Root: Root> <subjects xmi: id="Subjects 2"> <subject. Rcd xmi: id="Subject. Rcd 3" SID="1" Description="MDD"/> <subject. Rcd xmi: id="Subject. Rcd 4" SID="2" Description="Data mapping"/> <subject. Rcd xmi: id="Subject. Rcd 5" SID="3" Description="Computer Science"/> </subjects> Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Conclusion M 3 MOF ECore MMM/MS/DSL M 2 M 1 AMMA EMF/GMF Team System Eclipse Visual Studio Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
A first attempt to reverse engineer the DSL Metamodel Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
Thanks <Questions? <Comments? http: //www. sciences. univ-nantes. fr/lina/atl/ Journées Académiques Microsoft 2005 - Paris © 2005 ATLAS Nantes
- Slides: 84