Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Bug in Flock Default Copy - Enums moved to resource(Flock cannot be used to copy metamodels that contain enums)
Bug in Flock Default Copy - Enums moved to resource [message #1856260] Wed, 30 November 2022 02:25 Go to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

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>




  1. Is this a bug?
  2. 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 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

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;
}
Re: Bug in Flock Default Copy - Enums moved to resource [message #1856262 is a reply to message #1856261] Wed, 30 November 2022 05:14 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Also turns out that all Elements, including EClasses, are explicit children of EObject...
Re: Bug in Flock Default Copy - Enums moved to resource [message #1856316 is a reply to message #1856262] Fri, 02 December 2022 09:17 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Thanks for reporting this and for sharing a workaround! I've created an issue for this on GitHub.

Best,
Dimitris

[Updated on: Fri, 02 December 2022 09:17]

Report message to a moderator

Re: Bug in Flock Default Copy - Enums moved to resource [message #1856317 is a reply to message #1856316] Fri, 02 December 2022 11:07 Go to previous messageGo to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Thank you for taking this up!
Re: Bug in Flock Default Copy - Enums moved to resource [message #1856883 is a reply to message #1856317] Sat, 07 January 2023 01:39 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

This has been fixed in https://github.com/eclipse/epsilon/commit/bb0cb4e25d228cc1000f415e1e98dcbbc8c150b8

Thanks,
Dimitris
Previous Topic:Using Epsilon with CDO
Next Topic:Including pinset dataset into markdown file using picto
Goto Forum:
  


Current Time: Sat Apr 27 02:40:38 GMT 2024

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

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

Back to the top