Creating EMF Profile Diagrams?

229 views
Skip to first unread message

Emre Taspolatoglu

unread,
Mar 27, 2013, 11:00:57 AM3/27/13
to emf-pr...@googlegroups.com
Hello,

first of all, great work you are doing here. Congrats! To use the simple idea behind UML Profiles by EMF models is a great and easy approach to extend your existing models without breaking it up.

But my question regards to the practical use of it. I was following your tutorial videos, after installing the "EMF Profiles" from your update site into my Eclipse EMF + Papyrus combination. So the next thing I wanted to do was to create an EMF Profile to apply it to my example EMF model. But as far as I can see, there is simply no create "EMF Profile" or "EMF Profile Diagram" option in the "New"-Wizard. But only an "EMF Profile Project" to create a new project from scratch. You can of course create EMF Profile's in it, but I would like to create profiles in my existing models.

I know that the entire project isn't that old, but I believe that maybe the video tutorials have gone old, and you meanwhile have changed/improved the plug-in, and with that changed the way to create profiles. Can it also be? Or am I missing something?

Would be very glad to hear from you about it. And again, keep up the great work!

Best regards,
Emre

Philip Langer

unread,
Mar 27, 2013, 1:41:15 PM3/27/13
to emf-pr...@googlegroups.com
Hi Emre,

thanks for your interest in EMF profiles! We are glad that you like the idea.

But my question regards to the practical use of it. I was following your tutorial videos, after installing the "EMF Profiles" from your update site into my Eclipse EMF + Papyrus combination. So the next thing I wanted to do was to create an EMF Profile to apply it to my example EMF model. But as far as I can see, there is simply no create "EMF Profile" or "EMF Profile Diagram" option in the "New"-Wizard.

You are totally right... the documentation (screencasts, etc) is unfortunately not up to date. The new procedure of creating an EMF profile is by using the "EMF Profile Project" wizard (the one you mentioned). This will create a new project (with the EMF Profile project nature) containing an empty EMF Profile Diagram. In this diagram you can model your EMF Profile (as before). As soon as you finished and saved your profile, you can apply it to corresponding models (in the EMF Profile Applications view). There is no need to register the profile first, as the workspace is scanned for EMF profile projects, which are then loaded into a global profile registry. You can inspect this profile registry with the "Registered EMF Profiles" view.

I would like to create profiles in my existing models

Do you mean creating profiles in existing projects? Unfortunately this is not possible anymore... profiles have to be in a specific profile project. The reason why we switched to the project-based way of creating and maintaining projects is to get rid of having to register profiles manually (profiles in EMF profile projects are registered in a profile registry automatically), to find a way to bundle profiles and accompanied icons, and that you can now export your EMF profile project as bundle (plug-in) and distribute it with your other plug-ins. Once such an EMF Profile plug-in is installed, the contained profile can be used in Eclipse without the need of having the profile project in the workspace (EMF Profile projects implement a dedicated extension point).

Please do not hesitate to ask further questions or to report issues at https://code.google.com/a/eclipselabs.org/p/emf-profiles/issues/list.

We are happy to help you in using EMF profiles!

Best wishes,
Philip

Emre Taspolatoglu

unread,
Mar 28, 2013, 5:52:07 AM3/28/13
to emf-pr...@googlegroups.com
Hi Philip,

thanks for your quick response. That was exactly what I wanted know. Sure, I am not in a position to compare the new system with the old one, but it sure seems to work. And I have managed to extend my example EMF models through different Profile-projects.

But I have again some new questions. Hope you would help me with them.

First of all, it seems to me -or I am doing something wrong somewhere-, that event though I save my "profiled" models, later I always need to load the profile applications again after closing and opening the EMF models/workspace etc., to get the extension to my models. But again, the tagged values stay the same after the fresh loading of the profile. So, I understand from that, that the stereotypes and values are being saved into EMF model, but can't be seen after being closed and need to be reloaded again. Hope that I am expressing my problem right? :)

Second thing is, that I don't just want to extend my *.ecore's, meaning not only on meta-model level, but also initialize and later on generate the code. I believe, that this is the main contribution of EMF Profiles, right? :) I haven't gone so far with the code generating, but I have tried to create dynamic instances of "profiled" EMF models to test the stereotypes/extensions. But it didn't work. Maybe, the extensions just don't show up in the .xmi-files and there is a special way or a view for that? I -unfortunately- didn't find anything in the tutorials. I would be very glad, if you could point me to the right direction for this matter.

Again, thanks a lot, and be ready to further questions in the futere. I just hope, you could find the time and will to response to them.

Best regards,
Emre


