different transformed results between ATL configuration and Java programming transformation [message #988851] |
Mon, 03 December 2012 08:07  |
Beatus Ding Messages: 18 Registered: November 2012 |
Junior Member |
|
|
Hi everyone,I'm transforming one ".fm model" into another ".unify" model using ATL.Nothing wrong with ATL configuration.But when I try to programming launch atl transformation with the following code.I get exactly the same result,the only differences is that the prefix is gone.How to resolve the problem?
String srcMetaURI="file:///e:/SynModel/unify.core/model/unify.ecore";
String tgtMetaURI="file:///e:/SynModel/fm.core/model/fm.ecore";
String srcModelURI="file:///E:/SynModel/atl/fm/generic model/new_domain.unify";
String tgtModelURI="D:/Document/workspace_test/AGM_FM/new_domain.xml";
String asmPath="file:///E:/SynModel/atl/fm/atl/unify2fm.asm";
String srcMetaURI2="http://se.edu.cn/unify";
String tgtMetaURI2="http:///featureIDE";
register(resource(srcMetaURI, true));
register(resource(tgtMetaURI, true));
Resource model = resource(srcModelURI, true);
OneInOneOutTransformation trans = new Transformations.Builder()
.asm(asmPath)
.in(get(srcMetaURI2), "IN", "FM")
.out(get(tgtMetaURI2), "OUT","UNIFY")
.buildOneInOneOut();
EMFModel out = transform(inject(model, get(srcMetaURI2)), trans);
out.getResource().setURI(URI.createFileURI(tgtModelURI));
try {
out.getResource().save(null);
} catch (IOException e) {
e.printStackTrace();
}
The result of ATL Configuration(from the graphical operation)is as follows:
<?xml version="1.0" encoding="ASCII"?>
<unify:Model xmlns:unify="http://se.fudan.edu.cn/unify" unify:type="FeatureModelType">
<unify:entities unify:type="StructType" unify:variable="false">
</unify:entities>
<unify:attributes unify:name="chosenLayoutAlgorithm" unify:type="String" unify:value="1"/>
</unify:Model>
The result of Java programming transformation is as follows:<?xml version="1.0" encoding="ASCII"?>
<unify:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:unify="http://se.fudan.edu.cn/unify" type="FeatureModelType">
<entities type="StructType" variable="false">
</entities>
<attributes name="chosenLayoutAlgorithm" type="String" value="1"/>
</unify:Model>
|
|
|
| Re: different transformed results between ATL configuration and Java programming transformation [message #988908 is a reply to message #988851] |
Mon, 03 December 2012 11:31   |
Hugo Bruneliere Messages: 461 Registered: July 2009 |
Senior Member |
|
|
Hello,
Your two models are actually similar: if you open them via a Model Editor/Browser, after having registered the corresponding metamodel in the EMF registry of course, you should realize this (cf. the MoDisco Model Browser for instance).
XMI is just a serialization format (among possibly others), and the difference probably comes from the fact that different serialization options have been used in the two cases.
Best regards,
Hugo
------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
|
|
|
|
Powered by
FUDForum. Page generated in 0.01447 seconds