Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext & Sirius Integrate Problems
icon9.gif  Xtext & Sirius Integrate Problems [message #1737044] Tue, 05 July 2016 09:27 Go to next message
Nicholas Kong is currently offline Nicholas KongFriend
Messages: 59
Registered: July 2016
Location: China
Member
I am fresh man in Xtext.

Now I am try to use the Sirius Sample to integrate with Xtext, But I find some problems:

Here is the meta-model diagram:
index.php/fa/26386/0/

1: After I import the existing meta-model,the Xtext grammar give a warnning like this:

"The feature 'children' is a bidirectional reference. "

And I can't create a model in instance Eclipse using this meta model.The error like this:
index.php/fa/26384/0/

Is it means that Xtext not support bi-directional reference(EOpposite)? If I want to use this feature, How should I do.

2: When I run a instance Eclipse, and want to use this meta-model to create model with Sirius, there is a problem when the model is created. It seems like the wizard dose not create Family ***{ } grammar. So I cant save the instance model.
index.php/fa/26385/0/
Are there any one who knows if I want use Xtext & Sirius integrate, Where I should be noted?



Thank you!

[Updated on: Wed, 06 July 2016 03:05]

Report message to a moderator

Re: Xtext & Sirius Integrate Problems [message #1737087 is a reply to message #1737044] Tue, 05 July 2016 15:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14726
Registered: July 2009
Senior Member
yes bidi refs are not supported well.

in your grammar / the inferred grammar you have only one direction now?
if yes mark the other direction as transient via org.eclipse.xtext.serializer.sequencer.ITransientValueService


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Xtext & Sirius Integrate Problems [message #1737131 is a reply to message #1737087] Wed, 06 July 2016 03:18 Go to previous messageGo to next message
Nicholas Kong is currently offline Nicholas KongFriend
Messages: 59
Registered: July 2016
Location: China
Member
Christian Dietrich wrote on Tue, 05 July 2016 15:11
yes bidi refs are not supported well.

in your grammar / the inferred grammar you have only one direction now?
if yes mark the other direction as transient via org.eclipse.xtext.serializer.sequencer.ITransientValueService


Thanks for your answer, Christain.

The edge "/father" & "/mother" is set the 'Derived' property in Ecore.

But this reference is not appearance in Xtext, the grammar as this:

// automatically generated by Xtext
grammar org.eclipse.sirius.sample.basicfamily.Dsl with org.eclipse.xtext.common.Terminals

import "platform:/resource/org.eclipse.sirius.sample.basicfamily/model/basicfamily.ecore" 
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Family returns Family:
	{Family}
	'Family'
	name=ID
	'{'
		('members' '{' members+=Person ( "," members+=Person)* '}' )?
	'}';

Person returns Person:
	Man | Woman;

Man returns Man:
	{Man}
	'Man'
	name=ID
	'{'
		('children' '(' children+=[Person|STRING] ( "," children+=[Person|STRING])* ')' )?
		('parents' '(' parents+=[Person|STRING] ( "," parents+=[Person|STRING])* ')' )?
	'}';

Woman returns Woman:
	{Woman}
	'Woman'
	name=ID
	'{'
		('children' '(' children+=[Person|STRING] ( "," children+=[Person|STRING])* ')' )?
		('parents' '(' parents+=[Person|STRING] ( "," parents+=[Person|STRING])* ')' )?
	'}';


As you said "mark the other direction as transient via org.eclipse.xtext.serializer.sequencer.ITransientValueService", what should I do for this.
Would you please give me more detail introduction?

Note:
I have attached the source code.


Thanks a lot.




[Updated on: Wed, 06 July 2016 03:25]

Report message to a moderator

Re: Xtext & Sirius Integrate Problems [message #1737136 is a reply to message #1737131] Wed, 06 July 2016 04:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14726
Registered: July 2009
Senior Member
i am not sure what you need as details

@SuppressWarnings("restriction")
public class MyTransientValueService extends LegacyTransientValueService {
	
	@Override
	public ValueTransient isValueTransient(EObject semanticObject, EStructuralFeature feature) {
		if (feature == YourDslPackage.Literals.ABC_XYZ) {
			return ValueTransient.YES;
		}
		return super.isValueTransient(semanticObject, feature);
	}

}


def Class<? extends ITransientValueService> bindITransientValueService2() {
		MyTransientValueService
	}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Xtext & Sirius Integrate Problems [message #1737362 is a reply to message #1737136] Thu, 07 July 2016 14:58 Go to previous message
Nicholas Kong is currently offline Nicholas KongFriend
Messages: 59
Registered: July 2016
Location: China
Member
Christian Dietrich wrote on Wed, 06 July 2016 04:44
i am not sure what you need as details

@SuppressWarnings("restriction")
public class MyTransientValueService extends LegacyTransientValueService {
	
	@Override
	public ValueTransient isValueTransient(EObject semanticObject, EStructuralFeature feature) {
		if (feature == YourDslPackage.Literals.ABC_XYZ) {
			return ValueTransient.YES;
		}
		return super.isValueTransient(semanticObject, feature);
	}

}


def Class<? extends ITransientValueService> bindITransientValueService2() {
		MyTransientValueService
	}



I will try it! Thanks a lot!
Previous Topic:Problem with importing several projects
Next Topic:Xtext Project From Existing Ecore Models Problems
Goto Forum:
  


Current Time: Wed Oct 16 01:04:17 GMT 2024

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

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

Back to the top