Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext & EAnnotation
Xtext & EAnnotation [message #878932] Wed, 30 May 2012 08:26 Go to next message
Hans-Georg Glöckler is currently offline Hans-Georg GlöcklerFriend
Messages: 88
Registered: July 2009
Member
When I create an Ecore-Model of my Xtext-Grammar, I can create the following features of the Ecore-Model
EPackage
EClass
EAttribute
EReference
EDataType
EEnum

This I know.
My Question is:
But how can I create an EAnnotation in the Ecore-Model by the Xtext-Grammar?

An EAnnotation for:
EClass
EReference
EAttribute

[Updated on: Wed, 30 May 2012 08:27]

Report message to a moderator

Re: Xtext & EAnnotation [message #878934 is a reply to message #878932] Wed, 30 May 2012 08:27 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13520
Registered: July 2009
Senior Member
Hi,

you can maintain the metamodel manually.
what is your exact usecase?

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext & EAnnotation [message #878945 is a reply to message #878934] Wed, 30 May 2012 08:51 Go to previous messageGo to next message
Hans-Georg Glöckler is currently offline Hans-Georg GlöcklerFriend
Messages: 88
Registered: July 2009
Member
I want set for the following things EAnnotations:
EReference, EClass, EAttribut

I want then generate Code with Xpand from the Ecore-Model.

My Workflow is:
1. Generate a Xtext-Grammar
2. Generate from this Xtext-Grammar an Ecore-Model
3. Generate from this Ecore-Model with Xpand Java-Source-Code

In former times I have created by Hand an Ecore-Model und then created form this Ecore-Model via Xpand the responding Java-Sourcecode. In this Ecore-Model I have worked with EAnnotations for EClass, EAttribute, EReference.

For Example with EReference:
EReference is in an EClass with the following EAnnotations
reftype=OneToOne
bidirectional=true
Re: Xtext & EAnnotation [message #878966 is a reply to message #878945] Wed, 30 May 2012 09:31 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13520
Registered: July 2009
Senior Member
Hi,

i still do not get it what this has to do with Xtext? maybe you mix up metalevels.
if you want to create a grammar for ecore noone prevents you from doing this
(but one metalevel up) or reusing xcore
which gives you that for free.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext & EAnnotation [message #878977 is a reply to message #878966] Wed, 30 May 2012 09:48 Go to previous messageGo to next message
Hans-Georg Glöckler is currently offline Hans-Georg GlöcklerFriend
Messages: 88
Registered: July 2009
Member
Hello, please don't misunderstand me.
With Xtext I can create an Ecore-Model.
Thats very iportant for me, because of Xpand.
With Xpand and Ecore it is very easy to create java-sourcecode.
This is the benfit.
The only missing element in this area are EAnnotations in Ecore.
I can not create with Xtext Ecore-EAnnotations.
All the other Stuff of ecore I can create/generate by Xtext.

I am looking only for a Rule in Xtext, which will generate me an EAnnotation in the corresponding Ecore-Model. That's all.

Plesae don't forget:
Xtext-Ecore-Xpand is a very good workflow.

I will write you today in the afternoon or tomorrow an use-case.
I want create a DSL with Xtext for:
- creating JPA-File
- to set some parameters in the view

[Updated on: Wed, 30 May 2012 09:52]

Report message to a moderator

Re: Xtext & EAnnotation [message #878979 is a reply to message #878977] Wed, 30 May 2012 09:53 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13520
Registered: July 2009
Senior Member
still dont get it can you come up with an example grammar model metamodel and template?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext & EAnnotation [message #878985 is a reply to message #878977] Wed, 30 May 2012 10:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6795
Registered: July 2009
Senior Member
Hi

If you want a non-trivial Ecore meta-model, you really want to edit it
directly; Xtext's parasitic generation of an Ecore meta-model is very
convenient for simple applications, but Xtext is _not_ an Ecore editor.

For Ecore editing you have many choices:
- Xcore or OCLinEcore which are both Xtext editors
- the traditional Sample Ecore Editor
- the Ecore Tools Diagram editor

Regards

Ed Willink


On 30/05/2012 10:48, hans-georg wrote:
> Hello, please don't misunderstand me.
> With Xtext I can create an Ecore-Model.
> Thats very iportant for me, because of Xpand.
> With Xpand and Ecore it is very easy to create java-sourcecode.
> This is the benfit.
> The only missing element in this area are EAnnotations in Ecore.
> I can not create with Xtext Ecore-EAnnotations.
> All the other Stuff of ecore I can create/generate by Xtext.
>
> I am looking only for a Rule in Xtext, which will generate me an
> EAnnotation in the corresponding Ecore-Model. That's all.
>
> Plesae don't forget:
> Xtext-Ecore-Xpand is a very good workflow.
Re: Xtext & EAnnotation [message #878986 is a reply to message #878979] Wed, 30 May 2012 10:05 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13520
Registered: July 2009
Senior Member
P.S: as i said. there is not such a possibility
=>
(a) use a manually maintained metamodel
(2) use metamodel postprocessing to fix the ecore (e.g.
http://christiandietrich.wordpress.com/2011/07/22/customizing-xtext-metamodel-inference-using-xtend2/
http://malubu.wordpress.com/2012/05/07/post-processing-vs-post-initialization/
)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext & EAnnotation [message #879002 is a reply to message #878986] Wed, 30 May 2012 10:41 Go to previous message
Hans-Georg Glöckler is currently offline Hans-Georg GlöcklerFriend
Messages: 88
Registered: July 2009
Member
thanks, i have understand.
it's all ok.
it was a misunderstanding of my site.
Previous Topic:simplified grammar for autocompletion
Next Topic:mixed uri and namespace imports
Goto Forum:
  


Current Time: Fri Aug 07 15:34:40 GMT 2020

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

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

Back to the top