On Wednesday, March 27, 2013 4:00:57 PM UTC+1, Emre Taspolatoglu wrote:

Philip Langer

unread,
Mar 28, 2013, 6:26:43 AM3/28/13
to emf-pr...@googlegroups.com
Hi Emre,

please find my responses inline...


On Thursday, March 28, 2013 10:52:07 AM UTC+1, Emre Taspolatoglu wrote:
Hi Philip,

thanks for your quick response. That was exactly what I wanted know. Sure, I am not in a position to compare the new system with the old one, but it sure seems to work. And I have managed to extend my example EMF models through different Profile-projects.

But I have again some new questions. Hope you would help me with them.

First of all, it seems to me -or I am doing something wrong somewhere-, that event though I save my "profiled" models, later I always need to load the profile applications again after closing and opening the EMF models/workspace etc., to get the extension to my models. But again, the tagged values stay the same after the fresh loading of the profile. So, I understand from that, that the stereotypes and values are being saved into EMF model, but can't be seen after being closed and need to be reloaded again. Hope that I am expressing my problem right? :)

Yes, exactly, the profile application needs to be loaded when re-opening the profiled model. In contrast to UML profiles, EMF profile applications are saved "outside" of the profiled model resource. The stereotype applications (including the tagged values) of the profile application are saved in a separate file, which is the *.pa.xmi file. This file references the profiled models using cross-references. At least in the most current version in the develop branch we make sure that we use the platform:/resource/ protocol of EMF for referencing the profiled model. Separating the profile applications from the profiled model (as opposed to how it is done in UML tools) has the advantage that the profile applications do not pollute the models and can be loaded and unloaded as needed. Also, you can apply the same profile multiple times to the same model (which is not possible in UML) and select afterwards which profile application you now want to load.
 
Second thing is, that I don't just want to extend my *.ecore's, meaning not only on meta-model level, but also initialize and later on generate the code. I believe, that this is the main contribution of EMF Profiles, right? :) I haven't gone so far with the code generating, but I have tried to create dynamic instances of "profiled" EMF models to test the stereotypes/extensions. But it didn't work. Maybe, the extensions just don't show up in the .xmi-files and there is a special way or a view for that? I -unfortunately- didn't find anything in the tutorials. I would be very glad, if you could point me to the right direction for this matter.

I'm not sure if I understand the question correctly... you can apply profiles to instances of your Ecore model. But these profiles then have to be "typed" not to the Ecore metamodel itself, but to your metamodel. Thus, instead of importing and extending metamodel elements from Ecore in the profile diagram you need to import metamodel elements from your metamodel and extend those. Once you have your profile for your metamodel, this profile can be applied to instances of your metamodel; this should work for dynamic instances as well as for instances that are created with the editor generated from your metamodel. The generated code is not affected by the profiles on metamodel-level, as the profile mechanism works generically.
 
If you were referring with your question to considering your profile applications applied to your metamodel during the code generation, you'd have to load the profile application and read its tagged values from the respective code generation technology... e.g., with xtend it is easy to load profile applications and read them, as you can simply use the Profile Facade from within Xtend. But it is also possible with XPand, though it you have to do more manually since you cannot use the profile facade and you'd have to load and read the profile applications as normal EMF-based models.

Hope that helps! Don't hesitate to ask further questions!

Best wishes,
Philip

Emre Taspolatoglu

unread,
Apr 6, 2013, 4:07:00 PM4/6/13
to emf-pr...@googlegroups.com
Hello Philip,
 
thanks again for your response. It was very helpful.
 
But I believe that I need to form my second question again. Before that, what I have managed so far:
 
1. Creating/loading profile application and registering them. (Pretty automatic :))
2. Applying the stereotypes of loaded profile applications (which are extending the Ecore itself - i.e. EClass) to different *.ecore models
3. Applying the stereotypes of loaded profile applications (which are extending my own created *.ecore models) to the instances of the same *.ecore models
 
The thing with *.pa.xmi files are also understood and after an initial phase pretty easy to use.
 
So, what I want to do now is to instantiate *.ecore models, which have been extended through corresponding EMF profiles/stereotypes. In other words, I want to take the option 2 above one step further. I am wondering if there is a direct way to achieve this, since the applied extensions (inc. tagged values) are saved seperated (*.pa.xmi) from the ecore model and therefor aren't a part of the metamodel.
 
I hope that I am not missing something and don't sound silly.
 
Best regards and have a nice sunday,
Emre
 

On Wednesday, March 27, 2013 4:00:57 PM UTC+1, Emre Taspolatoglu wrote:

Philip Langer

unread,
Apr 10, 2013, 2:08:39 AM4/10/13
to emf-pr...@googlegroups.com
Hi Emre,

