ATL transformation programming in java code [message #983881] |
Wed, 14 November 2012 03:10  |
Eclipse User |
|
|
|
I'm transforming one .fm model into another .unify model using ATL.Nothing wrong with ATL configuration.Now I want to use ATL transformation in java code.I get different result from that of ATL configuration.The following is my code
try {
/*
* Initialization
*/
ILauncher transLauncher=new EMFVMLauncher();
ModelFactory modelFactory=new EMFModelFactory();
IInjector injector=new EMFInjector();
IExtractor extractor=new EMFExtractor();
/*
* Load metamodels
*/
IReferenceModel fmMetaModel=modelFactory.newReferenceModel();
injector.inject(fmMetaModel, "file:e:/实验室项目/models的文章/SynModel_old/fm.core/model/fm.ecore");
//injector.inject(fmMetaModel, "http:///featureIDE");
IReferenceModel unifyMetaModel=modelFactory.newReferenceModel();
injector.inject(unifyMetaModel, "file:e:/实验室项目/models的文章/SynModel_old/unify.core/model/unify.ecore");
/*
* Load model
*/
IModel fmModel=modelFactory.newModel(fmMetaModel);
injector.inject(fmModel, "file:e:/实验室项目/models的文章/SynModel_old/atl/fm/app1/new/app1.fm");
IModel unifyModel=modelFactory.newModel(unifyMetaModel);
/*
* transformation
*/
transLauncher.initialize(new HashMap<String, Object>());
transLauncher.addInModel(fmModel, "IN", "FM");
transLauncher.addOutModel(unifyModel, "OUT", "UNIFY");
transLauncher.launch(ILauncher.RUN_MODE, new NullProgressMonitor(), new HashMap<String, Object>(), new FileInputStream("E:/实验室项目/models的文章/SynModel_old/atl/fm/atl/app1/fm2unify.asm"));
extractor.extract(fmModel, "file:/实验室项目/models的文章/SynModel_old/atl/fm/app1/new/app_d.unify");
/*
* unload all models and metamodel(EMF-specific)
*/
EMFModelFactory emfModelFactory=(EMFModelFactory) modelFactory;
emfModelFactory.unload((EMFModel) fmModel);
emfModelFactory.unload((EMFReferenceModel) fmMetaModel);
emfModelFactory.unload((EMFReferenceModel) unifyMetaModel);
} catch (ATLCoreException e) {
// TODO: handle exception
e.printStackTrace();
}catch (FileNotFoundException e) {
// TODO: handle exception
e.printStackTrace();
}
Is there anything wrong with my code?Thanks in anvance,any suggestion will be appreciated.
|
|
|
|
|
|
|
Re: ATL transformation programming in java code [message #986211 is a reply to message #985201] |
Mon, 19 November 2012 08:36  |
Eclipse User |
|
|
|
Thank sincerely for your reply.I just have one meta source model,one meta target model and one source model.I don't understand what the crossing reference model is.Can you tell some details about your solving progress?Best show me some source code,thanks a lot.
|
|
|
Powered by
FUDForum. Page generated in 0.30391 seconds