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");
}
}