Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Automatically export UML Profile to Xtext DSL(Export UML profile to Xtext DSL)
Automatically export UML Profile to Xtext DSL [message #1834495] Wed, 11 November 2020 13:13 Go to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi all,

I have created UML profile in Papyrus and I need to automatically generate the Xtext grammer for it. I believe it goes like this: I generate an ecore model from the UML profile, and then I generate the Xtext grammar from the ecore model. But what do I use for these generations? Any specific instructions you can provide? Thank you!
Re: Automatically export UML Profile to Xtext DSL [message #1834501 is a reply to message #1834495] Wed, 11 November 2020 14:21 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Xtext supports a textual DSL for a model. A UML profile supports a direct model as UML objects. You are obviously free to define a textual equivalent to your object model, but given the limited uptake of textual forms of UML I must question whether you really want to do this.

In the case of Ecore (or indeed UML) you can consider the XMI text as a textual model and I did some experiments to see how well an autogenerated Xtext grammar could parse the XMI of a known Ecore metamodel compared to the standard EMF loader. It was potentially quite a bit faster, but only on a very warm JVM. In practice the custom parser would run on a cold JVM while the standard EMF loader is re-useable and so potentially warm. I concluded that an auto-generated Xtext grammar would only be a winner if code-generated to C/C++ rather than Java.

You may have another idea for your textual form, perhaps HUTN for which the Epsilon project provides an implementation. If you are producing your own DSL, which may be a good idea, perhaps it is just the UML profile that is a bit mad ...

Regards

Ed Willink
Re: Automatically export UML Profile to Xtext DSL [message #1834504 is a reply to message #1834501] Wed, 11 November 2020 14:45 Go to previous messageGo to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi Ed,

Thank you for you answer. I managed to generate the Xtext grammar, but now I have another issue.

I created a simple database profile with a Base as Package and Table as Class. I added a composition between them two, so that one base is made of 0...* tables. However, when I generate the ecore model, it does not seem right, the composition is gone, and therefore the Xtext grammar is also not as I expect it to be. What do you think could be wrong? I am uploading some screenshots of the profile and the ecore model generated from it.
Re: Automatically export UML Profile to Xtext DSL [message #1834543 is a reply to message #1834504] Thu, 12 November 2020 07:53 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi,

Compositions shouldn't be used Stereotypes; as the Stereotypes structure is unrelated to the UML structure. You don't want a "Base" stereotype to contain a "Table" stereotype; you want a "UML Package" to contain a "UML Class", and then to stereotype the Package with "Base" and the Class with "Table". So the composition should happen on the UML Model; not on the Profile. At best, the Profile may specify constraints (To raise an error if a "Table" UML Class is not owned by a "Base" UML Package).

HTH,
Camille


Camille Letavernier
Re: Automatically export UML Profile to Xtext DSL [message #1834547 is a reply to message #1834543] Thu, 12 November 2020 09:22 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I wrote Quote:
If you are producing your own DSL, which may be a good idea, perhaps it is just the UML profile that is a bit mad ...


There is a strong school of thought that Profiles and Stereotypes are an invention of the devil. They make UML tooling unnecessarily complex by creating an illusion that you can define your own inferior language.

In contrast, metamodeling and DSLs really do define your own clean language. I recommend that you continue your work with a DSL and its underlying Ecore metamodel. Forget about your Profiles and Stereotypes, Use Sirius' Ecore Diagram editor if you need metamodel pictures. Use a Sirius-based editor if you fancy a VDSL rather than a DSL. If you are stuck with a UML-obsessed boss/organisation, explain that you are using sensible tools to prototype your solution. Once prototyped and if the obsession persists, you can migrate to a klunky UML equivalent quite possibly using a bidirectional pair of M2Ms so that you don't discard the better solution.

Regards

Ed Willink
Previous Topic:SysML activity diagram
Next Topic:Create multiples messages in Papyrus communication diagram
Goto Forum:
  


Current Time: Thu Apr 25 06:33:08 GMT 2024

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

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

Back to the top