Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » About Extending Metamodels(About Extending Metamodels)
About Extending Metamodels [message #1726765] Wed, 16 March 2016 10:23 Go to next message
Eclipse UserFriend
Hello,

I have an existing metamodel. What I want to do is to extend/use this metamodel without touching it. Here are the actions that I want to conduct:

- Adding some attributes to the EClasses in the existing metamodel.
- Adding some new EClasses to the existing metamodel.

As far as I know, there are two possibilities to achieve this: First one is EMF Facet, the second one is EMF Profiling. Question 1: Are there any other alternatives? Question 2: What is the best alternative?

I am not sure which one is the best option. EMF Facet does it dynamically and you don't get a reusable ECore metamodel at the end. I don't know much about EMF profiling.

After this extension/use of the existing metamodel, I wish create instances of the new metamodel. Furthermore, I wish to use these instances in model transformations implemented in ETL. Question 3: Which alternative is supported best by Epsilon/ETL?

Thanks.
Re: About Extending Metamodels [message #1726766 is a reply to message #1726765] Wed, 16 March 2016 10:49 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

We don't have explicit support for any of these two technologies, as far as I know. We defer to the EPackage to pick up classes/attributes (whether registered or through an .ecore file), so as long as these technologies do their work properly and the EPackage reports those additions ETL should work correctly. Would that be the case?

Personally, I haven't used either technology: perhaps Dimitris may know more about them?
Re: About Extending Metamodels [message #1726902 is a reply to message #1726766] Thu, 17 March 2016 11:23 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Bugra,

The "official EMF way" would be to create a second metamodel which contains new EClasses that extend the classes provided by the original metamodel. The approach discussed in [1] may be also worth investigating.

Cheers,
Dimitris

[1] https://books.google.co.uk/books?id=_SmqCAAAQBAJ&pg=PA138&lpg=PA138#v=onepage&q&f=false
Re: About Extending Metamodels [message #1727087 is a reply to message #1726902] Fri, 18 March 2016 18:05 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your replies. I implemented the "official EMF way" as Dimitris suggested after I read the referenced paper and examined EMF Facet and EMF Profiling options. Now, I face another problem. My expectation was to instantiate the new metamodel (second metamodel or "extension" of the original metamodel) and be able to reach to the elements in the original metamodel. As an concrete example, I tried to create an instance of the new metamodel and show the root of the original metamodel as the root of this model. However, Eclipse does not see the model elements in the original metamodel when you try to instantiate the new metamodel.

This somehow suggests to create two models, one instance/model of each metamodel (the original metamodel and the extension metamodel), and connect them to each other. What I wanted to have is one model instance which covers both metamodels.

How should I proceed in this case?
Re: About Extending Metamodels [message #1727090 is a reply to message #1727087] Fri, 18 March 2016 19:04 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Have you checked that your run configuration mentions both metamodels?
Re: About Extending Metamodels [message #1727226 is a reply to message #1727090] Mon, 21 March 2016 12:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi Antonio,

Thanks for response. I don't quite understand what you meant by "run configuration". The procedure that I follow for creating an instance of a metamodel is the following:

1. I have created MetamodelA (Original/Core metamodel) and registered it.
2. I have created MetamodelA_Extension (A metamodel, which extends from and also refers to some metaclasses in MetamodelA) and registered it.
3. I tried to create an instance of MetamodelA_Extension: In Eclipse, I went through menu New->Other, then selected (Epsilon->)EMF Model. In the pop-up window, I chose the url of MetamodelA_Extension for "Metamodel URL" field. Once the url was chosen, you can pick up a metaclass as root for "Root instance type" in the pop-up window. Unfortunately, I could/can only see the metaclasses in MetamodelA_extension in "Root instance type" drop-down list and not any metaclasses from MetamodelA.

What I want is to choose the root element of MetamodelA as the root element of the instance of MetamodelA_Extension and have a single model that includes both MetmodelA and MetamodelA_extension elements.





Re: About Extending Metamodels [message #1727228 is a reply to message #1727226] Mon, 21 March 2016 12:42 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Bugra,

In the New EMF Model wizard, you should select the URI of the metamodel that contains the type of the root instance of your model. Then, once the model is open in Exeed, you can use the Exeed->Load EPackages menu to "load" the other metamodel.

Cheers,
Dimitris
Re: About Extending Metamodels [message #1727234 is a reply to message #1727228] Mon, 21 March 2016 13:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello Dimitris,

Thanks for the help. As you described, I have created an instance of MetamodelA and opened it with Exeed. After choosing Exeed->Load EPackages, I can see MetamodelA_Extension in the Exeed editor. However, I don't know how to create some instances of the metaclasses in MetamodelA_Extension in the Exceed editor directly attached to the instance of MetamodelA. Let me tell you what I tried:

- Since ChildMetaclassA_Extension (an EClass) in MetamodelA_Extension is a subclass of ParentMetaclassA in MetamodelA, I expected to create an instance of it using Exeed editor by right-clicking and choosing instance types in "New Child" or "New Sibling" menus in the appropriate place in the model. However, ChildMetaclassA_Extension does not exist in these menus.

- I right-clicked on ChildMetaclassA_Extension in MetamodelA_Extension in the Exeed editor and chose "Create Dynamic Instance". However, this option creates a new file with xmi extension instead including the new created instance in the original model.



Re: About Extending Metamodels [message #1727240 is a reply to message #1727234] Mon, 21 March 2016 13:59 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Bugra,

Could you please provide a minimal example [1] I can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: About Extending Metamodels [message #1728270 is a reply to message #1727240] Fri, 01 April 2016 13:21 Go to previous messageGo to next message
Eclipse UserFriend
Hello Dimitris,

I have attached a minimal example project. I hope the names are self explanatory. In any case, some description:

- There are two metamodels: MetamodelA and its extension MetamodelA_Extension.

- There is a metaclass MetaclassA in MetamodelA which has two children metaclasses Sub1 (in MetamodelA) and Sub2 (in MetamodelA_extension).

- I wish to create one model whose root is Root metaclass (in MetamodelA) and still able to include instances of Sub2 in the same model.

I want to mention a few points related to my metamodel creation process, as well (maybe it leads to this problem).

1. To refer to MetamodelA in MetamodelA_Extension, I right-click on the Exeed editor (NOT menu) and choose "Load Resources", then choose "Browse Registered Packages". The registered MetamodelA does not appear in "Development Time Version", but it appears in "Runtime version". When I choose it in the "Runtime version" list, a pop-up window says: "Information: Runtime packages are not displayed in the editor. Reason..." . But I still can't refer to elements in MetamodelA.

2. After the failure in Step 1, I generate Emfatic source from MetamodelA_Extension and manually add the import statement which imports MetamodelA. I have tried two ways. The first way is referring to local metamodel file,

import "platform:/resource/MinimalExampleProject1727226/modified_metamodel/MetamodelA.ecore";


The second way is to refer directly to URL

import "http://www.metamodelAproject.com/metamodelA";


Still no success. I really thank for your time and effort.

[Updated on: Fri, 01 April 2016 13:23] by Moderator

Report message to a moderator

Re: About Extending Metamodels [message #1728314 is a reply to message #1728270] Fri, 01 April 2016 21:01 Go to previous messageGo to next message
Eclipse UserFriend
Wow, my bad. I finally achieve to make it work. The problem is solved in the following way: If you click on the root element (EClass) and Exeed->Load EPackages, then it does not load the selected extension. You have to click on the model name (The one located at the top).

Now, I have another problem. If MetamodelA_Extension has an element that is not attached to the original metamodel, then I can't add it to the model. As an example project, I have updated the project again and put a metaclass called NonattachedMetaclass to the extension metamodel. This is independent from the elements (metaclasses) in both the original and extension metamodel. I want to create some instances of NonattachedMetaclass and add them to the root of the model.

[Updated on: Fri, 01 April 2016 21:43] by Moderator

Report message to a moderator

Re: About Extending Metamodels [message #1728619 is a reply to message #1728314] Tue, 05 April 2016 22:16 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Bugra,

Apologies for the slow response. Does this help?

https://www.youtube.com/watch?v=pr2aIkqV4c8

Cheers,
Dimitris
Re: About Extending Metamodels [message #1728656 is a reply to message #1728619] Wed, 06 April 2016 10:13 Go to previous message
Eclipse UserFriend
Thanks Dimitris Smile. It has solved my problem.
Previous Topic:EGL: How to access the Models list
Next Topic:How to export differences in ECL
Goto Forum:
  


Current Time: Fri Apr 19 08:18:01 GMT 2024

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

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

Back to the top