different transformed results between ATL configuration and Java programming transformation [message #988851] |
Mon, 03 December 2012 13: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>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03946 seconds