Home
MOFScript User Guide
Contents
1. 4 15 Transformation inheritance A transformation may extends another transformation using the extends keyword Only single inheritance is allowed The sub transformation inherits all rules of the super transformation may override these and call the rules of the super using the super keyword The example below illustrates MOFScript User Guide version 0 9 MOFScript v 1 4 0 import TestInheritanceSuper m2t texttransformation TestInheritanceSub in ecmodel ecore extends TestInheritanceSuper ecmodel EPackage main self printMe ecmodel EPackage printMe stdout println TestIneritanceSub printMe lt super printMe stdout printin TestIneritanceSub printMe gt 4 16 Abstract rules MOFScript supports definition of abstract rules This may be useful in cases of refinement using rule overriding The example below defines an abstract rule for the metamodel element Element from the uml metamodel abstract uml Element uml2ecore 4 17 Rule overriding Transformation rules in MOFScript can override other rules either from imported transformations or within the same transformation This has two possible effects Overriding a rule with a new rule with a different context type the metaclass it applies to will have the effect that different rules with the same name will be called depending on the metatype This will have a kind of polymorphi
2. umi2java_indude m2t 524 21 06 05 14 54 jol New gt eg uml E project e 3 tneegoexam Cen g uML2wcox OpenAs gt MOFScript Test H E Aprote owy 6 B Paste P TestMoc 9 Delete 4 TestMoc f TestProl g amp uml2jave Rename D E Modes E Copy of o mofscrip 23 Export mofscrip MyProfilt 2 Refresh Servicen TestMog RUNAS K TestPro __ DebugAs gt TestUML WDdem output Profile Samples TestSuite Figure 10 MOFScript file popup Some other actions are available for mofscript model files with mofscript extensions namely converting the model to mofscript text or executing the model directly HG Example Trar f ______ roperty pi String pii H E JB New gt lar vi Integer 1 H E models Open F3 gt output l Model main Profile Open with if aaa aaa H E Samples Copy Ctrl Insert stdout printin 0l fg TestSuite Pact E SE else if aaa bbb H E aspects Paste nett stdout printin s amp examples Delete Delete else ae imp Build Path gt stdout println T i gt shires Refactor Alt Shift T gt if not aaa aaa 2i 2R stdout printin Nc AS std Bey Import else gt traceabil 5 z of Amat L Export stdout printin Ol self ownedMember gt fork oP Bmt P cma S Refresh F5 package mapPackage g converte Run As gt of D m2t o
3. self ownedMember gt forEach p uml Package p mapPackage An entry point may have a context type with several instances In that case the entry point will be executed for each instance of the type An example is shown below where the entry point context type is the umI Class uml Class main class self name Rules can be specified without context type so also entry point rules An entry point with no context type will be executed once It is specified using the module keyword or without any keyword To retrieve model input using this approach the model parameter to the transformation must be used combined with the operation objectsOfType to retrieve contained model objects module main uml objectsOfType uml Package MOFScript User Guide version 0 9 MOFScript v 1 4 0 or main uml objectsOfType uml Package The objectsOfType operation may be applied to any model element to retrieve a set of contained objects of a certain type 4 4 Rules Rules are basically the same as functions They can have a context type which is a metamodel type They may also have a return type which may be a built in type 4 6 or a model type The body of a rule contains a set of statements uml Package mapPackage self ownedMember gt forEach c uml Class c mapClass uml Class mapClass file package_dir self name ext self classPackage self standardClassImp
4. tab 4 More escaped output n n println Documentation output 4 9 Escaped output Escaped output provides a different and in some cases simpler way of providing output to a device Escaped output works similar to most scripting languages such as Java script Escaped output is signaled by escape characters beginning and ending of an escape Basically it is a print statement that can subsume multiple lines and be combined with all expressions that evaluate to a string Escaped text is signaled by MOFScript User Guide version 0 9 MOFScript v 1 4 0 the characters to start an escape and to end an escape Note that all whitespace is copied to the output device public class c nam xtends Serializable Note that it is also possible to signal escaped output with lt for starting and gt signaling the end of the output this is for historic and backward compatibility reasons lt oe public class gt c name lt extends Serializable oe gt 4 10 Iterators Iterators in MOF Script are used primarily for iterating collections of model elements from a source model The forEach statement defines an iterator over a collection of something such as a model element collection a list hashtable ora String Integer A forEach statement may be restricted by a type constraint collection gt forEach c someType where the type can be a metamode
5. x Shea EDER Problems 52 Javadoc Dedaration Console Properties SS a 3 errors 0 warnings 0 infos Filter matched 3 of 53 items OF outline 3 o Resource Sl Rules expecting a left parenthesis found keyword mofscript uml2ht E main uml Model 10 expecting Scoping found existing mofscript uml2ht E Test uml Package 29 unexpected token keyword mofscript uml2ht package 2htm uml Package 31 E dass2htmi_link uml Class 54 E dass2html_detail uml Class 66 In Folder mofscriptrepository mofscriptrepository mofscriptrepository gt E dass2htmlHeader fuml Class 1 85 E Writable Insert 6 5 Figure 2 Error presentation 3 3 Executing MOFScript files Execution of scripts can only be done if the scripts are free of errors A compilation is always done by the tool prior to execution MOFScript User Guide version 0 9 MOFScript v 1 4 0 The result of a transformation is normally a set of files generated to some location on the file system The Eclipse Console pane prints what is generated in terms of output files Execution is started with the execution action button P or the execute previous transformation button The first time a transformation is executed the user must select an input file A file selection dialog is launched where the user selects the source file for the transform
6. c getValue myStereoType myProperty 4 21 Unprotected Blocks MOFScript supports the notion of unprotected blocks These blocks are created with the use of the unprotect keyword in the transformation code as illustrated in the transformation code for operations below self ownedOperation gt forEach o uml Operation n o visibility void o name unprotect User code here for operation an The resulting code shown below represents the unprotected block as comments containing a BlockStart and a BlockEnd and an identifier for the source model element public void printAuthor BlockStart number 4 id _MeMJULEPEdu Vepu7rgPLg User code here for operation MOFScript User Guide version 0 9 MOFScript v 1 4 0 BlockEnd number 4 Between the block comments the user can insert or remove code and the changes will be preserved the next time the transformation is run All the traces that have references to the file after the block will also be generated in accordance with their new position in the file 4 22 MOFScript Aspect extension A prototype implementation of aspects for MOFScript is in place This is preliminary implementation and by no means complete For example there is not a lot of semantics checking of an aspect The MOFScript aspects work by inserting transformation code into a copy of the target transformation which is stored as a new transfor
7. MOFScript User Guide Version 0 9 MOFScript v 1 4 0 February 2011 Author Jon Oldevik MOFScript User Guide version 0 9 MOFScript v 1 4 0 1 3 Table of contents INERODUCHION aeaeaei feces luce deatene AN EEA AAA AA EEEE TAa RE AAA E TEES 4 Feature OVErViCW 0 0 ce ceceessccncecececeesencceeececeeeenesaaaeaeceeeseeneaaaaeaeceeeseenenaaeas 4 MOFScript within Eclipse cccccccssssscccececsssesscssceeeeeeeseessceseeeeseessessaaees 4 3 1 COdescOM pletion secs cccbedvce lies rareta teet hee ov uste snes aaae aiai anaana RE 5 3 2 Compiling MOFScript fileS cccsccssssececeeessesssseceeeeeeessessasseeeeeeeees 6 3 3 Executing MOFScript files ccccscessssecececessesssneseeeeeeessessaeseeeesenees 6 3 3 1 Executing with multiple input Models ccccsccccccecesssstteeeeees 7 3 3 2 The generated fils aaen aeaa aeaee aai anaa 8 3 4 Default repository for MOFScript ccccccccccesssssssseeececessesssteaeeeeseeses 9 3 9 Preferente Pa Re nhri assier dass a ii a suse Ea iaa K aaa 10 326 EIo IE eE A E E 11 3 7 Flep POPUP MANU 2 cccecessessseceeececessesseaeceeeesceeseaeaeceeeessessesaaeeeeess 11 3 85 New Me WiZard s sccasei akin hissed Gian tidivs soho adenine 13 The MOFScript Language cccccccssssecececeeeesesseaeeeeeessesseseaeeeeeeeseeseaees 13 AI TEXttransfOrmation sic sissies ccidess dacsveesadagwercsatans oaddage ds cdabareeeatageteccdestess 13 AD lWNPOMMS iets hits Mia ee ie
8. MOFScript User Guide version 0 9 MOFScript v 1 4 0 addBefore item list appends the objects in the list before a given item already in the list addAfter item list appends the objects in the list after a given item already in the list indexOf element Integer returns the index of a given element 4 20 4 Hashtable Operations The Hashtable operations put key Object value Object puts an element value with the key into the hashtable get key Object returns the value associated with the key parameter size Integer returns the size of the hashtable i e number of key elements clear void empties the hashtable keys List returns the list of keys in this hashtable values List returns the list of values in this hashtable first Object returns the first object in the hashtable last Object returns the last object in the hashtable isEmpty Boolean returns true if the list is empty size 0 false otherwise forEach iterator operation Iterator mechanism applied in the hashtable the iterator will iterator the values of the hashtable 4 20 5 PropertyMap Operations A PropertyMap is a specialisation of Hashtable In addition it offers the following operations to load and store properties load prop file loadXML xml prop file store prop file store
9. 4 19 2 1 _getOperations 4 19 2 2 _getReferences _getEReferences 4 19 2 3 _getEReference _getEFeature 4 19 2 4 _getTypeParameters 4 19 2 5 _getSuperTypes 4 19 2 6 _getFeatures 4 19 3 Reflection ops for EClassifiers 4 19 3 1 _getPackage Gets the package for a given classifier 4 19 3 2 _isInstance Checks if an object is an instance of the classifier 4 19 3 3 _eResource Gets the associated EResource from an EObject 4 20 Built in operations This chapter summarizes the MOFScript built in operations 4 20 1 String operations substring lower int upper int String o returns the substring from index lower to index upper subStringBefore beforeString String String MOFScript User Guide version 0 9 MOFScript v 1 4 0 o returns the substring of this string occurring before the beforeString subStringAfter afterString String String o returns the substring of this string occurring after the afterString toLower String o converts the string to lower case toUpper String o converts the string to upper case firstToUpper String o converts the first letter of the string to upper case firstToLower String o converts the first letter of the string to lower case size int o returns the size of the string indexOf indexStr String int o returns the index of the first occurrence of the indexStr or 1 if it does not exist endsWith str String
10. Boolean o returns true if the string ends with str else false startsWith str String Boolean o returns true if the string starts with str else false trim String o removes all trailing and leading white space normalizeSpace String o Trims the string and replaces all sequences of white space characters with a single space replace replaceWhat String withWhat String String o replaces all occurrences that matches the regular expression replaceWhat with the withWhat string equals str String Boolean o returns true if the string is equals to str else false equalsignoreCase str String Boolean o returns true if the string is equal to the string str ignoring casing isUpperCase int index Boolean o returns true if character at position index is upper case If no index is given first position index 0 is used isLowerCase int index Boolean returns true if character at position index is lower case If no index is given first position index 0 is used charAt int index String returns the character as a String at position index forEach Iterator operation for Strings Iterates over each character in the string matches regexp Boolean Checks if the string matches the regular expression regexp first int i String o gets the first i chars of the string last int i String I MOFScript User Guide ver
11. GENETSC MOFScriptModel http www modelware mddi org MOFScripti uml2 http www ecipse org uml2 1 0 0 UML xsd http www edipse org xsd 2002 XSD ecore http www ecipse org emf 2002 Ecore ch pia Morsetetode http MOFScriptModel 3 2 Compiling MOFScript files The MOFScript code is compiled parsed and checked either by a Changing content and saving it or P b By pressing the Compile action button Compilation of the MOFScript code will initiate a compile process which parses the text creates a MOFScript model and checks it for errors syntactical and semantic errors Errors are presented in the Problems pane of Eclipse They can also be seen in the Console pane of Eclipse m Jaya mofscniptuml2htmimt Eclipse Platform File Edit Source Navigate Search Project Run MTL Window Help 0 o HSI BIURO IPOS F PADURE Goros x gt 18 Package Explorer 2 amp 3 Navigator AZ mofscipt umizhtmi m2t x FA B ped v MOF Script Transformation E E mofsaipt gen mofsaript umi2java m2t A Simple transformation from UML 2 to HTML H Eg MOFScript feature _ f mofscriptrepository textmodule uml2Html in uml uml2 G metamodels Non bxisting keyword models var myProp Eg transformations died g mofscript umi2html m2t Entrypoint amp mofscript uml2java m2t a mofscript uml2wsdl m2t uml Model main of uml2java_indude m2t 48 SM TestModel1 umi2
12. Sia ie a ai Alea daa Ae 14 4 3 Entry point rules ccccccccccsssessssecececeseesesneseceeeceseeseaaeaeeeescesseseeaeeesess 14 ASA RUNGS 30 st5cced cise nists hater ss theas ck Ailes Mia aa dali Ae Ae 15 AAV Return VAIUES os ccsiesseeddecedeedehsvacesdecssdesshavsesddaguiecdsdavacealeesisessuessess 15 ANZ E a EE as ahadenssdadbapstahabarsedandoshshnanmedosabebanebans 16 4 5 Properties and variables ccccccccccecssssssseceeecessesscseseeeescessessaeeeeess 16 4 6 Built in types sssseoseensnsssseseseerrsssseserresssssseserresssssserernessssssreennessssene 16 AT PUGS E EET ET A E E AT T AEE EEEE 17 AB Print Statements noiai ee aheds ced teesde Rehesecsadyeadscncnctacesdnsavactenebecss 17 4 9 Escaped output cece ccccecssssssssececeeecessesseaeseccesessseaaaeeeeeeeseessaeaeeeeeens 17 AiO REPATONS sie bie hie oeek cata biked AGA SLAs dase ease ddan hatean seen 18 4 11 Conditional stateMents cee ceceeseeceeseeeceeseeeecesseeeecesseaeeseeeaaeess 19 4 12 WhileStateMe nts iiss ciisedihadeeesh ci Adiked aaah sdeetiv es dark aldiehas od 19 4 13 Select OxpPressiOns cccccsesssccceeecessesscaececececessessaaeceeeeeseesscnsaeeeeeens 20 4 14 Logical Expressions ccccsssccccceceesesscsececceseessesseaeeeeecsssesesseaeeeeeens 20 4 14 1 Expression grammar ccceceeesesesessseseeeseseseeseeeeeeseeeeseseeeeeeees 20 4 15 Transformation inheritance ccccccccsssseecesseeeecesseeece
13. also include the relative or absolute path of the output If no path or a relative path is given the externally defined root directory property is used to define the absolute path of the output file c name java file c tmp c name java file f2 test java f2 p intin tyt output to file 2 Output statements prints and escaped output will be written to the latest declared file in the runtime stack A file declaration is active as long as the declaring rule is active When a file is declared in one transformation rule it will be target for output provided also in rules invoked from the declaring rule unless the invoked rules declare their own file output The declared file reference however is not visible in invoked rules 4 8 Print statements Print statements provide output to an output device which is either a file or standard output printin public class c name If no file is declared standard output is used as output If standard output should be forced a print should be prefixed with stdout stdout println public class c name j A couple of other utility print functions are defined to provide easier whitespace management newline or n1 tab or space followed by an optional count integer Standard String escape characters n t are also legal within String literals print This is a standard print statement aVar name newline 10
14. be fetched afterwards Value false will result in standard file generation xecMgr setUseFileModel false Turns on off system logging xecMgr setUseLog false Adds an output listener for the transformation execution xecMgr getExecutionStack addOutputMessageListener this try xecMgr executeTransformation execMgr getOutputModels catch MofScriptExecutionException mex mex printStackTrace j Parsing and executing A public void test String transformation String inputModel int errs parse transformation if errs 0 execute inputModel ExecutionMessageListener interface operations Ay public void executionMessage String type String description System out println type description Main param args if public static void main String args final String transformation UMLTest m2t final String inputModel ServiceModel uml TestAPI api new TestAPI MOFScript User Guide version 0 9 MOFScript v 1 4 0 api test transformation inputModel
15. define loops based on the size of the context integer E g integer 3 will produce a loop running 3 times property aNumber Integer 34 aNumber gt forEach n stdout print n Iterators for String and Integer literals Iterators can also be defined using String or Integer literals These work the same manner as iterators based on String and Integer properties variables MODELWare the MDA tm project gt forEach s stdout print s 5 gt orEach n stdout println n 4 11 Conditional statements Conditional statements are standard if statements They are defined by a single if branch followed by a set of else if branches and a possible else branch Arguments to the if else if branches are Boolean expressions A conditional statement takes a logical expression as argument if c hasStereoType entity statements else if c hasStereoType service statements else statements if c ownedOperations size gt 0 and c name startsWith C statements else statements 4 12 While statements The while statement works in the same manner as it does in e g Java The keyword is followed by a constraint which can be any kind of Boolean expression for instance var i Integer 10 while i gt 0 Statements i 1 MOFScript User Guide version 0 9 MOFScript v 1 4 0 The above while loop will iter
16. execution In addition a project is generated if it does not exist where links to the generated files are created Figure 6 SREI MOFSCRIPT GEN mofscript uml2html m2t E car html Eci Gm insurance html E model2text example html A Ea Person html Figure 6 Generated project and file links 3 4 Default repository for MOFScript The MOFScript tool uses two logical repositories for locating metamodels It uses the built in global repository in Eclipse EMF and it uses a file based location which can be configured by the user The file based metamodel repository path is by default determined by the installation path of the MOFScript plugin the editor plugin a named repository path repository For end users this directory is visualized as an Eclipse project called mofscriptrepository If you check under mofscriptrepository metamodels you will find the metamodels visible for the tool This repository also contain some example models and transformation This will be apparent for you as a user when you write a new MOFScript transformation or change the input metamodel As seen in Figure 7 the set of available metamodels pops up when the user is defining the texttransformation textmodule with parameters MOFScript User Guide version 0 9 MOFScript v 1 4 0 texttransformation UML2Java in inputModel SM http SM A property package_name org m MOFScriptModel mofscript property packag
17. 0 UML A texttransformation may have several input model parameters These should be separated by comma texttransformation TransformationWithSeveralMetaModels in uml http www eclipse org uml2 1 0 0 UML in ec http www eclipse org emf 2002 Ecore MOFScript User Guide version 0 9 MOFScript v 1 4 0 4 2 Imports A transformation module may import other transformations as libraries or for extension This is done using the access library access transformation or import keywords Currently the semantics of these are the same There are different syntax flavors to select from as illustrated below The simples one if just import a file m2t The names given to an import is currently not used import aSimpleName std stdLib2 m2t import std stdLib2 m2t Imported transformations are fetched by the parser looking first in the current directory then in any directory specified by the import path In the preference manager the import path property can be defined It should be on the form path1 path2 path3 The parser will look for imported transformations in each path given if not found 4 3 Entry point rules Entry point rules defines where the transformation starts execution It is similar to a Java main It may have a context in the example um Model which defines what metamodel element type that will be the starting point for the execution Its body contains statements uml Model main
18. 3 _ Navigator am o mofscript umizhtmi m2t x l B vy Simple transformation from UML 2 to HTML l MOFSCRIPT GEN mofscript umi2html m2t wld a i gt MOFScript feature file i svnrepo MOFScr textmodule uml2Html in uml uml2 mofscriptrepository metamodels uml Model main models file self name toLower html transformations lt gf mofscript uml2html m2t E E p PENE Problems Jvadoc Dedraton E console 3 properties HEEE sintef mofscript editor console a ate ae tkecuce UYI speciiication TestModel 1 Compiling Using repository path c Programs eclipse plugins org repository uml2 ist fi Finished Compiling No errors os Open File C Programs eclipse plugins org sintef mofscript editor 1 0 o Outline 23 a Using MOFSCRIPT GEN mofscript uml2html m2t as project location E uml2Html Created resource file C Programs eclipse car html Created resource file C Programs eclipse person html Created resource file C Programs eclipse insurance html Created resource file C Programs eclipse model2text example Metamodel repository path c Programs eclipse plugins org sintef mofscri Figure 5 Executing transformation the output In the example in Figure 5 the transformation specifies file output to be model element name html which is shown in the Console during
19. 9 MOFScript v 1 4 0 1 Introduction The MOFScript tool is an implementation of the MOFScript model to text transformation language MOFScript was submitted to the OMG process for MOF Model to Text Transformation http www omg org cgi bin apps doc ad 05 11 03 pdf MOFScript is as an Eclipse plug in but can also be run as a standalone Java application It supports parsing checking and execution of MOFScript transformations This document is intended as a user guide for MOFScript and covers the basics of the tool and the language facilities 2 Feature Overview MOFScript supports the following features Model to text transformations Model to model transformation Traceability Multiple file output Multiple model output Light weight debugging Configurable output encoding Support for reading and writing property files Transformational Aspects 3 MOFScript within Eclipse MOFScript User Guide version 0 9 MOFScript v 1 4 0 Dava umzjaya me Eclipse Platon File Edit Navigate Search Project Run Window Help O OP7 BSHSG SEv7 FAADl eo ro ESA PoS HE Package amp 7 0 alal j ModelBusintegrationExample E 1 MOFScript Examples MOFScript feature mofscript gen ExtendedJava H mofscript gen SimpleJava m2 mofscript gen Testi m2t mofscriptrepository E E MOFScript Testing E MOFScript Update Bi net sf colorer 3 org ecipse mddi modelbus ac org eciipse mddi modelbus ac B
20. Modelica C Traceability active MofScript Preferences g Trace model Generation Dir c temp Browse Pi I 2 see Load Files From Workspace 4 Plug in Development 8 Profiling and Logging Block comment tag i E Remote Systems Character set UTF 16 v Run Debug 4 Server a zi s Restore Defaults Appl 4 gt Pply AN D Cancel Figure 8 Preferences for MOFScript Windows Preferences menu Figure 8 The following preferences can be controlled by using the preference settings Metamodel path Defines the path from which the MOFScript tool fetches the metamodels for transformations Model path This path is used by the editor as the default location to look for input models Transformation path This path is currently not used Root generation directory This property is used to determine the location of output files It is only used for output that is allocated with relative path Prefix for project generation Controls the prefix given to generated Eclipse project the default value is mofscript gen MOFScript User Guide version 0 9 MOFScript v 1 4 0 Generate project A boolean value which determines if an Eclipse project should be generated or not Import path Import path used for transformation parsing This should be a list of directories separated by semi colon Traceability active Turns on off traceability generation Currently the implementation of traceability is not finalized Turning this
21. XML xml prop file 4 20 6 Model Collection Operations size int returns the size of the collection first Object returns the first object of the collection isEmpty Boolean MOFScript User Guide version 0 9 MOFScript v 1 4 0 checks if the collection is empty forEach Iterator operation Iterator mechanism applied on the model collection select x type condition selects a subset of objects from a collection Example if c attributes size 0 stdout printin Size is 0 c attributes gt forEach p uml Property p c attributes first stdout printlin First attribute 4 20 7 Model Operations objectsOfType type Collection Returns all instances of type type within a given model object store file uri Stores the given model to the given file uri Example ec objectsOfType ec EClass gt forEach eccl 4 20 8 OCL Operations ocllsTypeOf type typeRef Boolean returns true if the type in question is exactly the same as the input type false otherwise ocllsKindOf type typeRef Boolean returns true if the type in question is the same or a subtype of the input type false otherwise oclGetType String returns the name of the type in question 4 20 9 System utility operations System and utility operations position Integer Returns the index counter value
22. ate thru the statements nine times before it ends it execution 4 13 Select expressions A select expression queries a model collection or a collection variable and returns a list containing the result of the query Select expressions can currently only be used in variable or property assignments The syntax of the select is similar to that of forEach It takes a type parameter and may have a constraint var xList List self eClassifiers gt select c ecore EClass Number of classes xList size xList gt forEach clazz ecore EClass n t Class clazz name var yList List self eClassifiers gt select c ecore EClass c name startsWith MOF 4 14 Logical Expressions Logical expressions are expressions that evaluates to true or false and are used in iterator statements and conditional statements self ownedAttribute gt forEach p uml Property p association null statements if self name Car or self name Person 4 14 1 Expression grammar Expression LogicalExpression ComparisonExpression ValueExpression ogicalExpression LogicalExpression not Expression Expression and Expression Expression or Expression ComparisonExpression ValueExpression lt gt ValueExpression ValueExpression SimpleExpression SimpleExpression ValueExpression SimpleExpression Literal Reference FunctionCall
23. ation Open sonnce Model Pix Look in models x ef f Ea D svn E f a ServiceModel uml2 My Recent 5 eer are Documents g SM TestModel1 xmi Desktop My Documents A a o o My Network File name l x Open X Places Files of type xml xmi uml2 bd Cancel Figure 3 File open dialog for selecting input model Input model selection can be chosen from Eclipse workspace or from the file system A preference in the preference manager Load files from workspace defines the preferred way of opening files The default is load from workspace 3 3 1 Executing with multiple input models If a transformation has several input model declared the user must provide several input models when executing the transformation For example in the transformation example below two input model parameters are given texttransformation MultipleMetaModels in uml http www eclipse org uml2 1 0 0 UML in ec http www eclipse org emf 2002 Ecore main can also use module main which is the same uml objectsOfType uml Class gt forEach cl cl ecoreModelTest n Looking for ecore objects ec objectsOfType ec EClass gt forEach eccl eccl umlModelTest ec EClass ecoreModelTest MOFScript User Guide version 0 9 MOFScript v 1 4 0 stdout println Ecore class self name uml Class umlModelTest stdout println Class self
24. c effect with respect to the context type Overriding a rule from an imported transformation with a new one with the same signature This will merely ensure that calls to that rule will be to the overriding one Overriding a rule from a super transformation in a sub transformation inheritance overriding The sub transformation rule will be called instead of the super one The specializing rule may invoke the rule of the super transformation by using the super keyword uml Package uml2ecore lt ecore EPackage name self name gt self ownedMember gt forEach member uml Element member uml2ecore lt ecore EPackage gt uml Class uml2ecore MOFScript User Guide version 0 9 MOFScript v 1 4 0 4 18 Invoking External Java Methods MOFScript has built in support for invoking external Java code which enables the integration of external black box operations from within MOFScript This is done with the java operation The syntax is as follows java String className String methodName List Something parameters String classpath The method invoked may be static or class scope If it is non static the class must have a default constructor The parameters may be null a single parameter e g a String an integer etc or a List of parameters if the method takes several parameters printlin Java java org test MyTestClass myTestStringl null c Workin
25. d u E associationGetAllMethod E associationCreateMetho E associationUpdateMethc standardClassImport ur E standardClassHeaderCo E getOwnerPackage uml 1 E operationimplMapping u E operationinterfaceMapp Problems Javadoc Declaration El Console 3 Search Properties Progress CVS Repositories ale e m MOFScript Console Compiling MofScript2Text m2 Using repository path c Programs Eclipse3 t plugins org sintef mofscript editor_1 1 7 repository metamodels Parsing MofScript2Text m2t Finished Compiling No errors Figure 1 Eclipse after opening a MOFScript file In the Eclipse UI three action buttons will appear that provides the basic functionality of the MOFScript tool Compiling and Executing E Os 3 1 Code completion The MOFScript editor supports code completion Code completion is activated for metamodel or variable references uml Pa lt lt h gt pr se lt The completion selector for selecting input metamodels for a transformation is shown below It shows all packages registered in Eclipse EMF as well as those located as files in the metamodel file directory MOFScript User Guide version 0 9 MOFScript v 1 4 0 in uml SM http SM a modelwa MOFScriptModel mofscript nodelwar JM http IM genmodel http www edipse org uml2 1 1 0 GenModel namespace http www w3 org XML 1998 namespace
26. e dir org mod JM http IM property ext 4ava genmode http www eclipse org uml2 1 1 0 GenModel 5 namespace http www w3 org XML 1998 namespace property author MOFScriptModel http www modelware mddi org MOFScripti uml2 http www ecipse org uml2 1 0 0 UML uml Model main xsd http www edcipse org xsd 2002 XSD Figure 7 Selecting the metamodel for the transformation To identify the metamodel is default used the URI of the registered metamodel The name may also be used Metamodels that are registered in the global Eclipse EMF package registry is preferred over file based metamodels in case a URI name exists both places 3 5 Preference page The preference page for MOFScript is available under Eclipse preference pages Preferences MofScript Preferences x Z a a General MOF Script Plugin Preference Page Agent Controller L ant Metamodels path plugins org eclipse mofscript editor_1 4 0 1 repasitory metamodels Browse ANTLR Editor Model path C Work SiSAS svn sisas Si5a5 Si5a5_Studio plugins 4 Data Management P Transformation path plugins org eclipse mofscript editor _1 4 0 1 repository transformations 21 GlassFish Preferences 4 Help 4 Root Generation Dir c ftemp a Install Update Prefix for project generation mofscript gen Java m Generate Eclipse Project with links Java EE 5 Model validation Import path for transformations
27. errorlt ParserUtil getModelChecker getErrors Iterator of MofScriptParseError objects System out printlin Parsing result errorCount errors if errorCount gt 0 for erroriIt hasNext MofScriptParseError parseError MofScriptParseError errorIt next System out printlin t t Error parseError toString return errorCount Executes the transformation param inputModel the name path of the inputmodel protected void execute String inputModel XMIResourceFactoryImpl _xmiFac new XMIResourceFactorylImpl EObject sourceModel null File sourceModelFile new Fil inputModel ResourceSet rSet new ResourceSetImpl rSet getResourceFactoryRegistry getExtensionToFactoryMap put _xmiFac URI uri URI createFileURI sourceModelFile getAbsolutePath MOFScript User Guide version 0 9 MOFScript v 1 4 0 Resource resource rSet getResource uri true if resource null if resource getContents size gt 0 sourceModel EObject resource getContents get 0 set the source model for the exeution manager execMgr addSourceModel sourceModel sets the root output directory if any is desired e g c temp execMgr setRootDirectory if true files are not generated to the file systsm but populated into a filemodel which can
28. f EcoreTe Debug As 4 gP Included Team 1 Package mapPackage gf Includet Compare With id lt mapPackage gt g JavaTest Replace With gt af Multiple BY MOFScript Model 2 Text B My langy g gf Selectte Properties Alt Enter Execute Model Directly gf SimpleTe Open As idl Class mapClass e testAnnotations m2t wan witGerand Kwen Figur 1 MOFScript model popup actions MOFScript User Guide version 0 9 MOFScript v 1 4 0 3 8 New file wizard In order to create a new MOFScript transformation from scratch the MOFScript file wizard can be used Figure 11 7 Product Configuration gt Aspect H 6 CVs H E Eclipse Modeling Framework E EMF Model gi EMF Project Tei Empty EMF project amp Example EMF Model Creation Wizards gt Java H E Java Emitter Templates amp MOFScript H E Plug in Development Simple H 6 Examples Finish Cancel Figure 11 MOFScript file wizard Using it will create a new skeleton transformation as a starting point 4 The MOFScript Language This section describes the various MOFScript language constructs 4 1 Texttransformation A Texttransformation defines the name of the module which can be any name chosen independent of file name Either of the keywords texttransformation or textmodule can be used It defines the input metamodel in terms of a parameter texttransformation testAnnotations in uml http www eclipse org uml2 1 0
29. f what happens to the advice actions Before Inserts the advice code before the code identified by the pointcut After Inserts the advice code after the code identified by the pointcut Around Replaces the code identified by the pointcut aspect JavaAspect pointcut propertyGetterCall call propertyGetter pointcut propertySetterExecut xecute propertySetter pointcut propertyNamedCall call property before propertyNamedCall log n calling a property function before propertyGetterCall code inserted before call to property getter around propertySetterExecute 7 public void set self name Replaced self type name 1 4 22 4 Executing the aspect An aspect is executed in the Eclipse IDE by running just as an ordinary MOFScript transformation As input for the aspect is another MOFScript transformation The implementation of the aspect transformation is itself as a MOFScript transformation 4 23 Model to Model Transformation MOFScript can be used for model to model transformations This can be used to create models from scratch or augment existing models The following describes the features supporting model to model capabilities 4 23 1 Declaring output parameters A transformation can declare output parameters implying that these represent output models of the transformation texttransformation M2T2Mofscript in m2t http omg org MOF2Tex
30. g TestJava var 1l List stdout println Testing Java integration l add a l add b printlin Java java org test MyTestClass myTestString2 l c Working TestJava 4 19 Reflection operations on model elements 4 19 1 Reflection ops for EObjects 4 19 1 1 _getFeature In some cases a metamodel contains features that conflicts with the keywords in MOFScript In these cases a special construct can be used to gain access to that feature the _ getFeature feature name operation Using this operation the conflicting features can be access without compilation errors 4 19 1 2 _setFeature name val _setFeature sets the value of a named feature to a given value 4 19 1 3 _getContainer Gets the container of the context Eobject 4 19 1 4 _getClass Gets the eClass of the context Eobject 4 19 1 5 _getCrossReferences Gets the cross references of the context Eobject 4 19 1 6 _getUsages MOFScript User Guide version 0 9 MOFScript v 1 4 0 Gets the usages of the context Eobject 4 19 1 7 __getUsageFeatures Gets the features that represent the usages of the context Eobject 4 19 1 8 _getContaining Feature Gets the features contained within the context EObject 4 19 1 9 delete Attempts to delete an eobject corresponds to EcoreUtil delete eobj which deleted an object from its container and from any where it is referenced 4 19 2 Reflection ops for EClasses
31. i org sintef mappingTool Gi org sintef mappingTool umla E E org sintef mofscript editor GB sre BA Plug in Dependencies B JRE System Library jdk1 help H 6 icons output EG repository gt metamodels models E transformations MofScript2Text r MultipleMetamode E uml _std m2t G UML core m2t G umizhtml m2t of umizjava m2t G umiawsdl m2t ai build properties A plugin xml E E org sintef mofscript model E org sintef mofscript parser E 3 org sintef mofscript runtime E org sintef mofscript traceabil E E org sintef mofscript XMIImpo Gut o umizjava m2t _ Example of Model to Text transformation using the MOF Script Language UML 2 Java generation ae import uml_std m2t texttransformation UML2Java in uml http www eclipse org uml2 1 property package name org modelware property package_dir org modelware property ext java property author MOFScript generator UML2Java ee Main L s uml Model main property ai self ownedMember gt forEach p uml Package p mapPackage pa mapPackage y E main uml Model 1 17 E mapPackage uml Packar E mapClass uml Class E interfaceMapping uml Ir m getFullName uml Packa E dassConstructor uml Cl m dassPrivateAttribute ur W cdassPrivateAssociations M attributeGettersSetters E dassAssociationMethods E associationAddMethod i E associationRemoveMeth E associationGetMetho
32. ing the keyword module or omitting a context type altogether see section 4 3 4 5 Properties and variables Properties and variables can be defined either globally or locally within a rule or a block e g iterator block A property is a constant which is assigned to a value on declaration The type of a property can be any of the types in 4 6 a model type or it can be untyped in the declaration Its type will then be determined by the value assigned A variable can change its value during run time in assignments A variable can be type by any of the types in 4 6 It may also be defined untyped in the declaration Its type will then be determined by the value assigned If no type is assigned its type will become a String property packageName String org mypackage var myInteger 7 4 6 Built in types The built in types in MOFScript are summarized below String The string type which represents text values Integer The integer type Real The real type Boolean The boolean type Hashtable Hashtable type List The List type MOFScript User Guide version 0 9 MOFScript v 1 4 0 PropertyMap Similar to the java Properties class Can be used to load and store java style properties Object The object type can represent any type 4 7 Files File statements are declaration of an output device for text It uses the keyword file The file name and extension is given as a parameter It may
33. ions cc eseseceesseeeesesseeeeseseeeseaeeeaeeeaeaeaeaeaes 28 4 21 Unprotected BIOCKS ccccssccccecesssssnsececeeessesesseaeeeeeeeseessneaeeeesens 28 4 22 MOFScript Aspect extension sssssssssssssesererrrrrrrerrrrrrrrrrrerrreererens 29 4 221 TINE AS PECL veces so ores vas cau iaeaea e aa Aaa sues aaa aia wees 29 4 22 2 POINTCUUS rivaccce coat Nee och ceecasevnatnets a aea ae ER ea SAA AAE 29 C Bae e Ae SN 3 e E EE E A E NE A EE EEE 30 4 22 4 Executing the ASPeCt cccccsecssssscecececessessaeseceeecessessaeseeeesens 30 4 23 Model to Model Transformation cccccccesssseecessenecesseneeeesseaeens 30 4 23 1 Declaring output PAarAMeteLS ccccseessssseeeeecessssssteseeeesens 30 4 23 2 Using output models from transformations in Java 31 4 23 3 Creating instances the NEW OPeratOl csecscccceceesssessseees 31 4 23 4 Setting property values ccccccsssssceeeeecessesseeseeeeseessesseaees 31 4 23 5 Adding values to collection properties ccccccccccesessessseees 31 4 23 6 CIONING AN Objet cnar rerien aeaa iaeaea 32 4 23 7 St ring AN Obje tetiere riiai aa aii aaa saiae 32 4 23 8 Obtaining and storing an ERESOUICE cccsesssccceeeeessssteaeees 32 The MOFScript debugger c cccccccecsssesssececececsssssseaeeeeeceseeseseaeeeeeeeseeees 32 Integrating with MOFScript Java API ccccssssssecececessesestsaeeeeeeeseesees 33 MOFScript User Guide version 0
34. l type or a built in type If a type constraint is not given all elements in the input collection applies A forEach statement may also have a guard an addition constraint which basically is any kind of Boolean expression A constraint is described after the type using a vertical bar symbol collection gt forEach a String a size 2 applies to all objects in the collection of type Operation c ownedOperation gt forEach o uml Operation statements applies to all objects in the collection of type Operation that has a name that starts with a c ownedOperation gt forEach o uml Operation o name startsWith a statements applies to all operation elements in the collection that has more than zero parameters and a return type c ownedOperation gt forEach o uml Operation o ownedParameter size gt 0 and o returnResult size gt 0 statements Iterators for List and Hashtable variables Iterators may also be defined for List Hashtable variables as illustrated below var listl List listl add E1 listl add E2 listl add 4 list1 gt forEach e stdout printin e Iterators for Strings String iterators define loops over the character contents of a string MOFScript User Guide version 0 9 MOFScript v 1 4 0 var myVar String Jon Oldevik myVar gt forEach c stdout print c Iterators for Integers Integer iterators
35. mation l e the weaving is all done compile time not run time 4 22 1 The aspect An aspect is a specialization of a transformation It contains pointcuts and advices and may also define ordinary MOFScript rules An aspect is defined as a separate aspect transformation identified by the keyword aspect aspect JavaAspect 4 22 2 Pointcuts Pointcuts identify points of execution in the MOFScript transformation joinpoints A pointcut has a name and may have a type specification Currently two types of pointcuts are defined in MOFScript call Refers to the calling of a specific set of rules execute Refers to the rules themselves A pointcut further defines a match critera in terms of a regular expression as a string literal The match critera defines what rules are matched by the pointcut pointcut classPrivateAttributeCall Class call classPrivateAttribute pointcut propertyNamedCall call property pointcut propertySetterExecut xecute propertySetter Currently there is no type checking of the aspects The type passed as parameter for a pointcut must be a model type name without any prefix MOFScript User Guide version 0 9 MOFScript v 1 4 0 4 22 3 Advice Advice describes the actions to be executed at when specific joinpoints specified by the pointcuts occur An advice refers to one pointcut and has three possible modifiers before after and around which gives the semantics o
36. menu It allows to set remove break point and to start stop step debugging MOFScript User Guide version 0 9 MOFScript v 1 4 0 MorFSscript execute KA MOFScript Execute Previous MOFScript compile MOFScript Debug J E Cancel debug Run s gt E Step Debug As gt i Continue Debug w Profile As 3 MOFScript debug 4 gt Taom 3 Remove all breakpoints Compare With gt 3 Remove MOFScript breakpoint Replace With 4 e Add int b Buckminster gt Add MOFScript breakpoint Figure 12 Context Menu for Debugging When debugging MOFScript execution will halt at specified break points You can step through execution using control keys F6 steps one statement F8 continues until next break point is reached A debug view MOFScript Debug View provides a simple view of variable state 2 Problems Javadoc B Declaration E Properties F MOFScript Debug View 3 Name Type Value counter lt gt Integer 10 ec lt gt ec EPackage org eclipse emf ecore impl EPac name lt 2 gt String Pedro Gonzales self lt 2 gt EPackagelmpl org eclipse emf ecore impl EPac Figure 13 MOFScript Debug View Choosing Cancel Debug will disable the debug session and continue normal execution 6 Integrating with MOFScript Java API The code below illustrates integration with MOFScript using the Java API import java io File import java
37. name The user will be prompted two times to open model files Open Source Model Model aie uit Lookin E eclipse workspace J Bet metadata org sintef mofscript mox ModelBusIntegrationExample org sintef mofscript par mMorFscript Examples org sintef mofscript run QoFscipt feature org sintef mofscript trac GQMOFScript Update ora sintef mofscript xm Gmofscript gen ExtendedJava m2t pProductLineProfile Gjmofscript gen SimpleJava m2t S UML2 ecore Qpmofscript gen Testi m2t Size 389 bytes morscipt Testing Files project Gpnet sf colorer org eciipse mddi modelbus adapter transformation 20rg eclipse mddi modelbus adapter transformation registry ora sintef mappingTool org sintef mappingTool um 2uml editor org sintef mofscript editor ln ee ferme fd lookin neds a BE ER D svn E ModelZText Example umi2 E Personmodel umi2 f ServiceModel uml2 PB SM TestMode 1 xmi Figure 4 Opening multiple model files 3 3 2 The generated files The files generated are places on the file system where at a user specified location specified by the file statements MOFScript User Guide version 0 9 MOFScript v 1 4 0 mm Java mofsciphumizhtmim2t Eclipse Platon File Edit Source Navigate Search Project Run Window Help O G E l Java n EHS Bise eroe POFl VPG weo o Plugin Devel Package Explorer 5
38. o add objects to feature collections add and addOrg add adds a copy of the original object to the collection addOrg adds by reference i e the reference to the original object is added mst variables addOrg newVar Unless you want to add object copies you want to use addOrg rather than add MOFScript User Guide version 0 9 MOFScript v 1 4 0 4 23 6 Cloning an object Objects can be cloned by calling the operation clone Cloning can be used on any object structure and results in a deep copy of the object structure This can be used for copying an input model modifying it and later storing it 4 23 7 Storing an object Models are stored using the store file name operation on a model object This operation can be executed on either output or input models 4 23 8 Obtaining and storing an EResource It is possible to obtain the EResource for an EObject using the operation o _eResource var res ecore EResource self _eResource The resource can be modified by using its getContents method res getContents add obj The resource can be stored by invoking store on the resource either with a name or without any parameters to replace the original resource res store newresource ecore res store 5 The MOFScript debugger The MOFScript Debugger is a light weight add on to the existing MOFScript runtime It does not extend use the Eclipse debugging framework Debugging is available through the pop up
39. of context forEach loop the position of the current elements in the loop Returns 1 if there is no loop count Integer Returns the index counter value of the nearest context forEach loop taking filters into account Returns 1 if there is no loop getenv String property String Gets an environment variable Equivalent to Java System getProperty MOFScript User Guide version 0 9 MOFScript v 1 4 0 setenv String property String value Sets an environment variable Equivalent to Java System setProperty time String Returns the current time as a String The only format currently supported is HH MM SS date String Returns the current date as a String The only format currently supported is DD MM YY 4 20 10 UML2 Operations The following operations are available when UML2 models are loaded and the UML2 Eclipse plug in is available Boolean hasStereoType String stereotypeName List lt Stereotype gt getAppliedStereotypes Stereotype getAppliedStereotype Boolean hasValue Stereotype stObj String stName String valueName Object getValue Stereotype stObj String stName String valueName They are all applicable to UML 2 modelelements such as classes E g self ownedElements gt forEach c uml Class if c hasStereoType myStereoType Class stereotype c name if c hasValue myStereoType myProperty t Stereotype property
40. on will now only result in some print messages Trace model generation dir Where to store the tracemodel Block comment tag File loading preference Encoding 3 6 File properties Each MOFScript file has a set of MOFScript properties specific to that transformation file which can be changed by the user Figure 9 m properties tonumljaya m2i type filter text v MOFScript Properties Info Fd MOFScript Properties ia Subversion Last executed Tue Jan 31 00 40 54 CET 2006 Source of last execution C Working yuntime workspace MOFScript Test Models ServiceModel uml2 Use log T Select Root Output Directory C Working yuntime workspace MOFScript Test output Browse Path mofscriptrepository transformations uml2java m2t Restore Defaults Apply Lx J com Figure 9 MOFScript properties The properties currently available are Use log Turns on off the logger for the transformation If on the log statements in MOFScript log this is a log message will be printed If off the log statements are ignored Select Root Output Directory Sets the root directory property which will be used for this particular transformation If not set the global property will be used 3 7 File popup menu Some MOFScript actions are available on the popup menu on MOFScript files Figure 10 MOFScript User Guide version 0 9 MOFScript v 1 4 0
41. ort self standardClassHeaderComment public class self name extends Serializable self classConstructor Attributes a self ownedAttribute gt forEach p uml Property p classPrivateAttribute newline 2 Eyy 4 4 1 Return values A rule may also return a value which can be reused in expressions in other rules To return a value the result statement is used uml Package getFullName String if self owner null result self owner getFullName else if self ownerPackage null result self ownerPackage getFullName result self name toLower replace _ A return value may also be given by a return statement which immediately terminate rule execution and returns with the given value if any MOFScript User Guide version 0 9 MOFScript v 1 4 0 uml Package getFullName String result self owner getFullName 4 4 2 Parameters A rule may have any number of parameters A parameter can be of a built in type 4 6 or a metamodel type uml Model testParameters2 sl String il Integer stdout println testParameters2 sl il uml Model testParameters3 sl String r2 Real bl Boolean package uml Package stdout println Package package name stdout println testParameters3 sl r2 bl package name A rule may be without context type This is declared by us
42. sion 0 9 MOFScript v 1 4 0 gets the last chars of the string strtok String regexp String returns a tokenized version of the String like C strtok strcmp String other Integer Compares two Strings isAlpha Boolean Checks if the string consists of letters isAlphaNum Boolean checks if the string consists of letters and numbers Example myString toLower c name size c name endsWith Fa 4 20 2 Integer operations The integer operations Standard arithmetic operations forEach o Iterator operation for integers Iterates over the size of the integer from 0 to its size 4 20 3 List Operations The list operations add e Object Boolean adds an object to the list remove e Object Boolean removes an object from the list size Integer returns the size of the list clear void empties the list first Object returns the first element of the list last Object returns the last element of the list isEmpty Boolean returns true if the list is empty size 0 false otherwise forEach iterator operation iterator mechanism applied on lists select x type condition selects a subset of objects from a collection addAll list appends the objects in the list to the end of the current list addAllFirst list appends the objects in the list to the start of the current list
43. sseeeeesseaeees 20 4 16 Absthact rule uiaiia sirhana iii areek eana ASEAS aaa EEA 21 4 17 Rule OVeErridiNg r a a ataa iar a aR EE EEEE 21 4 18 Invoking External Java Methods cc cccccccscsssssssseceeecessesseseaeeeeeens 22 4 19 Reflection operations on Model CleMeNtsS c cccccccesesssstseeeeeees 22 4 19 1 Reflection ops for EODj CtS cccccccccccssssssssececeescsssesssteseeeesens 22 4 19 2 Reflection ops for EClasses cccccccccccsssessssececeeecessessnneeeeeesens 23 4 19 3 Reflection ops for EClassifiers ccccccccssssscecececessesssseeeeeesens 23 4 20 Built in operations 20 0 eee eeeseeccececessessaececeescesseseaeeeeeeeseesesteaeeeeeens 23 4 20 1 String OPSFAatiONs 3ccccce ccecgeedeled de cbiabecetecedodetenesdeecebededessnesceetes 23 4 20 2 Integer OPEatiONS cccccesesesessssseseeeseeeseeseeeseeeeeeeseeeeeeeeees 25 4 20 3 List Operation pee aiit iosi niiti aingie 25 MOFScript User Guide version 0 9 MOFScript v 1 4 0 6 4 20 4 Hashtable Operations meene e e eat este eaedestees 26 4 20 5 PropertyMap Operations c0 0scseseseseseesseseseesseeseseeeeeeees 26 4 20 6 Model Collection Operations cccccccecsssssecececessssssseeeeeeeens 26 4 20 7 Model Operations sc 22c ced vescied eia i esas cies Eei 27 4 20 8 OGL OPEL ations inre E A E RER LA A beet ee 27 4 20 9 System utility operationS ssssssssssesesenssrsssrresrrrseresrresrresse 27 4 20 10 UML2 Operat
44. t out mofscript http org eclipse mofscript model mofscript MOFScriptSpecification MOFScript User Guide version 0 9 MOFScript v 1 4 0 An output declaration has a name a model URI and a specification of the model element type which is the root if the output model in the example this is mofscript MOFScriptSpecification 4 23 2 Using output models from transformations in Java When a transformation is executed from Java its output models can be accessed with the getOutputModels method on the ExecutionManager xecMgr executeTransformation Collection output execMgr getOutputModels Object resultModel null if output size gt 0 resultModel output toArray 0 4 23 3 Creating instances the new operator New model elements can be created using the new operator var newVar mofscript VariableDeclaration new mofscript VariableDeclaration The new operator creates a new instance of the specified type A comma separated list of parameters on the form lt name value gt can be sent in the create call which results in these properties being set on the created object ji aid new mofscript VariableDeclaration name MyVariable 4 23 4 Setting property values Simple property values are set by standard assignment newVar name YourVariable newVar value Your Value 4 23 5 Adding values to collection properties Two main operations are used t
45. util Iterator import org eclipse emf common util URI import org eclipse emf ecore EOb ject import org eclipse emf ecore resource Resource import org eclipse emf ecore resource ResourceSet import org eclipse emf ecore resource impl ResourceSetImpl import org eclipse emf ecore xmi impl XMIResourceFactoryImpl import org eclipse mofscript MOFScriptModel MOFScriptSpecification import org eclipse mofscript parser MofScriptParseError import org eclipse mofscript parser ParserUtil import org eclipse mofscript runtime ExecutionManager import org eclipse mofscript runtime ExecutionMessageListener MOFScript User Guide version 0 9 MOFScript v 1 4 0 import org eclipse mofscript runtime MofScriptExecutionException import org eclipse uml2 uml UMLPackage public class TestAPI implements ExecutionMessageListener private ParserUtil parserUtil null private ExecutionManager execMgr null Constructor a public TestAPI UMLPackage lePackage UMLPackage eINSTANCE ParserUtil parserUtil new ParserUtil ExecutionManager execMgr ExecutionManager getExecutionManager Parses a transformation return numebr of parse errors f protected int parse String transformation File f new Fil transformation MOFScriptSpecification spec parserUtil parse f true int errorCount ParserUtil getModelChecker getErrorCount check for errors iterator
Download Pdf Manuals
Related Search
Related Contents
取扱説明書 - 513.03 KB Manual - Northern Tool + Equipment マクソンAcァグプタ LECF19L-W16GH2785P 仕様図 取扱説明書 - 会社情報 Aiphone AI-SSV User's Manual Untitled - Circulaires.gouv.fr c24eo series steamer KIT HIDRÁULICO CARREGA TUDO Manual de instalação Copyright © All rights reserved.
Failed to retrieve file