If you intend to create an ecore meta model by means of a QVTo transformation such a transformation could probably start like so:
modeltype UML uses 'http://www.eclipse.org/qvt/1.0.0/Operational/examples/simpleuml';
modeltype ECORE "strict" uses "http://www.eclipse.org/emf/2002/Ecore";
transformation Simpleuml_To_Ecore(in uml : UML, out ecore: ECORE);
Now care is advisable because not only is ECORE
the language of the output model ecore
,
but likewise the language for both of the meta models.
Unfortunately it is a little awkward or tedious to create references t0 the predefined ecore types, e.g. EString, EInt, EClass or EDataType, with QVTo language constructs only.
This is discussed in the QVTo Forum:
The approach of a black box library, proposed in the second thread above, that provides respective functionality, appears to be the most flexible. Hence I implemented a library for such purposes.
To use it import it:
import de.uwe_ritzmann.qvt.oml.lib.ecore.reflect.EcoreReflect;
The functionality can then be used, e.g., like:
helper JAVA::PrimitiveType::primitiveType2dataType(): ECORE::EDataType
{
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeBoolean) ) return getEDataTypeForName("EBoolean");
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeByte) ) return getEDataTypeForName("EByte");
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeChar) ) return getEDataTypeForName("EChar");
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeDouble) ) return getEDataTypeForName("EDouble");
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeShort) ) return getEDataTypeForName("EShort");
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeFloat) ) return getEDataTypeForName("EFloat");
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeInt) ) return getEDataTypeForName("EInt");
if ( self.oclIsTypeOf(JAVA::PrimitiveTypeLong) ) return getEDataTypeForName("ELong");
return null;
}