MoScript a textual DSL for model manipulations
Upcoming SlideShare
Loading in...5
×
 

MoScript a textual DSL for model manipulations

on

  • 760 views

 

Statistics

Views

Total Views
760
Views on SlideShare
760
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

MoScript a textual DSL for model manipulations MoScript a textual DSL for model manipulations Presentation Transcript

  • MoScript: A DSL for querying and manipulating model repositories Wolfgang Kling Frédéric Jouault Marco Brambilla Dennis Wagelaar Jordi Cabot21/11/11 ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   1
  • Context  Large numbers of modelling artefacts –  E.g. MDD phases consume and produce models Requirements Use Case Class Diagram Java Project Transfo rma-on s    Stored in model repositories  Strong interrelations21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   2  
  • Context  Not only models (source code, 0110010 1010100 01100101 1010010 01010010 1010001 10010101 tools, libraries etc.) 0001101    Heterogeneous  Distributed  Constant evolution of the repository 01100101 01010010 10010101 00011010 001  21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   3  
  • Motivation  Understand repository (updated view) 0100101 0100010 1010  Finding models –  By their content –  By a computed characteristic ? –  By their relation with other models  Combining models information  Perform common modelling 010010 010010 010010 101000 101010 tasks batch processing 101000 101000 101010 101010 21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   4  
  • MoScriptA textual DSL for querying and manipulatingmodel repositories  Retrieve models –  by structure and content –  by their relations with others –  by behaviour (after a simulation)  Manipulate models (transform, match, compare etc.) right after finding them  Update repository view, persisting newly created artefacts or discarding existing ones21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   5  
  • MoScript  Based on the megamodel (repository view)  Uses OCL  Combines OCL with –  Operations without side effects –  Statements (update view and repository)21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   6  
  • MoScript  and  the  Megamodel   MoScript   Megamodel 011 011 011 001 001 001 Model Repositories21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   7
  • Megamodel’s Metamodel * target Identified * source Entity Element * linked * * elements * Model Relationship * relatedTo conformsTo 1 * Reference Terminal * sourceOf * Directed Model Model Relationship * targetOf extends * MetaMeta Weaving 1 Model Model Transformation MetaModel Model Mega Transformation Transformation Model Record targetReferenceModel srcReferenceModel targetModel srcModel21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   8  
  • So far … (OCL and Megamodel)  Models conforming to the Java metamodel Model::allInstances()−>select(m | m.conformsTo.kind = ’Java’)" Collection{ Model1, Model2 …, Modeln }"  Transformations that transform models conforming to the Java metamodel Transformation::allInstances()" "−>select(t | t.srcReferenceModels.exists(rm | rm.kind = ’Java’))" Collection{ Transformation1, Transformation2 …, Transformationn }"21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   9  
  • Strategy t (x)=  y  Synchronize   x  21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   10  
  • MoScript Abstract Syntax OCL MoScript MoScript OclExpression Unit PropertyCallExp Helper Library Program OperationCallExp ExpressionStat Statement QueryOp ProjectionOp RegisterStat SaveStat ForStat TransformOp StateCheckOp RemoveStat BindingStat IfStat21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   11  
  • MoScript Concrete Syntax program program_name" uses library1" uses …" [ using {" "variable1 : type = OclExpr;" "variable2 …" }]" do {" "variable <- OclExpr;" "save(OclExpr, …);" "remove(OclExpr, …);" "register(…);" "if …" "for …" }" helper …"21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   12  
  • Brief Examples  Query operations Model::allInstances()−>any(m | m.indentifier = ’SimpsonFamily’) " −>allContents()−>collect(el | el.name))" Collection {’Bart’, ’Homer’, ’Lisa’, ’Maggie’, ’Marge’} "  Model to Model transformations (M2M) 1" let j2dNet : Transformation = Transformation::allInstances()" 2" "−>any(t | t.identifier = ’j2dNet’)" 3" in" 4" 5" Model::allInstances()" 6" "−>select(m | m.conformsTo.kind = ’Java’)) " 7" "−>collect (jModel | j2dNet.applyTo(jModel))" TransformationRecord::allInstances()−>collect(tr | tr.run())"21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   13  
  • Brief Examples  Projectors (inject & extract) Model::allInstances()−>select(m | m.conformsTo.kind = ’JavaGrammar’)) " "−>collect (jCode|jCode.inject())"  The save statement 1" ... for(dNetModel in dNetModels) {" 2" " "save( dNetModel, dNetModel.getIdentifier()," 3" dNetModel . location + ’.xmi’);" 4" } " 5" 6" helper context Model def: getIdentifier(): ... ;"  The register statement" register(MetaMetaModel, ’Ecore’, ’http://www.eclipse.org/emf/2002/Ecore’);"21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   14  
  • MoScript Operations Without Side Effects Model :: allContents() : Collection(OclAny)" Model :: allContentsRoots() : Collection(OclAny)" Model :: allContentsInstancesOf(type_name : String) : Collection(OclAny)" Model :: allContentsInstancesOf(type : OclAny) : Collection(OclAny)" Transformation :: applyTo(inputModels : Sequence(Model)) : TransformationRecord" Transformation :: applyTo(inputModels : Map(String, Model)) : TransformationRecord" TransformationRecord :: run() : TransformationRecord" Model :: inject() : Model" Model :: extract() : Model" Model :: available() : Boolean" Model :: isDirty() : Boolean"21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   15  
  • MoScript Statements With Side Effects save(m : Model, mgm : Megamodel, id : String, locator : String)" remove(m : Model, mgm : Megamodel)" register(elem : OclModelElement, id : String, locator : String)" register(elem : OclModelElement, attrs : Map(String, OclAny))"21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   16  
  • MoScript  Underlying   DSLs   Editors   Discoverers   1 Architecture   MoScript   2 3 6 Megamodel 5 Metadata  Engine   TransformaIon   Tools   4 011 011 011 001 001 001 Model Repositories21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   17
  • ImplementaIon   MoScript   ATL  VM   GMM / AM3 ATL ATL VM AM3 TCS ANTLR ATL Zoo WebML 011 011 011 001 001 001 Model Repositories21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   18
  • Eclipse plugin21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   19  
  • Experimentation  ATL Transformation Zoo model repository http://www.eclipse.org/m2m/atl/atlTransformations/ –  205 metamodels, 275 models, 219 transformations and 400 other artefacts  Reverse engineering megamodel generation  Different kind of metrics  Execution of all the transformations and check results  Matching models  WebML model repository –  WebModel metamodel –  WebModel xml (.wr) injection to ecore –  Transformation to WebML models –  Count user interface fields21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   20  
  • ConclusionsDSL for querying and manipulating model repositories•  Uses OCL•  Based on the Megamodel•  Model dereferencing•  Applies transformation to model similarly as working with functions.•  Allows the use of multiple transformation tools•  Makes types checking at run time to ensure consistency.•  Hides a lot of the complexity of handling large amounts of modelling artefacts and relationships, to the user•  Keeps synchronized the megamodel with the repository to ensure integrity21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   21  
  • END Thank you for attending21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   22  
  • ATL Transformations Zoo21/11/11   ©  AtlanMod    -­‐    atlanmod-­‐contact@mines-­‐nantes.fr   23