[ATL] A Problem with atl transformation to Ecore [message #104925] |
Tue, 12 May 2009 08:19 |
Waldemar Messages: 2 Registered: July 2009 |
Junior Member |
|
|
Hi Friends,
I have some problems with my atl transformation. I try to transform my
model with own Metamodel to ecore-model with Ecore-metamodel.
Here is the code:
module ATL_TEST; -- Module Template
create OUT : ECORE from IN : MetaMetaModel;
...
rule Field2EAttribute{
from
s : MetaMetaModel!Field
to
t : ECORE!EAttribute(
name <- s.name,
eType <- ECORE!EBoolean -- Here is the problem
)
}
...
The Problem is:
When I try to execute this code from the ATL Eclipse plugin, it works. But
if I execute the same code from a Java application (I use AtlLauncher from
org.atl.eclipse.engine.AtlLauncher), then feature eType at each EAttribute
remains unset (OclUndefined). There will be no exception thrown, eType
remains simply unset.
My input.xmi looks like:
...
<types xsi:type="MMModel:DataType" name="EBoolean"
wrapperConfiguration="http://www.eclipse.org/emf/2002/Ecore"/>
<types xsi:type="MMModel:MetaClass" name="MyClass">
<fields xsi:type="MMModel:DefinitionField" name="attr1"
type="//@types.0"/>
<fields xsi:type="MMModel:DefinitionField" name="attr2"
type="//@types.0"/>
</types>
...
Here is the a part of output.ecore:
...
<eClassifiers xsi:type="ecore:EClass" name="MyClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attr1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attr2"/>
</eClassifiers>
...
But I want, that after the transformation output.ecore looks like:
...
<eClassifiers xsi:type="ecore:EClass" name="MyClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attr1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attr2"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
...
Here is my java application code:
...
ModelLoader emfLoader = new EMFModelLoader();
ASMEMFModel fromMetamodel = (ASMEMFModel) emfLoader.loadModel(new
URL(".../.../MMModel.xmi").getPath(), emfLoader.getMOF(), new
URL(".../.../MMModel.xmi").openStream());
ASMEMFModel Ecore = (ASMEMFModel) emfLoader.getMOF(); // Here I also
tried: ASMEMFModel Ecore = (ASMEMFModel) emfLoader.loadModel(new
URL(".../.../Ecore.ecore").getPath(), emfLoader.getMOF(), new
URL(".../.../Ecore.ecore").openStream()); result is the same
ASMEMFModel inModel = (ASMEMFModel) emfLoader.loadModel("IN",
fromMetamodel, new URL(".../.../input.xmi").openStream());
ASMEMFModel outModel = (ASMEMFModel) emfLoader.newModel("OUT", Ecore);
Map models = new HashMap<String, ASMEMFModel>();
models.put("MetaMetaModel", fromMetamodel);
models.put("ECORE", toMetamodel);
models.put("IN", inModel);
models.put("OUT", outModel);
URL asmURL = new URL(".../.../ATL_TEST.asm");
AtlLauncher.getDefault().launch(asmURL, Collections.EMPTY_MAP, models,
Collections.EMPTY_MAP, Collections.EMPTY_LIST);
return outModel;
...
Has anybody some ideas to this Problem?
Thanks in advance,
Waldemar
|
|
|
Powered by
FUDForum. Page generated in 0.02746 seconds