Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] Reusable Annotations
[EMF] Reusable Annotations [message #1750445] Wed, 21 December 2016 07:27 Go to next message
Ioan Salau is currently offline Ioan SalauFriend
Messages: 69
Registered: July 2009
Location: Toronto

I have a model instance which is a result of MoDisco discoverer execution and I would like to insert manually more information into this model (i.e. Using EMF Editor). However, original model obtained from MoDisco might change as part of a fresh MoDisco discoverer execution and information manually inserted will be lost. Therefore, I am looking for a solution which allows me to avoid losing this manually added information, some sort of "reusable annotations". So far, I have considered following options:
1. Use a separate file to store a model with these reusable annotations and have the original model elements referenced from this separate model. This would be similar with .genmodel used by EMF itself.
2. Add annotation directly to model and export reusable annotations before a fresh MoDisco discoverer execution. Merge back reusable annotations after MoDisco discoverer execution.
3. Use ChangeModel to record changes to model and apply these changes to freshly generated model.

Any idea which option would be the best fit, eventually a new option?


Re: [EMF] Reusable Annotations [message #1750467 is a reply to message #1750445] Wed, 21 December 2016 10:55 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
For 1. If an annotated element is removed in the transfo, your decorator model will have a dangling href, so you'd need to watch out for this
For 2. It doesnt' sound like too complicated to hack this by hand, since the "manual" changes are clearly defined. If not, there is EMF/Diffmerge which can help with such things.
Re: [EMF] Reusable Annotations [message #1750471 is a reply to message #1750467] Wed, 21 December 2016 12:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31961
Registered: July 2009
Senior Member
I assume these are Ecore model instances and you're talking about EAnnotations, but that might be a bad assumption...

1. Certainly a decorator model is workable along with some convenient operations for lookup up the decorator instances. This might provide a more convenient API for representation the decorator/annotation information that as key-value pairs. But as you realize this is the most heavy weight approach.
2. You could avoid creating a model but rather implement import/export logic. The exporter might just visit EAnnotations and copy them all to a single resource and might use the EAnnotation.references to reference back to the EModelElement that contained the annotation. The importer could walk that resource and follow the reference back to the new version of the model (assuming the reference resolves), and copy the EAnnotation back. That seems pretty straight forward as well.
3. A Change model created by change recorder is not so different from a decorator model, but I'm not sure it will be so resilient to broken references.

Ed Merks
Professional Support:
Re: [EMF] Reusable Annotations [message #1750487 is a reply to message #1750471] Wed, 21 December 2016 15:47 Go to previous message
Ioan Salau is currently offline Ioan SalauFriend
Messages: 69
Registered: July 2009
Location: Toronto

Thanks Ed&Felix for your quick feedback. I am using KDM model instances (Knowledge Discovery Model from OMG ) which has Annotation and Tag class defined, but I guess your suggestions works as KDM and Annotations/Tags works similar with Ecore and EAnnotations. My target is to build a Software Production Line as a chain of transformations, the starting point being a set of EMF models obtained by MoDisco discoverers. In each phase, I want to inject extra information to address variability points ( mainly directives for transformations ) which will help transformations to incrementally get my model to final destination.
The initial plan is to use a simple mechanism to preserve these extra information but eventually I want to expand on this idea and create what I am calling now "reusable annotations":
A. store extra information (it can be Annotation or Tag) outside of main model, so when model is regenerated, extra information is not lost
B. merge back extra information after original model is regenerated (granted I MUST address dangling cross references)
C. add flexibility to reuse extra information for a specific EObject to a category of EObjects based on a Query instead of simple cross reference. I understand, this option is more complicated and it may end with an Aspect Oriented Modelling approach. In this case, href is basically replaced by a query and weave the two models using these queries to find model elements to apply Annotations/Tags.

The reason behind #C: if I add some Annotations/Tags to an element of type Service, I want to reuse the same set of Annotations/Tags for all Services based on specific criteria ( i.e. name of service ends with "DAO" for DataAccessObject pattern or Services which implements a certain Interface).
That's why I am inclined at the moment to go with option #2, export the extra information and later on expand this approach with C.

Previous Topic:[CDO] Connecting to multiple different repositories using CDOViewSet and CDOXATransaction
Next Topic:variable path src-gen
Goto Forum:

Current Time: Wed Aug 04 22:58:54 GMT 2021

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

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

Back to the top