Skip to main content



      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 06:15 Go to next message
Eclipse UserFriend
Hi,
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! :)

Thanks,
Martin
Re: Completeness of the .ecore generated by Xtext [message #1806903 is a reply to message #1806901] Fri, 17 May 2019 06:22 Go to previous message
Eclipse UserFriend
- 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
Previous Topic:Dealing with cross-reference instances
Next Topic:Semicolon optional at end of line
Goto Forum:
  


Current Time: Mon Mar 24 08:35:20 EDT 2025

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

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

Back to the top