Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Completeness of the .ecore generated by Xtext
Completeness of the .ecore generated by Xtext [message #1806901] Fri, 17 May 2019 10:15 Go to next message
Martin Jürgens is currently offline Martin JürgensFriend
Messages: 3
Registered: May 2019
Junior Member
I want to generate instances of an Xtext model. For a start, I am doing it for the Domainmodel, where I take the generated .ecore model and apply model instance generation methods onto it.
What I have noticed is that the generated .ecore does not contain all the properties that the Xtext grammar seems to have.

For example:
- Type is delegated with (|) to DataType or Entity. In my opinion, the Type class / Type part of the generated .ecore file should therefore be abstract (abstract="true")
- For the Feature - Type relation, lowerBound="1" upperBound="1" should be set, as according to the grammar, a Feature must have a Type

Is there a specific reason why the .ecore file is not shaped like this or a way to have it generated in a way such that it contains more information?

The reason why I am asking is this: The model instances that I generate have a graph structure. Based on this graph structure I build up an EObject that I perspectivally want to use for running (testing) generators on. In the case of Type not being abstract, my translator adds Type to the EObject and latest at the step of serialization I am running into a IllegalStateException. For a start, it is okay to manually adjust the .ecore file, but it would be nice to have a more general approach which is blocked by this. So if anyone has any thoughts onto it, feel free to share! :)

Re: Completeness of the .ecore generated by Xtext [message #1806903 is a reply to message #1806901] Fri, 17 May 2019 10:22 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13614
Registered: July 2009
Senior Member
- there are cases where the "abstract" is not wanted. thus its made this way
- the lower = 1 is to have better error messages from the parser instead of emf

if you want full control you can always use a manual metamodel

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Dealing with cross-reference instances
Next Topic:Semicolon optional at end of line
Goto Forum:

Current Time: Tue Sep 29 19:51:56 GMT 2020

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

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

Back to the top