Issue 14436: Typos/issues in the examples (mtt-rtf) Source: (, ) Nature: Clarification Severity: Significant Summary: Some of the examples given in the specification assume that there is a "+" operator defined between Strings. This is not true in OCL, and there is none defined in the MOFM2T specification itself. page 9, section 7.2 : [trace(c.id()+ '_definition') ] should be [trace(c.id().concat('_definition')) ] page 9, section 7.3 : [file (‘file:\\’+c.name+’.java’, false, c.id + ‘impl’)] should be [file (‘file:\\’.concat(c.name).concat(’.java’), false, c.id.concat(‘impl’))] Furthermore, the description of this examples tells readers that a file named "cust.sql"; this is wrong. the text below the example of 7.3 should be : ----------8<---------- Suppose the above specification was run on a class named ‘cust,’ it would produce Java code in cust.java file and a log entry ‘processing cust’ in log.log file. Suppose after generation, the storage specification was added in the protected area of file cust.java. Even if the classname is changed later, say to ‘customer,’ a tool will be able to retain the storage specification in the new file customer.java as the file block takes unique id as a parameter that hasn’t changed (for ‘cust’ object). The uri ‘stdout’ denotes the stdout output stream. ---------->8---------- Page 30, Annex A.3 Counting the "+"<=>"concat" error only once, this example sports no less than 9 syntax errors. Replace all text with : ----------8<---------- [module class_header_gen ( UML ) /] [template public class_header(c : Class) { Integer count = -1; } ] [file (c.name.concat('.cpp'), false)] [trace(c.id().concat('_header'))] // Bit vector #defines [for(a : Attribute | c.attribute) { Integer count = count + 1; }] #define [a.name/]_BIT [count/] [/for] class [c.name/] [for(c:Class | c.super) before(':') separator(',')] [c.name/] [/for] { bool bitVector [‘[‘.concat(c.attribute->size()).concat(’]’)/]; // Attribute declarations [for (a : Attribute | c.attribute)] [a.type.name/] [if(isComplexType(a.type))]*[/if] [a.name/]; [/for] // Constructor [c.name/]() { // initialize bit vector for (int i = 0; i < [c.attribute->size()/]; i++) { bitVector[‘[i]’] = 0; } [protected ('user_code')] // your code here [/protected] } // Attribute set/get/isSpecified methods [for (a : Attribute | c.attribute)] void Set[a.name/] ([a.type.name/] [if(isComplexType(a.type))] * [/if] p[a.name/]) { bitVector[’[‘.concat(a.name).concat(’_BIT]’)] = 1; [a.name/] = p[a.name/]; } [a.type.name/] Get[a.name/] () {return [a.name/];} bool isSpecified[a.name/]() {return bitVector[’[‘.concat(a.name).concat(’_BIT]’)];} [/for] // Method declarations [for (o : Operation | c.operation) ] [o.type.name/] [o.name/] ([for(p:Parameter | o.parameter) separator(',')] [p.type/] [p.name/] [/for]); [/for] } [/trace] [/file] [/template] ---------->8---------- Another solution to fix these errors would be to rely on the 2.1 version of the OCL specification which will introduce a '+' operator for Strings; or to add this operator in the MOFM2T specification. Resolution: Revised Text: Actions taken: September 28, 2009: received issue Discussion: End of Annotations:===== iler: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Wed, 30 Sep 2009 14:09:39 -0400 To: issues@omg.org, mtt-rtf@omg.org From: Juergen Boldt Subject: Fwd: Issue/Bug Report Cc: laurent.goubet@obeo.fr From: webmaster@omg.org Date: 28 Sep 2009 07:45:56 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Laurent Goubet Company: Obeo mailFrom: laurent.goubet@obeo.fr Notification: Yes Specification: MOF Model to Text Transformation Language (MOFM2T) Section: 7.2, 7.3, A.3 FormalNumber: formal/2008-01-16 Version: 1.0 RevisionDate: 01/16/08 Page: 9, 10, 30 Title: Typos/issues in the examples Nature: Clarification Severity: Significant test: 3qw8 B1: Report Issue Description: Some of the examples given in the specification assume that there is a "+" operator defined between Strings. This is not true in OCL, and there is none defined in the MOFM2T specification itself. page 9, section 7.2 : [trace(c.id()+ '_definition') ] should be [trace(c.id().concat('_definition')) ] page 9, section 7.3 : [file (. file:\\.+c.name+..java., false, c.id + .impl.)] should be [file (. file:\\..concat(c.name).concat(..java.), false, c.id.concat(.impl.))] Furthermore, the description of this examples tells readers that a file named "cust.sql"; this is wrong. the text below the example of 7.3 should be : ----------8<---------- Suppose the above specification was run on a class named .cust,. it would produce Java code in cust.java file and a log entry .processing cust. in log.log file. Suppose after generation, the storage specification was added in the protected area of file cust.java. Even if the classname is changed later, say to .customer,. a tool will be able to retain the storage specification in the new file customer.java as the file block takes unique id as a parameter that hasn.t changed (for .cust. object). The uri .stdout. denotes the stdout output stream. ---------->8---------- Page 30, Annex A.3 Counting the "+"<=>"concat" error only once, this example sports no less than 9 syntax errors. Replace all text with : ----------8<---------- [module class_header_gen ( UML ) /] [template public class_header(c : Class) { Integer count = -1; } ] [file (c.name.concat('.cpp'), false)] [trace(c.id().concat('_header'))] // Bit vector #defines [for(a : Attribute | c.attribute) { Integer count = count + 1; }] #define [a.name/]_BIT [count/] [/for] class [c.name/] [for(c:Class | c.super) before(':') separator(',')] [c.name/] [/for] { bool bitVector [.[..concat(c.attribute->size()).concat(.].)/]; // Attribute declarations [for (a : Attribute | c.attribute)] [a.type.name/] [if(isComplexType(a.type))]*[/if] [a.name/]; [/for] // Constructor [c.name/]() { // initialize bit vector for (int i = 0; i < [c.attribute->size()/]; i++) { bitVector[.[i].] = 0; } [protected ('user_code')] // your code here [/protected] } // Attribute set/get/isSpecified methods [for (a : Attribute | c.attribute)] void Set[a.name/] ([a.type.name/] [if(isComplexType(a.type))] * [/if] p[a.name/]) { bitVector[.[..concat(a.name).concat(._BIT].)] = 1; [a.name/] = p[a.name/]; } [a.type.name/] Get[a.name/] () {return [a.name/];} bool isSpecified[a.name/]() {return bitVector[.[..concat(a.name).concat(._BIT].)];} [/for] // Method declarations [for (o : Operation | c.operation) ] [o.type.name/] [o.name/] ([for(p:Parameter | o.parameter) separator(',')] [p.type/] [p.name/] [/for]); [/for] } [/trace] [/file] [/template] ---------->8---------- Another solution to fix these errors would be to rely on the 2.1 version of the OCL specification which will introduce a '+' operator for Strings; or to add this operator in the MOFM2T specification. Juergen Boldt Director, Member Services Object Management Group 140 Kendrick St Building A Suite 300 Needham, MA 02494 USA tel: +1 781 444 0404 x 132 fax: +1 781 444 0320 email: juergen@omg.org www.omg.org