Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Bi-directional reference
Bi-directional reference [message #1851123] Mon, 28 March 2022 12:01 Go to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 214
Registered: October 2020
Senior Member
Hi all,

I was wondering how I can write the grammar for bi directional references where one side is a containment.
If we take the following example:

index.php/fa/41819/0/

The only way I can think of writing this is the following:

Test returns Test:
{Test}
test = [Test | FQN]
 ('{' testeOpposite +=Test ( "," testeOpposite +=Test)* '}' )


However, this is not the same because in this case I get:
index.php/fa/41820/0/

Is there any way around this?

Thank you!
Re: Bi-directional reference [message #1851128 is a reply to message #1851123] Mon, 28 March 2022 13:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14349
Registered: July 2009
Senior Member
maybe you can simply use a containment ref and do the opposite e.g. via giving
the generic eContainer a different name via eoperation

or you simply just use eContainer and live with it.


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
Re: Bi-directional reference [message #1851135 is a reply to message #1851128] Mon, 28 March 2022 15:38 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7517
Registered: July 2009
Senior Member
Hi

Xtext is a powerful grammar tool that often produces a useful Ecore metamodel as a side effect.

However if you want to control your metamodel explicitly rather than accidentally you should treat your *.ecore development as your primary activity and then use it with rather than generate it from Xtext.

Regards

Ed Willink
Previous Topic:xtend src-gen folder relative to dsl file
Next Topic:Xtext maven plugin language order
Goto Forum:
  


Current Time: Sun Sep 25 07:38:52 GMT 2022

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

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

Back to the top