Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EMF Facet - adding additional Attributes
EMF Facet - adding additional Attributes [message #1233745] Mon, 20 January 2014 11:45 Go to next message
Marco Descher is currently offline Marco DescherFriend
Messages: 194
Registered: October 2010
Location: Austria
Senior Member
Hy, I'm just trying to get EMF Facets to know, as I am targetting towards a non-invasive method to extend the Eclipse application model. To this end, i tried
EMF in a small example project and keep having problems.

I already created a bug, that changes to .efacet are not correctly saved.

But the main problem I have is to understand, how I am now able to add additional attributes. I checked out the sample application, and all I see there, is that already existing attributes in the original model are used to create new virtual attributes.

So:


  • Is it really possible to introduce new attributes (e.g. of type Estring) to an existing item?
  • If yes, is it possible to serialize this attribute with the xmi the original model is persisted with? (On some presentation slides I saw this made the impression)


Thanks,
marco
Re: EMF Facet - adding additional Attributes [message #1233816 is a reply to message #1233745] Mon, 20 January 2014 15:01 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hello,

Yes, it is possible to add a new attribute to an existing element of your model.
The value of this attribute will be computed dynamically at runtime thanks to the model query attached to the corresponding element of the Facet definition (cf. the EFacet section from the EMF Facet reference documentation).

As relying on a dynamic model extension mechanism, applications of facets were initially not intended to be saved/serialized but rather recomputed at runtime when reopened (as the results of the query evaluation may change).

Kind regards,


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: EMF Facet - adding additional Attributes [message #1233819 is a reply to message #1233816] Mon, 20 January 2014 15:08 Go to previous message
Marco Descher is currently offline Marco DescherFriend
Messages: 194
Registered: October 2010
Location: Austria
Senior Member
Hy Hugo,

thank you for your answer. So it is not possible to add "real" and serialized attributes to an existing element, but only to dynamically compute them out of already existing attributes.

Ok, so EMF Facet is of very limited use to me then, as it does not really allow to extend an existing model and its elements by real attribute values. I did look at your presentations with EclipseCon and from the presentations it seemed to me that this is possible.

I was hoping for something like this - I have an element of a third-party model

<children xsi:type="advanced:Placeholder" xmi:id="_51y38FEAEeOs7KUvDVp0Mg" elementId="at.medevit.ecrit.pharmacy_at.application.placeholder.2" ref="_0mzDgFEAEeOs7KUvDVp0Mg"/>

and using EMF Facets i would be able to create a serialized version of this like

<children xsi:type="advanced:Placeholder" xmi:id="_51y38FEAEeOs7KUvDVp0Mg" elementId="at.medevit.ecrit.pharmacy_at.application.placeholder.2" ref="_0mzDgFEAEeOs7KUvDVp0Mg" eFacet:documentation="This is a facet added string"/>

which would blend into resource storage, without requiring a modification of the original model and not breaking it.


Previous Topic:EMF Client on Indigo
Next Topic:[org.eclipse.emf.codegen.ecore] Model code generation templates in Xtend?
Goto Forum:
  


Current Time: Tue Mar 19 04:06:37 GMT 2024

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

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

Back to the top