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: 214
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: 62
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: 14349
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


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
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: Sun Sep 25 08:37:13 GMT 2022

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

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

Back to the top