Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtextgrammar for UML-stereotypes
Xtextgrammar for UML-stereotypes [message #1176625] Fri, 08 November 2013 13:00 Go to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hello,

I am importing the current UML2 metamodel und creating a grammar for a subset of it.

In this way:
import "http://www.eclipse.org/uml2/4.0.0/UML"

Model returns Model:
	(packagedElement+=PackageableElement)*;
....

Everything works fine so far. Now I created an uml profile where I extend some UML2-Elements from the UML2-metamodel. I imported and defined my profile in the UML.uml file and everything is valid.

My question is now: Is it possible to access the stereotype-tags for the uml-element I extended, via the xtext grammar? The aim is to implement a textual
representation (DSL) for exactly these stereotype-tags.

Is this even possible in Xtext 2.4.2?

I hope somebody might give me an answer.

Regards,
Alex
Re: Xtextgrammar for UML-stereotypes [message #1176818 is a reply to message #1176625] Fri, 08 November 2013 15:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13657
Registered: July 2009
Senior Member
Hi,

i am not sure what you mean. when saying "from the grammar".

so you want to do this when writing the grammar or at runtime/reflective?


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: Xtextgrammar for UML-stereotypes [message #1176819 is a reply to message #1176818] Fri, 08 November 2013 15:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13657
Registered: July 2009
Senior Member
P.S: can you share an expected sample model?

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: Xtextgrammar for UML-stereotypes [message #1177009 is a reply to message #1176819] Fri, 08 November 2013 18:04 Go to previous messageGo to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hi,
the idea is to expand one uml-element with the help of stereotypes. Here an example what I would like to do.
1. Expand the UML-Operation-Metaclass with a new feature "bodyimplementation"
2. Define the grammer for this "new" feature in the .xtext-File (grammar-file)
3. Let the user define some bodyimplementations with the help of the DSL in a new eclipse-runtime (in a .mydsl file)

At the end it should look like this in the .mydsl file :
class Car :
        public calcInstallmentPerMouth(int mounth, double price){        
          double res = price/mounth; <----FOR THIS STATEMENT I WANT TO USE STEREOTYPE
          return res;
        }

So I created a uml-profile with a stereotype to specialize the "body" of an operation. My question is now, how and where can I access the new feauture "bodyimplementation" in the xtext? I thought it might be possible just to write a parser-rule for the new "feature" like:

MySpecialOperation  returns uml::Operation :
 name = ID ...
 bodyimplementation = BodyimplementationParserRuler
...
;
BodyimplementationParserRuler returns uml::Bodyimplementation:
...
;


Is this even possible or do I missunderstand something?
~Alex
Re: Xtextgrammar for UML-stereotypes [message #1177057 is a reply to message #1177009] Fri, 08 November 2013 18:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13657
Registered: July 2009
Senior Member
Hi,

i dont think that is possible


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: Xtextgrammar for UML-stereotypes [not solvable] [message #1183022 is a reply to message #1177057] Tue, 12 November 2013 15:33 Go to previous message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Thanks for your answer. I also recognized that my aim is not reachable... So I will not longer import the UML-Metamodell to specify a syntax for a subset of its elements. Sadly I have to admit that it is not possible to define a grammar for UML-Stereotypes and of course it is not possible to make any changes on the UML2-metamodel...Sad

Thanks alot for all your help.
Alex
Previous Topic:Infinite looping in partial parser
Next Topic:Left Factoring in grammar problem
Goto Forum:
  


Current Time: Tue Nov 24 19:05:13 GMT 2020

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

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

Back to the top