Sorry for the delay! My answers are inline below...

On Saturday, April 6, 2013 10:07:00 PM UTC+2, Emre Taspolatoglu wrote:
Hello Philip,
 
thanks again for your response. It was very helpful.
 
But I believe that I need to form my second question again. Before that, what I have managed so far:
 
1. Creating/loading profile application and registering them. (Pretty automatic :))
2. Applying the stereotypes of loaded profile applications (which are extending the Ecore itself - i.e. EClass) to different *.ecore models
3. Applying the stereotypes of loaded profile applications (which are extending my own created *.ecore models) to the instances of the same *.ecore models

Great!
 
 
The thing with *.pa.xmi files are also understood and after an initial phase pretty easy to use.
 
So, what I want to do now is to instantiate *.ecore models, which have been extended through corresponding EMF profiles/stereotypes. In other words, I want to take the option 2 above one step further. I am wondering if there is a direct way to achieve this, since the applied extensions (inc. tagged values) are saved seperated (*.pa.xmi) from the ecore model and therefor aren't a part of the metamodel.

I'm not quite sure, if I understand your question. When you instantiate your Ecore model, you can do that just as usual by creating dynamic instances or by generating an editor and use it to create instances. The profile applications applied to that Ecore models are not considered when creating instances (you only added additional information to your Ecore model; that is, you extended Ecore). If you need to extend your modeling language (that is your specific Ecore model), you need to do what you described in option 3. Then you can extend your modeling language and add additional information to models conforming to your modeling language.

Maybe you can give me more concrete details about what you want to achieve and I try to give you more concrete suggestions on that. Hope that helps!

Best wishes,

Philip

Emre Taspolatoglu

unread,
Apr 14, 2013, 6:33:31 AM4/14/13
to emf-pr...@googlegroups.com
Hello Philip,

I don't think that you are understanding me wrong, I just wasn't able to formulate my thoughts right. :) But, for the time being, what you have showed me, is satisfying for my further work.

But I need help regarding a new topic, which actually doesn't have anything directly with the EMF-Profiles itself. I need the most up-to-date version of the plug-in for my further project. So instead of from the update site, I have downloaded the source code from the GIT repository. But unfortunately I don't know the next steps to install the plug-in into my Eclipse development environment from the source code. I would be very glad, if you could show me how I can get this working.

Best regards and again a nice Sunday,
Emre

Philip Langer

unread,
Apr 15, 2013, 6:02:32 AM4/15/13
to emf-pr...@googlegroups.com
Hi Emre,


On Sunday, April 14, 2013 12:33:31 PM UTC+2, Emre Taspolatoglu wrote:
Hello Philip,

I don't think that you are understanding me wrong, I just wasn't able to formulate my thoughts right. :) But, for the time being, what you have showed me, is satisfying for my further work.

But I need help regarding a new topic, which actually doesn't have anything directly with the EMF-Profiles itself. I need the most up-to-date version of the plug-in for my further project. So instead of from the update site, I have downloaded the source code from the GIT repository. But unfortunately I don't know the next steps to install the plug-in into my Eclipse development environment from the source code. I would be very glad, if you could show me how I can get this working.


Usually, you'd just put your other plug-in projects (the ones you'll be creating based on EMF Profiles) next to the EMF Profiles plug-in projects and start the Eclipse Application from within your Eclipse (run as Eclipse Application)... this will start a new Eclipse instance which has all the plug-in projects of your workspace deployed. If you really want to get the jars for deploying them into an own Eclipse, the easiest thing is exporting them: http://www.vogella.com/articles/EclipsePlugIn/article.html#deployplugin. If you want to have an own update site, you can follow this tutorial: http://www.vogella.com/articles/EclipsePlugIn/article.html#p2deployplugin

Hope that helps!

Philip

Emre Taspolatoglu

unread,
Apr 15, 2013, 11:59:08 AM4/15/13
to emf-pr...@googlegroups.com
Hello Philip,

yes, the references were very helpful. And some of the functions, that I was eager to have, are indeed in the up-to-date source code. Such as remarks on classes, that say that the class has been extended through some stereotypes.

I will be working on the integration of the EMF profiles in our project, therefor I am sure that I will be asking some further questions in the future. But for now, thanks again for your help.

With regards,
Emre

Philip Langer

unread,
Apr 16, 2013, 1:07:43 PM4/16/13
to emf-pr...@googlegroups.com
Great, good to hear that you'll be working with EMF Profiles. Feel free to come up with additional questions at any time! We also appreciate any feedback or issue reports and feature requests.

Best wishes,

Philip
Reply all
Reply to author
Forward
0 new messages