20090224 mofscript tool
TRANSCRIPT
![Page 1: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/1.jpg)
MOFScript
Ander Zubizarreta
2009-3-18
![Page 2: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/2.jpg)
Big PictureBig Picture
<<conformsTo>>
Code
metamodel
Model
Transformation definition
template
![Page 3: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/3.jpg)
Big Picture (our example)Big Picture (our example)
C++ Code
Wtsl.ecore
Controllables.wtsl
Transformation definition
Cpp template
<<conformsTo>>
Wtsl.xsd
EMF
![Page 4: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/4.jpg)
ContentsContents
1. MOFScript Tool
2. MOFScript Language
3. Example
![Page 5: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/5.jpg)
MOFScript toolMOFScript tool
Eclipse plugin tool for model to text transformation supports generation of implementation code or
documentation from models
MOFScript M2T
<<conformsTo>>Doc
Code
![Page 6: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/6.jpg)
MOFScript toolMOFScript tool
Rule-based .m2t extension Allows various input models Code completion Transformations can also be represented as
models (XMI)
![Page 7: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/7.jpg)
MOFScriptMOFScriptCreating transformationCreating transformation
File New Other MOFScript File
1 2
![Page 8: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/8.jpg)
MOFScriptMOFScriptEditorEditor
![Page 9: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/9.jpg)
MOFScriptMOFScriptCompilingCompiling
![Page 10: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/10.jpg)
MOFScriptMOFScriptExecutingExecuting
Select input model
![Page 11: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/11.jpg)
MOFScriptMOFScriptConsoleConsole
![Page 12: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/12.jpg)
MOFScript languageMOFScript language
Transformation module– The definition of the transformation– Defined using keyword textmodule or texttransformation
– It defines the input metamodels– The body of the transformation module contains the
rules Transformation Inheritance
– Transformations can be extended using extends keyword
– Rules are inherited and they can be used or overriden in the subtransformation
![Page 13: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/13.jpg)
MOFScript languageMOFScript language
Imports– A transformation may import other transformations as
libraries
Variables and properties (constants)– Variables and properties can be declared either
globally or locally– They can be of any of the MOFScript types
![Page 14: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/14.jpg)
MOFScript languageMOFScript language
Rules– Elements of a rule:
• Context type -> metamodel type (optional)• Return type (optional)• Input parameters (optional)• Body -> set of statements
– Types of rules:• Entry point rules
– Defines where the execution starts -> main()– Defines for which metamodel element type it is executed– It is executed as many times as entry point type elements are in the input model
• Entry point rules without context type– It is executed only once
• Abstract rules– Abstract rules can be defined
– Rule Overriding• Rules can be overriden, either from imported transformation or within
the same transformation– Different rule with the same name will be called depending on the context type.
![Page 15: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/15.jpg)
MOFScript languageMOFScript language
Files– Declaration of an output device for text.– Declared using keyword file.– File name and extension are given as a parameter
If statements, Iterators, While statements, Select expressions, Printing, Logging, Expressions– Similar to other languages
Types– Strings, Integer, Real, Boolean, List, Hashtable, Object, Model
• Many operations available for each type Built-in functions
– Many built-in functions are available in MOFScript: System functions and Output utility functions
Other features:– Reflection support, Java invocation, UML2 integration,
Unprotected Blocks, Aspects, M2M transformation
![Page 16: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/16.jpg)
MOFScript languageMOFScript language
For more detailed information:– MOFScript Language Reference in Eclipse Help– Mofscript user guide:
http://www.eclipse.org/gmt/mofscript/doc/MOFScript-User-Guide.pdf
![Page 17: 20090224 MOFScript Tool](https://reader036.vdocuments.us/reader036/viewer/2022062614/5468dfa1b4af9f1c348b483a/html5/thumbnails/17.jpg)
For more information:– http://www.eclipse.org/gmt/mofscript/doc/MOFScript-User-Guide.
pdf–