Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [1...*] cardinality in xtext
[1...*] cardinality in xtext [message #1851907] Thu, 21 April 2022 14:16 Go to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member

I am defining a textual syntax in xtext and part of it is the following:

'Element' '{' element+=Element ( "," element+=Element)* '}' 

I expect this to have a 1...* cardinality , but in the generated ecore model I get 0...*. Is there any other way to write it in the textual syntax to get the 1...* cardinality or is it not possible to get that information in the generated Ecore model?

Re: [1...*] cardinality in xtext [message #1851910 is a reply to message #1851907] Thu, 21 April 2022 14:27 Go to previous messageGo to next message
Rubén Porras Campo is currently offline Rubén Porras CampoFriend
Messages: 67
Registered: July 2009
I think that is the normal translation Xtext will do.

I do not think there is much benefit in having 1.*, but you can do it for sure if you create / maintain the ecore model manually instead of generating it.
Re: [1...*] cardinality in xtext [message #1851912 is a reply to message #1851910] Thu, 21 April 2022 14:44 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14594
Registered: July 2009
Senior Member
Xtext translates cardinalty in ecore and grammar differently
And won't put 1..1 or 1..n to ecore
By design

Twitter : @chrdietrich
Blog :
Previous Topic:Get already build xtext resource in languageServer
Next Topic:Including Maven Dependencies on XText Eclipse Project
Goto Forum:

Current Time: Sat Dec 09 06:09:50 GMT 2023

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

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

Back to the top