Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Is it possible to generate a self contained ecore/genmodel ?(Gereration (from Xcore to Ecore) seems to ignore some settings.)
Is it possible to generate a self contained ecore/genmodel ? [message #1819255] Fri, 10 January 2020 14:29 Go to next message
Harald Mackamul is currently offline Harald MackamulFriend
Messages: 7
Registered: November 2016
Junior Member
Hello,

I am using the "New > EMF Generator model" dialog as described in the Wiki:

Converting Xcore to Ecore
https://wiki.eclipse.org/Xcore#Converting_an_Xcore_Model_to_a_GenModel

index.php/fa/37135/0/

In the first example ecore is included as a 'Referenced generator model', in the second example as one of the 'Root packages'.

There is a small difference in the generated genmodel files.
But:
- the amalthea.ecore files are identical
- no ecore.ecore is generated

References are pointing to the org.eclipse.emf.ecore plugin:
<eClassifiers xsi:type="ecore:EClass" name="Amalthea" eSuperTypes="#//BaseObject">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" unique="false"
        eType="ecore:EDataType ../../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"

My expectation was to get some (self contained) files with local references:
<eClassifiers xsi:type="ecore:EClass" name="Amalthea" eSuperTypes="#//BaseObject">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" unique="false"
        eType="ecore:EDataType ecore.ecore#//EString"

This can be achieved with a simple find/replace but I was wondering if the generation (example 2) should not create these files.
See 'expected result' folder of the attached Zip archive.

Thanks
Harald
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819276 is a reply to message #1819255] Sat, 11 January 2020 07:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30903
Registered: July 2009
Senior Member
A *.xcore defines only one EPackage so importing from it to convert it to *.ecore/*.genmodel should only produce one *.ecore with one EPackage. And in the end Ecore is rather special so I'm not sure how you'd do anything useful with a copy of that even if that did work for importing from Xcore...
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819277 is a reply to message #1819276] Sat, 11 January 2020 13:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6590
Registered: July 2009
Senior Member
Hi

Traditionally the multi-level OMG model hierarchy has

M0 user instances
M1 user model, typically *.uml (or *.ecore using Eclipse)
M2 metamodel, perhaps *.mof, (or *.ecore using Eclipse)
M3 universal metametamodel, perhaps *.mof, (or *.ecore using Eclipse)

Only the universal metametamodel avoids references by defining itself. If you want a new paradigm go for it, but you'll find that starting from scratch requires a huge investment of effort.

Anything else necessarily refers one level up in order to reference what is being defined. (If you study Ecore.ecore really hard you may decide that some of the EDataType references are to the wrong level.)

Regards

Ed Willink
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819331 is a reply to message #1819277] Mon, 13 January 2020 11:55 Go to previous messageGo to next message
Harald Mackamul is currently offline Harald MackamulFriend
Messages: 7
Registered: November 2016
Junior Member
Hi Ed,

thanks for the reply.
I am afraid that "self contained" in the title was a bit misleading. I remember longish discussions regarding the M0... model hierarchy in our team and did not want to question the standard paradigms.
I was mainly interested in a consistent way to exchange the model definition with consumers of our model (that use non Java implementations to manipulate the content).

Best regards
Harald
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819332 is a reply to message #1819331] Mon, 13 January 2020 12:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30903
Registered: July 2009
Senior Member
If people need to see/load Ecore.ecore, they can find it here:

https://git.eclipse.org/c/emf/org.eclipse.emf.git/tree/plugins/org.eclipse.emf.ecore/model

But I'm a bit doubtful about the actual utility of a non-Java implementation loading XMI content without an Ecore implementation to govern what's being manipulated.

In the end, this Xcore import facility is intended to produce a *.ecore/*.genmodel that can be consumed by EMF's own tools to generate the same result as what's generated from the *.xcore. It's not designed to produce an interchange format for external tools where all the magical mappings to other models in the target platform or running IDE are copied into a self-contained single folder as "source" *.ecore/*.genmodel resources...
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819333 is a reply to message #1819276] Mon, 13 January 2020 12:21 Go to previous messageGo to next message
Harald Mackamul is currently offline Harald MackamulFriend
Messages: 7
Registered: November 2016
Junior Member
Hi Ed,

I am fine with the one EPackage from Xcore and only wanted to include the ecore definition for completeness.

Perhaps it is only a question of the UI.
It was surprising to me that the dialog title says "specify packages to generate" (and even the filenames could be customized) but only one of the files was created.
As a comparison: Another EMF dialog that exports a genmodel as "XML Schema" or "XML Schema for XMI" has a similar UI and generates a file "Ecore.xsd" or "EcoreXMI.xsd" in addition the main file.

Just an observation...

Best regards
Harald
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819337 is a reply to message #1819333] Mon, 13 January 2020 13:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30903
Registered: July 2009
Senior Member
Yes, it's a little misleading, but Ecore really is special and no doubt something special has kicked in. One thing special about Ecore, for example, is that one can use Ecore's EDataTypes without referencing Ecore's GenModel's GenPackage, and can do so using just the nsURI too.

The exporter is a totally different situation from the importer though it looks very similar. Here the schema must reference another schema and will not be very usable without an explicit import...
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819347 is a reply to message #1819337] Mon, 13 January 2020 15:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30903
Registered: July 2009
Senior Member
My guess would be that you've created some type of linked resource that links up to its own parent such that you've induced an finite tree. If you could reproduce this in a runtime workspace where you can set a breakpoint to inspect the stack and the resources involved that might help you track such a thing down.
Re: Is it possible to generate a self contained ecore/genmodel ? [message #1819370 is a reply to message #1819347] Tue, 14 January 2020 04:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30903
Registered: July 2009
Senior Member
Sorry, the last post was meant for the EGit forum.
Previous Topic:Ecore model serialization: element name replacement via ExtendedMetaData
Next Topic:ECORE in EMF
Goto Forum:
  


Current Time: Tue Feb 25 14:02:16 GMT 2020

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

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

Back to the top