Based on material developed in ATHENA (IST-507849) and MODELWARE (IST-511731) 6-1c. MOFScript - Model to Text Transformation,

Slides:



Advertisements
Similar presentations
Profiles Construction Eclipse ECESIS Project Construction of Complex UML Profiles UPM ETSI Telecomunicación Ciudad Universitaria s/n Madrid 28040,
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Programming Languages and Paradigms
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
MOF Model to Text Transformation - MOFScript
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
 2005 Pearson Education, Inc. All rights reserved Introduction.
Query/Views/Transformations © 2006 ATLAS Nantes Query/Views/Transformations An introduction to the MOF 2.0 QVT standard with focus on the Operational.
© The ATHENA Consortium. CI2: The ATHENA Interoperability Framework Module 2: e-Procurement Scenario Furniture Sector 2.
Whole Platform Tesi di Dottorato di: RICCARDO SOLMI Università degli Studi di Bologna Facoltà di scienze matematiche, fisiche e naturali Corso di Dottorato.
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Guide To UNIX Using Linux Third Edition
Principles of Procedural Programming
C++ fundamentals.
Basic Elements of C++ Chapter 2.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
© The ATHENA Consortium. CI2: The ATHENA Interoperability Framework Module 3: Collaborative Product Development Scenario Aeronautics and Aerospace.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Advanced Applications Of Model-to-Model Transformation © 2008 INRIA Advanced Applications Of Model-to-Model Transformation Hugo Bruneliere & Frédéric.
© The ATHENA Consortium. EM1 - Enterprise Modelling as a way to achieve Interoperability Module 4 - How does Enterprise Modelling address these.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
A First Program Using C#
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.
An Approach and Tool for Synchronous Refactoring of UML Diagrams and Models Using Model-to-Model Transformations Hafsteinn Þór Einarsson Helmut Neukirchen.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
© The ATHENA Consortium From PIM4SOA to Peer-2-Peer (P2P),
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
© The ATHENA Consortium. CI2: The ATHENA Interoperability Framework Module 1: The ATHENA Interoperability Framework.
Java Class Syntax CSIS 3701: Advanced Object Oriented Programming.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
MDA and QVT  Tom Gullion, Director of Product Management, Together Products.
Model transformation with a dedicated imperative language IRISA Rennes (France) - Triskell team Jean-Marc Jézéquel Didier Vojtisek Jean-Philippe Thibault.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
Alignment of ATL and QVT © 2006 ATLAS Nantes Alignment of ATL and QVT Ivan Kurtev ATLAS group, INRIA & University of Nantes, France
© The ATHENA Consortium. CI3 - Practices of Interoperability in SMEs Carrier-Shipper Scenario.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
© The ATHENA Consortium. EM1 - Enterprise Modelling as a way to achieve Interoperability Module 1 - What is Enterprise Modelling?
© The ATHENA Consortium. 6-3b. Atlas Transformation Language (ATL) Tutorial / Exercise,
© The ATHENA Consortium. AP6 – Model-Driven Development of Interoperable Web Services, Agents and P2P Solutions Learn about model transformations.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
© The ATHENA Consortium. CI2: The ATHENA Interoperability Framework Module 5: Supply Chain Management (SCM) Automotive sector.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
© The ATHENA Consortium. EM1 - Enterprise Modelling as a way to achieve Interoperability Module 3 - What interoperability problems does Enterprise.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
ModTransf A Simple Model to Model Transformation Engine Cédric Dumoulin.
Based on material developed in ATHENA (IST ), INTEROP (IST ) and MODELWARE (IST ) 6-1b. Atlas Transformation Language (ATL) with RSM.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
UML Profile BY RAEF MOUSHEIMISH. Background Model is a description of system or part of a system using well- defined language. Model is a description.
Course Title Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 03 Conditional statement 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER)
New Project Model UI Primary Author: Mikhail Sennikovsky Major contributors: Mikhail Voronin, Oleg Krasilnikov, Leo Treggiari Intel Corporation September,
© The ATHENA Consortium. CI3 - Practices of Interoperability in SMEs Proposed Solutions.
Ontologies Reasoning Components Agents Simulations An Overview of Model-Driven Engineering and Architecture Jacques Robin.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
© The ATHENA Consortium. 5-2b. Eclipse Modeling Framework (EMF) Tutorial / Exercise,
5-4b. Eclipse Process Framework (EPF) Tutorial / Exercise
Definition of the Programming Language CPRL
Topic: Python’s building blocks -> Variables, Values, and Types
Java Primer 1: Types, Classes and Operators
Towards Automatic Model Synchronization from Model Transformation
Gøran K. Olsen SINTEF ICT Norway Thursday
Anatomy of a Java Program
Tutorial 10: Programming with javascript
Software Architecture & Design
Presentation transcript:

