Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Temporarily add structural features to existent metamodel
Temporarily add structural features to existent metamodel [message #526285] Fri, 09 April 2010 13:42 Go to next message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hi NG,
I'm wondering if it is possible to add temporarily new structural
features to an existing metamodel. Consider the Ecore metamodel itself:
the feature eSuperTypes returns all super classes of a class. Imagine
that I want a feature eSubTypes to return all subclasses currently
existent in the workspace. That means I can't modify the metamodel
itself. Is it possible anyhow to specify the implementation of the
getter of such a new feature and a call to
someInstantiatedEClass.eGet(eSubTypes) returns the values computed by
the delivered implementation? I mean what Ed described here
http://ed-merks.blogspot.com/2008/01/creating-children-you-d idnt-know.html
goes a little bit in the same direction, isn't it? The original editor
knows EClasses of another metamodel. For my case I'm asking if it is
possible to just temporarily add some features to be accessible? The
features might be some kind of derived features, i.e. they aren't
editable or settable. Maybe I can create an extension of EReference for
example and integrate it? For my case those features needn't to be
serialized, just for querying some implicit information contained in a
model. How can I realize this? What do you think is the best and most
generic approach?

best regards,
Gilbert
Re: Temporarily add structural features to existent metamodel [message #526288 is a reply to message #526285] Fri, 09 April 2010 13:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Gilbert,

Comments below.

Gilbert Mirenque wrote:
> Hi NG,
> I'm wondering if it is possible to add temporarily new structural
> features to an existing metamodel.
No.
> Consider the Ecore metamodel itself:
> the feature eSuperTypes returns all super classes of a class. Imagine
> that I want a feature eSubTypes to return all subclasses currently
> existent in the workspace.
That sounds horrible.
> That means I can't modify the metamodel
> itself. Is it possible anyhow to specify the implementation of the
> getter of such a new feature and a call to
> someInstantiatedEClass.eGet(eSubTypes) returns the values computed by
> the delivered implementation?
No.
> I mean what Ed described here
> http://ed-merks.blogspot.com/2008/01/creating-children-you-d idnt-know.html
> goes a little bit in the same direction, isn't it?
No, that's about models that introduce new subclass contributing
extensions that are used when computing children.
> The original editor
> knows EClasses of another metamodel.
Not directly. The other models contribute extensions which are then
pulled in by the base editor.
> For my case I'm asking if it is
> possible to just temporarily add some features to be accessible? The
> features might be some kind of derived features, i.e. they aren't
> editable or settable. Maybe I can create an extension of EReference for
> example and integrate it? For my case those features needn't to be
> serialized, just for querying some implicit information contained in a
> model. How can I realize this? What do you think is the best and most
> generic approach?
>
You must do it as a separate model. The MoDisco folks are planning to
propose an EMF Facet project that does something kind of like what you
describe so you might ask about that on their newsgroup.
> best regards,
> Gilbert
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Temporarily add structural features to existent metamodel [message #526289 is a reply to message #526285] Fri, 09 April 2010 13:59 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,
I had quite the same requirement, although I need to persist the new
feature. I guess you are using static EMF? Do you require the new
feature to be a feature in terms of that it is known in the EObject?
Otherwise I would implement a helper or a warpper to add the new method.
In the other case it becomes more difficult. You can subclass the
extended element, but all factories will return the old EObject then.
Replacing the factory is not a good idea ;-)
Cheers
Jonas

Gilbert Mirenque wrote:
> Hi NG,
> I'm wondering if it is possible to add temporarily new structural
> features to an existing metamodel. Consider the Ecore metamodel itself:
> the feature eSuperTypes returns all super classes of a class. Imagine
> that I want a feature eSubTypes to return all subclasses currently
> existent in the workspace. That means I can't modify the metamodel
> itself. Is it possible anyhow to specify the implementation of the
> getter of such a new feature and a call to
> someInstantiatedEClass.eGet(eSubTypes) returns the values computed by
> the delivered implementation? I mean what Ed described here
> http://ed-merks.blogspot.com/2008/01/creating-children-you-d idnt-know.html
> goes a little bit in the same direction, isn't it? The original editor
> knows EClasses of another metamodel. For my case I'm asking if it is
> possible to just temporarily add some features to be accessible? The
> features might be some kind of derived features, i.e. they aren't
> editable or settable. Maybe I can create an extension of EReference for
> example and integrate it? For my case those features needn't to be
> serialized, just for querying some implicit information contained in a
> model. How can I realize this? What do you think is the best and most
> generic approach?
>
> best regards,
> Gilbert
Re: Temporarily add structural features to existent metamodel [message #529810 is a reply to message #526285] Tue, 27 April 2010 10:37 Go to previous messageGo to next message
Frederic Madiot is currently offline Frederic MadiotFriend
Messages: 26
Registered: July 2009
Junior Member
Eclipse User wrote on Fri, 09 April 2010 09:42
Originally posted by: formatzeh.gmx.de
For my case I'm asking if it is
possible to just temporarily add some features to be accessible? The
features might be some kind of derived features, i.e. they aren't
editable or settable.



Hi Gilbert,

The MoDisco project answers to your requirement with the Facet mechanism : http://wiki.eclipse.org/MoDisco/Components/FacetManager

We plan to contribute this mechanism in a new project named EMF Facet : http://www.eclipse.org/proposals/emf-facet/

Today a facet is derived from a model and can't be serialized or edited, but these capabilities will be added in a next version.

Before the creation of this project, feel free to ask support on the Modisco forum : http://www.eclipse.org/forums/index.php?t=thread&frm_id= 21

Regards,

Fred

Re: Temporarily add structural features to existent metamodel [message #530024 is a reply to message #529810] Wed, 28 April 2010 08:23 Go to previous message
Eclipse UserFriend
Originally posted by: formatzeh.gmx.de

Hi Fred,
yes I already read about EMF Facet and it's exactly that what I need. I
will have a look at it :)

best regards,
Gilbert

> The MoDisco project answers to your requirement with the Facet mechanism
> : http://wiki.eclipse.org/MoDisco/Components/FacetManager
>
> We plan to contribute this mechanism in a new project named EMF Facet :
> http://www.eclipse.org/proposals/emf-facet/
>
> Today a facet is derived from a model and can't be serialized or edited,
> but these capabilities will be added in a next version.
>
> Before the creation of this project, feel free to ask support on the
> Modisco forum : http://www.eclipse.org/forums/index.php?t=thread&frm_id= 21
>
> Regards,
>
> Fred
>
>
Previous Topic:saving objects
Next Topic:Instances of EMF generated model thread safe ?
Goto Forum:
  


Current Time: Fri Apr 26 13:08:20 GMT 2024

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

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

Back to the top