Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Problem to run ATL in JAVA
[ATL] Problem to run ATL in JAVA [message #833091] Sat, 31 March 2012 00:12 Go to next message
Lucas Ramos is currently offline Lucas Ramos
Messages: 2
Registered: March 2012
Junior Member
I'm trying to run an ATL transformation and I got this error message:

Exception in thread "main" org.eclipse.m2m.atl.engine.emfvm.VMException: Model not found: IN
<native>
	at __matchKind2Sig#4(RefOntoUML2Alloy.atl)
		local variables: self=RefOntoUML2Alloy : ASMModule
	at __matcher__#1(RefOntoUML2Alloy.atl)
		local variables: self=RefOntoUML2Alloy : ASMModule
	at main#22(RefOntoUML2Alloy.atl)
		local variables: self=RefOntoUML2Alloy : ASMModule



That error occurs when I try to launch the transformation
launcher.launch("run", null, launcherOptions,(Object[]) tabIS);



Can anyone help me?

Check the code:

package atl;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.m2m.atl.core.IExtractor;
import org.eclipse.m2m.atl.core.IInjector;
import org.eclipse.m2m.atl.core.IModel;
import org.eclipse.m2m.atl.core.IReferenceModel;
import org.eclipse.m2m.atl.core.ModelFactory;
import org.eclipse.m2m.atl.core.emf.EMFExtractor;
import org.eclipse.m2m.atl.core.emf.EMFInjector;
import org.eclipse.m2m.atl.core.emf.EMFModelFactory;
import org.eclipse.m2m.atl.core.launch.ILauncher;
import org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher;

public class Main {

	/**
	 * @param args
	 */
	
	public static void main(String[] args) throws Exception {
		//Factory to create models and metamodels, injector to inject data in models
		ModelFactory factory = new EMFModelFactory();
		IInjector injector = new EMFInjector();

		//MetaModelA, ModelA and injection of data from my resource (resourceModelA)
		IReferenceModel metaModelA = factory.newReferenceModel();
		injector.inject(metaModelA, "metamodels/RefOntoUML.ecore"); /* metaModelAEcorePath is the string path of my ecore file */
		
		IModel modelA = factory.newModel(metaModelA);
		((EMFInjector)injector).inject(modelA,"models/modelo_src.ecore");
		
		/* My resourceModelA is already created and filled (I checked this by saving it and verifying the XMI file */
		
		//MetaModelB, ModelB but no injection (it's the destination model)
		IReferenceModel metaModelB = factory.newReferenceModel();
		injector.inject(metaModelB, "metamodels/AlloyNemo.ecore"); /* metaModelAEcorePath is the string path of my ecore file */
		IModel modelB = factory.newModel(metaModelB);
		
		//Parameterization of the launcher (adding models, ASM File) and launch
		ILauncher launcher = (ILauncher) new EMFVMLauncher();
		launcher.initialize(null);
		launcher.addInModel(modelA, "modelo_src.ecore", "MMRefOntoUML");
		launcher.addOutModel(modelB, "ModelB", "MMAlloy");
		
		InputStream tabIS[] = new InputStream[1];
		tabIS[0] = new FileInputStream("transformations/RefOntoUML2Alloy.asm");
		//tabIS[0] = new URL("/transformations/RefOntoUML2Alloy.asm").openStream(); /* asmFilePath is the complete string path of my transformation (the asm file) */
		Map<String, Object> launcherOptions = new HashMap<String, Object>();
		
		launcher.launch("run", null, launcherOptions,(Object[]) tabIS);

		
		//Extraction of data in the ModelB
		IExtractor extractor = new EMFExtractor();
		extractor.extract(modelB, "out.ecore");
		
		
	}

}


index.php/fa/7711/0/
  • Attachment: aaa.jpg
    (Size: 41.53KB, Downloaded 258 times)
Re: [ATL] Problem to run ATL in JAVA [message #835116 is a reply to message #833091] Mon, 02 April 2012 20:27 Go to previous message
Lucas Ramos is currently offline Lucas Ramos
Messages: 2
Registered: March 2012
Junior Member
I got this.

launcher.addInModel(modelA, "IN", "MMRefOntoUML");
launcher.addOutModel(modelB, "OUT", "MMAlloy");
Previous Topic:[ATL] Generating an EChar during transformation
Next Topic:[QVTO] Invoke a transformation using its XMI file
Goto Forum:
  


Current Time: Fri Oct 24 17:03:04 GMT 2014

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

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