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
Hello,

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?

Thanks,
John!
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
Member
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: 14661
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 : https://www.dietrich-it.de
Previous Topic:Get already build xtext resource in languageServer
Next Topic:Including Maven Dependencies on XText Eclipse Project
Goto Forum:
  


Current Time: Fri Mar 29 05:53:30 GMT 2024

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

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

Back to the top