QVTO - Calling a mapping versus clone [message #1783657] |
Thu, 15 March 2018 08:56 |
Bruce Trask Messages: 58 Registered: July 2009 |
Member |
|
|
Hello,
I am seeing some odd behavior with a clone call.
I have a transformation file that I am using and it has the following line in it:
-- try clone here, rather than invoke a mapping
version := self.version.clone()->oclAsType(newone::Version)->any(true);
-- version := self.version.map toVersion();
with toVersion() being
mapping old::Version::toVersion() : newone::Version {
major := self.major;
minor := self.minor;
service := self.service;
}
When I run it I get some odd results in the resulting xmi file.
I see:
- dual xmlns entries in the XMI element.
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:requirements="http://www.company.com/2018/requirements" xmlns:requirements_1="http://www.eclipse.org/2008/requirements">
-and the version gets added to the XMI element and not the subelement.
<requirements_1:Version major="1"/>
<requirements_1:Version minor="5"/>
When I run it with the toVersion mapping it works fine.
Was wondering if I am using the clone correctly and if in fact the clone call above should be the same as the call to the mapping.
Regards,
Bruce
[Updated on: Thu, 15 March 2018 09:36] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02570 seconds