Based on material developed in ATHENA (IST ) and MODELWARE (IST ) 6-1c. MOFScript - Model to Text Transformation,

2 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Outline Background Introducing the MOFScript language MOFScript and the MOF MOFScript and the relation to QVT Details of the MOFScript language Example1: From UML class diagram to Java MOFScript advanced features The MOFScript tool

3 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Background

4 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) The MOF model to text transformation RFP The Model to Text Transformations RFP (ad/ ) asks for proposals that define a language that provides capabilities for generating text output from MOF models, e.g. in order to support code generation, documentation, etc. Important in this regard, is capabilities to perform string manipulation. Proposals shall define a solution for generating text from MOF 2.0 models. Proposals shall reuse existing OMG language specifications (e.g. such as QVT capabilities) Proposals shall be able to support complex text transformation mappings.

5 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Consortium Submitters: (supporter) Also supported by the following MODELWARE partners:

6 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript – Background Usability –Ease of use: Writing and understanding –Few constructs End user recognisability –Similar to programming and scripting languages Sequential execution semantics –Rules are called explicitly Might also support pattern matching execution –Contents of rules is executed sequentially Compatibility –Alignment with QVT

7 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Introducing the MOFScript language

8 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) What is MOFScript? The MOFScript tool is an implementation of the MOFScript model to text transformation language – An Eclipse plug-in (Feature) Developed by SINTEF ICT in the EU-supported MODELWARE project Ongoing standardization process within OMG –OMG RFP MOF Model to Text Transformation process –MOFScript tool and language is part of this process –Competing proposal:...

9 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript in action Documentation UML MOFScript Program code XML RDBMS BPMN MOF MODELS Lexical output

10 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript language features (1) Rules –Rules are invoked explicitly. Output of text –Standard print mechanism (println) –Escaped output Files –Generation of named files Collections and Iterators –Collection types (List, Hashtable/Dictionary) –Iterators: Loops on collections (or Strings/Integers)

11 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript language features (2) String handling –Functions for String manipulation Types –String, Boolean, Integer, Real, List, Dictionary/Hashtable Variables and constants –Global or local, explicitly or implicitly typed. Utility functions –Utility & system functions: time(), date(), getenv(), setenv(), indent(), tab(), space(), position(), count() Side effects –Variables can be modified –MOF Script has side effects, in the sense that variables can be declared and manipulated during the lifetime of a transformation. It does not, however affect the source models.

12 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Basic QVT extensions

13 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Text transformation

14 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Mapping body

15 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Variables and constants

16 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Output expressions OutputExpression –OutputExpression represents an expression that generates textual output to some device, typically an output file or standard output console. OutputDeviceExpression –concept that represents the declaration of an output device, such as a file. FileDeviceExpression –Device tailored for file output StdOutDeviceExpression –Device for std output EscapedOutputExpression –Escaped text output

