Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » [EMFTVM/ATL/SimpleGT] XMI Model injector and extractor
[EMFTVM/ATL/SimpleGT] XMI Model injector and extractor [message #1727513] Wed, 23 March 2016 12:24 Go to next message
Zheng Cheng is currently offline Zheng ChengFriend
Messages: 15
Registered: February 2012
Junior Member
Hi All,

Sometimes, we have the need to extract a model version of ATL/SimpleGT transformation, e.g. an ATL transformation that transforms ATL/SimpleGT to EMFTVM requires an ATL/SimpleGT input model.

My tool tries to do some static analysis on ATL/SimpleGT transformations. ATL provides some facilities to generate a model version of ATL. I wonder how can I get a model version of SimpleGT?

Consult SimpleGT source code, I did something like this:
ResourceSet rs = new ResourceSetImpl();

rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("simplegt", new SimplegtResourceFactory());
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());	

URI uri = URI.createURI(filePath);
SimplegtResource resource = (SimplegtResource) rs.getResource(uri, true);
		
Model simplegtm = EmftvmFactory.eINSTANCE.createModel();
simplegtm.setResource(resource);


This probably enough for me. But I wonder can I serialize this model *simplegtm* as XMI model? e.g. can I using a EMFExtractor?

Thanks in advance.

Best,
Zheng


[Updated on: Wed, 23 March 2016 12:34]

Report message to a moderator

Re: [EMFTVM/ATL/SimpleGT] XMI Model injector and extractor [message #1727539 is a reply to message #1727513] Wed, 23 March 2016 15:34 Go to previous message
Zheng Cheng is currently offline Zheng ChengFriend
Messages: 15
Registered: February 2012
Junior Member
My colleague helps me with this. For anybody who interests of doing this. The general idea is to wrap the *simplegt* resource to a *xmi* resource, and save it. It looks something like:
ResourceSet rs = new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("simplegt", new SimplegtResourceFactory());
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
		
URI uri = URI.createURI(filePath);
SimplegtResource resource = (SimplegtResource) rs.getResource(uri, true);
		
Model simplegtm = EmftvmFactory.eINSTANCE.createModel();
simplegtm.setResource(resource);
		
Resource xmiResource = rs.createResource(uri.appendFileExtension("xmi"));
xmiResource.getContents().addAll(EcoreUtil.copyAll(resource.getContents()));
		
xmiResource.save(null);

Previous Topic:Higher Order Transformation (Henshin to ATL)
Next Topic:association delete
Goto Forum:
  


Current Time: Fri Apr 19 23:09:34 GMT 2024

Powered by FUDForum. Page generated in 0.02792 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top