Bug in Flock Default Copy - Enums moved to resource [message #1856260] |
Wed, 30 November 2022 02:25 |
|
I am trying to use flock for metamodel syntax conversion (emfatic to ecore) and I believe there is a bug in the copy behaviour of flock. My understanding is that without any other instructions, flock should copy a model. I am including an example.
With this emfatic:
@namespace(
uri="http://example",
prefix="e")
package p;
enum E {
L = 0;
}
and this flock call:
<project name="project" default="copyMetamodelToEcore">
<target name="copyMetamodelToEcore">
<epsilon.emf.loadModel name="source"
modelfile="source.emf"
read="true"
store="false"
validate="true" />
<epsilon.emf.loadModel name="target"
modelfile="target.ecore"
read="false"
store="true"
validate="true" />
<epsilon.flock originalModel="source" migratedmodel="target">
<model ref="source" />
<model ref="target" />
</epsilon.flock>
</target>
</project>
When copied using flock, it looks like this. Note that the literal is not part of the package. It is a separate element in the resource. It also serialising using xmi.
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<ecore:EPackage name="p" nsURI="http://example" nsPrefix="e">
<eClassifiers xsi:type="ecore:EEnum" name="E"/>
</ecore:EPackage>
<ecore:EEnumLiteral name="L" literal="L"/>
</xmi:XMI>
When converted to ecore, it looks like this, as expected:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="p" nsURI="http://example" nsPrefix="e">
<eClassifiers xsi:type="ecore:EEnum" name="E">
<eLiterals name="L"/>
</eClassifiers>
</ecore:EPackage>
- Is this a bug?
- Can I patch around this?
[Updated on: Wed, 30 November 2022 02:29] Report message to a moderator
|
|
|
Re: Bug in Flock Default Copy - Enums moved to resource [message #1856261 is a reply to message #1856260] |
Wed, 30 November 2022 05:02 |
|
If anyone comes here looking for a path, the hack below if added to a flock migration strategy fixes the issue in so far that the literals are now transferred, but it still leaves the XMI wrapper and another copy of the literals in the resource.
migrate EEnum {
migrated.eLiterals = original.eLiterals;
}
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03753 seconds