17 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Iterator extensions QVT defines a range of iterators and block expressions QVT also defines block expressions which are blocks executed in sequence –E.g. while ForEachExp and If also as block statements self.ownedMembers->forEach (p:uml.Package | p.stereotype = “System”) { <% // the package declration package org.mofscript.%> p.name <% %> if (self.name = “Person”) { } else { }

18 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Function libraries String library –Various string manipulation functions, such as: Size, substring, subStringBefore|After, toLower, toUpper, indexOf, trim, endsWith, startsWith, replace, equals, equalsIgnoreCase,… Collection library –Standard collection operations… Hashtable: put, get, clear, size, isEmpty List: add, size, clear, isEmpty Utility library –Various utility functions, such as Time, date, Indent, unindent, newline(count: int), tab(count : int), position() {numbered position within an iterator}, … XML library –Functions to support XML manipulation

19 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Details of the MOFScript language

20 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Textual syntax Textmodule Rules Iterators Files Escaped output <% public class %> c.name <% extends Serializable { %> file f2 (c.name + “.java”) c.ownerPackage.name f2.println (“public class” + c.name); uml.Package::mapPackage () { self.ownedMember->forEach(c:uml.Class) <% c.name %> } textmodule UML2Java (in uml:uml2) access library variousJavaStuff ("uml2java_include.m2t")

21 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Textual syntax If expression Printing Collections, Vars stdout.println (“\t Printing to standard out…”) dclFile.println (”Print to file” + c.name) print (”\n\n print to declared context”) <% escaped output print … … %> c.name <% … %> if (self.name = “Person”) { } else { } var packageNames:List var packageIdList:Hashtable self.ownedMember->forEach(p:uml.Package) { packageNames.add (p.name) packageIdList.put (p.id, p.name) } if (packageIdList.size () > 0) { packageIdList->forEach (s:String | not(s.startsWith(“S”)) { s }

22 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Textual syntax Invoking rules Return results uml.TypedElement::getType () : String { if (self.type.name.equalsIgnoreCase("string")) result = "xsd:string" else result = self.type.name } uml.Package::interfacePackages () { if (self.getStereotype() = “Service”){ file (rootdir + self.name.toLower() + ".wsdl") self.wsdlHeader() self.wsdlTypes() self.ownedMember->forEach(i:uml.Interface) { i.wsdlMessages() i.wsdlPortType() i.wsdlBindings() i.wsdlService() } self.wsdlFooter() }

23 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript extends QVT mappings Relations MappingsGraphical QVTMerge MOFScript imperative imperative procedural procedural side-effects side-effects uni-directional uni-directional object-oriented object-oriented OCL-based OCL-based lexical lexical

24 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript a transformation language Language for writing model to text transformations Rules / Operations are called explicit (Procedural language) Partly based on the current QVT specification (keeps it within the family) Transforms input models to output text files –Input: UML, ecore or your own based on it Supports EMF meta-models and models as input –UML2, Ecore, etc..

25 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) General syntax of a mapping operation From the last QVTMerge-spec: The general syntax for the body of a mapping operation is: mapping X::mappingname ( p1:P1, p2:P2) : r1:R1, r2:R2 when { … } where { … } { init { … } population { … } end { … } }

26 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Example1: From UML class diagram to Java

27 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Example (1) textmodule UML2Java (in m1:UML) property package_name = "org.sintef.no" property package_dir = "org/sintef/no/" property ext = ".java" property author = "Jon Oldevik" /* * Entrypoint */ main () { m1.ownedMember->forEach(p:uml.Package) p.mapPackage () } /* * mapPackage */ void uml.Package::mapPackage () { p.ownedMember->forEach(c:uml.Class) c.mapClass() }

28 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Example (2) void uml.Class::mapClass () { file f1 (name=self.name, ext=”txt”, dir=package_dir, type=”text”) file f2 (“Test.dilldall”) use file f3 (package_dir + self.name + ext) self.standardClassImport () self.standarClassHeaderComment () <% public class %> c.name <% extends Serializable { %> self.ownedAttribute->forEach(p:uml.Property | p.association = "") p.classPrivateAttribute(self) newline(2) self.ownedAttribute->forEach(p:uml.Property | p.association <> "") p.classPrivateAssociations() newline(2) self.ownedAttribute->forEach(p:uml.Property | p.association = "") p.attributeGettersSetters() newline(2) <% } %> }

29 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Example (3) // classPrivateAttribute void uml.Property::classPrivateAttribute (uml.Class owner) { <% private String _%> self.name.toLower() self.visibility <% // Type :... %> self.type println(" // This was the private attributes \n\n") }

30 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript advanced features

31 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Change management Proposed metamodel for handling: –Links from a model toward code blocks –Traces from a model to text blocks –Controlled by user unprotect { } –The resulting code will be generated with protected blocks Identifying the start and end the section Code is protected by user-defined tags E.g. comment tags

32 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Traceability model

33 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) The MOFScript tool

34 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) What is MOFScript? An Eclipse plug-in (feature) Developed at SINTEF ICT

35 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript architecture

36 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) MOFScript a model to text tool Provides the means of: –Editing, compiling and executing the transformations Syntax high-lightning Content assist

37 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) GUI overview

38 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) Tool (continued) Editor –Syntax highlighting –Context sensitive / content assist Outline viewer –View the Preference pages –Setting global preferences File properties –Setting preferences for a single transformation file Actions –Compile, execute, convert to model,…

39 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) References

40 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) References OMG MOF Model to Text Transformation RFP. bin/apps/doc?ad/ pdf bin/apps/doc?ad/ pdf MOFScript submission. MOFScript tool.

41 Based on material developed in ATHENA (IST ) and MODELWARE (IST ) This course has been developed under the funding of the EC with the support of the EC ATHENA-IP Project. Disclaimer and Copyright Notice: Permission is granted without fee for personal or educational (non-profit) use, previous notification is needed. For notification purposes, please, address to the ATHENA Training Programme Chair at In other cases please, contact at the same address for use conditions. Some of the figures presented in this course are freely inspired by others reported in referenced works/sources. For such figures copyright and all rights therein are maintained by the original authors or by other copyright holders. It is understood that all persons copying these figures will adhere to the terms and constraints invoked by each copyright