1 / 31

Breathe life into your metamodels Weaving behavior into Metamodels with Kermeta Didier Vojtisek

Breathe life into your metamodels Weaving behavior into Metamodels with Kermeta Didier Vojtisek Triskell Project-Team http://www.irisa.fr/triskell. Outline. Rationale What is Kermeta? Kermeta In Action What For? (task oriented view) How To? (metamodel oriented view) Conclusion.

inigo
Download Presentation

Breathe life into your metamodels Weaving behavior into Metamodels with Kermeta Didier Vojtisek

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Breathe life into your metamodels Weaving behavior into Metamodels with Kermeta Didier Vojtisek Triskell Project-Team http://www.irisa.fr/triskell

  2. Outline Rationale What is Kermeta? Kermeta In Action What For? (task oriented view) How To? (metamodel oriented view) Conclusion

  3. Rationale • Metamodel technology is well adapted to build tool and to capture DS(M)L concepts (ie. Its abtstract syntax) • Model, meta-model, meta-metamodel, DSLs, … • Meta-bla-bla too complex for the normal engineer • Designing DSML and associated tool chain is usually done by software engineer • On the other hand, engineers are familiars with • OO programming languages (Java,C#,C++,..) • UML (at least class diagram) • May have heard of Design-by-Contract • Kermeta leverages this familiarity to make Meta-modeling easy for the masses Kermeta Rationale

  4. Breathing life into Meta-Models // MyKermetaProgram.kmt // An E-MOF metamodel is an OO program that does nothing require "StateMachine.ecore"// to import it in Kermeta // Kermeta lets you weave inaspects // Contracts (OCL WFR) require “StaticSemantics.ocl” // Method bodies (Dynamic semantics) require “DynamicSemantics.kmt” // Transformations Kermeta Rationale Context FSM inv: ownedState->forAll(s1,s2| s1.name=s2.name implies s1=s2) aspect class FSM { operation reset() : Void { currentState := initialState }} class Minimizer { operation minimize (source: FSM):FSM {…} }

  5. Outline Rationale What is Kermeta? Kermeta In Action What For? (task oriented view) How To? (metamodel oriented view) Conclusion

  6. Kermeta, a Kernel to Meta Kermeta Actions Constraints Transformations Metadata What is Kermeta?

  7. Kermeta:a Kernel metamodeling language • Strict EMOF extension • Statically Typed • Generics, Function types (for OCL-like iterators) • Object-Oriented • Multiple inheritance / dynamic binding / reflection • Model-Oriented • Model are first class citizens, notion of model type • Design by contract • Aspect-Oriented • Simple syntax for static introduction • Arbitrary complex aspect weaving as a framework • Still “kernel” language • Seamless import of Java classes in Kermeta for GUI/IO etc. What is Kermeta?

  8. Operational semantic • Operational semantic of MM is expressed into Kermeta which in turn is formalized into F. Fleurey's Phd Thesis • For example : OCL behavior is translated in Kermeta before evaluation • This operational semantics acts as a reference implementation What is Kermeta?

  9. Outline Rationale What is Kermeta? Kermeta In Action What For? (task oriented view) How To? (metamodel oriented view) Conclusion

  10. Example class State{ reference owningFSM : FSM[1..1]#ownedState attribute name : String attribute outgoingTransition : Transition[0..*]#source reference incomingTransition : Transition#target operation step(c : String) : kermeta::standard::~Void isdo end } class Transition{ reference source : State[1..1]#outgoingTransition reference target : State[1..1]#incomingTransition attribute input : String attribute output : String operation fire() : String isdo end } class FSM { attribute ownedState : State[0..*]#owningFSM reference initialState : State[1..1] reference currentState : State operation run() : kermeta::standard::~Void isdo end operation reset() : kermeta::standard::~Void isdo end } Kermeta in action : FSM example

  11. Example Kermeta in action : FSM example operation fire() : String source.owningFSM.currentState := target result := output

  12. operation step(c : String) : String // Get the valid transitions var validTransitions : Collection<Transition> validTransitions := outgoingTransition.select { t | t.input.equals(c) } // Check if there is one and only one valid transition if validTransitions.empty thenraise NoTransition.new end if validTransitions.size > 1 then raise NonDeterminism.new end // fire the transition result := validTransitions.one.fire Kermeta in action : FSM example

  13. operation run() : Void fromvar str : String until str == "exit" loop stdio.writeln("current state is " + currentState.name) str := stdio.read("Enter an input string or 'exit' to exit simulation : ") stdio.writeln(str) if str != "exit"then do stdio.writeln("Output string : " + currentState.step(str)) rescue (ex : FSMException) stdio.writeln("ERROR : " + ex.toString) end end end stdio.writeln("* END OF SIMULATION *") Kermeta in action : FSM example

  14. Kermeta in action : FSM example /** * Load a sample FSM from a xmi2 file */ operation loadFSM() : FSM isdo var repository : EMFRepository init EMFRepository.new var resource : EMFResource resource ?= repository.createResource("../models/fsm_sample1.xmi", "../metamodels/fsm.ecore") resource.load // Load the fsm (we get the main instance) result ?= resource.instances.one end

  15. Improve MM design using Kermeta weaving • For example to separate abstract syntax from semantic domain require "FSM.ecore" aspect class FSM { reference currentState : State operation run() : Void is do … end operation reset() : Void is do … end } … Kermeta in action : FSM example

  16. Kermeta workbench • Metamodel engineering environment • Editors (textual and graphical) (syntax highlighting, autocompletion, …) • Interpreter, (compiler is under development) • Workflow manager (user customizable transformation automation) • Various views • Compatibility with existing MM developed in Eclipse EMF • Connexion to team and third-party tools to build DSL/DSML • Concrete syntax examples : GMF/Topcased, Sintaks, … Kermeta in action

  17. Kermeta workbench snapshot Kermeta in action

  18. Outline Rationale What is Kermeta Kermeta in Action What For? (task oriented view) How To? (metamodel oriented view) Conclusion

  19. Kermeta: What For? • Prototype operational semantics of MM • Get an instant interpreter for it • Generative environment for DSMLs • Complemented with Sintaks & TopcaseD editor generators • Static checking of models & transformations • Beyond WFR, model type conformance • Does T(MM1 m1) work for a model m2 conforming to MM2? • Alternative to QVT style Model Transformation • Model level aspect weaving • The AOSD-Europe Model Aspect Weaver What For?

  20. Kermeta as a model transformation language • One of the possible use case of Kermeta • Should allow to express all kind of transformations • However, the language itself aims to stay minimal (a kernel for metamodeling) • Specific features (such as rules, …) can be implemented as a framework or within a MDK • With Kermeta the transformation is simply an object-oriented program that manipulates model elements What For?

  21. B B C C A H MOF + actions == Transformation Metamodel == Kermeta metamodel D E :F :H :E :C :A F :C :C Transformation model Target model Transformation execution + eventual behavior if the source or target metamodels are expressed with Kermeta Transformations directly with Kermeta MOF MOF Source Metamodel Target Metamodel What For? Source model

  22. Model level aspect weaving • At model level, Aspect Weaving boild down to: • Pattern matching (aka join point detection) • May be non trivial, with wildcards or semantic based • Model composition • Respecting WFRs • Kermeta approach • Arbitrary complex algorithms encapsulated into frameworks for model weaving • Simple syntax for simple cases • The implementation vector of AOSD-Europe approaches What For?

  23. Using aspect weaving to build Kermeta What for ? Kermeta design See PA Muller et al. , « Weaving executability into meta-models » in Proc. MODELS 2005 for details

  24. Outline Rationale What is Kermeta? Kermeta In Action What For? (task oriented view) How To? (metamodel oriented view) Conclusion

  25. Kermeta Model Development Kits • How to organize tasks in a consistent fashion around metamodels? • MDK (Model Development Kit) = an OO/AO framework for a given Metamodel • Implementation of the operations of the metamodel • Constraints such as WFR • Library of useful transformations for this metamodel • Ex: interpreter and/or compiler in the case of a language, … • Provide support for concrete syntax • tree, graphical and textual editors using Kermeta generators (Sintaks) or thirdparty tools (from TopCaseD) How-to: MDK

  26. Examples of MDKs • Production (operational use intended) • Ecore/Kermeta • Sintaks (concrete syntax <-> model) • RDL (Requirement Description Language) • UML2.1 • Profiles such as SysML, SPEEDS, MARTE • Java5 (complete metamodel based on Spoon) • And also Tracability, CWM, DocBook… • Research • Pattern matching, advanced model composition, model testing, … • Demos/Tutorials • FSM, Logo… How-to: MDK

  27. Application example : Logo turtle robot Logo Semantic in Kermeta Semantic mapping Static constraints in OCL AS VM Transformation written in Kermeta Input scenario Embedded source code inside the robot Simulator in Kermeta Interaction between the current simulation (Kermeta) and the GUI (Java) Result of a real execution Result of a simulation interpreted with Kermeta

  28. Used in RT projects • Artist2, the European network of excellence on real-time embedded systems • UsineLogicielle, a System@tic project where Kermeta based operational semantic is associated to functional requirement for test synthesis purposes. • Speeds, a European FP6 project for aspect-oriented metamodeling of avionics and automotive systems, including operational semantics aspects • OpenEmbedd, A French project building a MDE platform for realtime system. • Mopcom, a French project applying MDE to hardware for generating SOC and introduce dynamic reconfigurability to them. • Topcased, a consortium that aims to build modelers for avionics and system engineering How-to?

  29. Outline Rationale What is Kermeta? Kermeta In Action What For? (task oriented view) How To? (metamodel oriented view) Conclusion

  30. Conclusion • Kermeta is for the normal Software Engineer • Not just for PhDs • It’s just OO, plus a bit of Aspects and design by contract if needed • Lets you develop bunches of useful things around metamodels and encapsulate them into MDK • With static type checking through model types • Kermeta is a no risk approach • Your metamodels stay standard E-MOF MM • Can use whatever other tools are needed Conclusion

  31. Smoothly interoperates • with Eclipse/EMF • Open Source, available on the INRIA Forge • Download it now! • Home page • http://www.kermeta.org • Development page • http://kermeta.gforge.inria.fr/ Conclusion Breathe life into your metamodels

More Related