Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ecore model weaving ala aspectj
ecore model weaving ala aspectj [message #504613] Mon, 21 December 2009 18:58 Go to next message
Dameer Joog is currently offline Dameer JoogFriend
Messages: 17
Registered: July 2009
Junior Member
Hi all.

I am writing a converter that takes ecore models and converts them to "text" files.

i need to annotate the ecore model to help the converter. Is it possible to keep the annotations in a separate file and weave them like aspectj does with java files ?

My converter then works with the augmented ecore file to do the conversion. This will allow me to keep the model annotations separate from the original ecore file.
Re: ecore model weaving ala aspectj [message #504617 is a reply to message #504613] Mon, 21 December 2009 14:22 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1199
Registered: July 2009
Location: Canada
Senior Member

--=-laVDHLOSRnEC6jQM63rG
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Dameer,

That is a very similar purpose as the GenModel that is used by EMF for
generating code from Ecore models in the first place. Every GenXyz in
the genmodel is, essentially, an external annotation (we call it a
"decorator") for the corresponding EXyz element of the ECore model. The
Gen elements reference their Ecore elements without modifying the Ecore
source in any way.

I expect that the same approach would suit your case well.

HTH,

Christian


On Mon, 2009-12-21 at 13:58 -0500, Dameer Joog wrote:

> Hi all.
>
> I am writing a converter that takes ecore models and converts them to "text" files.
>
> i need to annotate the ecore model to help the converter. Is it possible to keep the annotations in a separate file and weave them like aspectj does with java files ?
>
> My converter then works with the augmented ecore file to do the conversion. This will allow me to keep the model annotations separate from the original ecore file.

--=-laVDHLOSRnEC6jQM63rG
Content-Type: text/html; charset="utf-8"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Dameer,<BR>
<BR>
That is a very similar purpose as the GenModel that is used by EMF for generating code from Ecore models in the first place.&nbsp; Every GenXyz&nbsp; in the genmodel is, essentially, an external annotation (we call it a &quot;decorator&quot;) for the corresponding EXyz element of the ECore model.&nbsp; The Gen elements reference their Ecore elements without modifying the Ecore source in any way.<BR>
<BR>
I expect that the same approach would suit your case well.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Mon, 2009-12-21 at 13:58 -0500, Dameer Joog wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi all.

I am writing a converter that takes ecore models and converts them to &quot;text&quot; files.

i need to annotate the ecore model to help the converter. Is it possible to keep the annotations in a separate file and weave them like aspectj does with java files ?

My converter then works with the augmented ecore file to do the conversion. This will allow me to keep the model annotations separate from the original ecore file.
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-laVDHLOSRnEC6jQM63rG--
Re: ecore model weaving ala aspectj [message #504639 is a reply to message #504617] Mon, 21 December 2009 20:58 Go to previous messageGo to next message
Dameer Joog is currently offline Dameer JoogFriend
Messages: 17
Registered: July 2009
Junior Member
Hi.

Is there a way to have the annotations apply only to certain elements like aspectj does ?

I have a big set of elements and writing the emf GenModel equivalent for each class will be tedious.

Re: ecore model weaving ala aspectj [message #504649 is a reply to message #504639] Mon, 21 December 2009 21:25 Go to previous message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1199
Registered: July 2009
Location: Canada
Senior Member

--=-lAU8csTYfIdHyf8sHzit
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Dameer,

You could create decorator elements in your annotation model for only
those ECore elements that actually need them. This would be somewhat
akin to how stereotype applications work in the MDT UML2 metamodel. You
can use EMF's efficient inverse-referencing adapter to easily determine,
for any given Ecore model element, whether it is extended by an element
in your annotation model.

If you need it to be more dynamic, for example having the annotation
relationship be one-to-many (an annotation decorating multiple Ecore
elements) with some expression determining which Ecore elements match an
annotation, then you can add operations to your decorator model that
find the related Ecore elements (possibly using OCL expressions embedded
in the model).

Cheers,

Christian


On Mon, 2009-12-21 at 15:58 -0500, Dameer Joog wrote:

> Hi.
>
> Is there a way to have the annotations apply only to certain elements like aspectj does ?
>
> I have a big set of elements and writing the emf GenModel equivalent for each class will be tedious.
>
>

--=-lAU8csTYfIdHyf8sHzit
Content-Type: text/html; charset="utf-8"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Dameer,<BR>
<BR>
You could create decorator elements in your annotation model for only those ECore elements that actually need them.&nbsp; This would be somewhat akin to how stereotype applications work in the MDT UML2 metamodel.&nbsp; You can use EMF's efficient inverse-referencing adapter to easily determine, for any given Ecore model element, whether it is extended by an element in your annotation model.<BR>
<BR>
If you need it to be more dynamic, for example having the annotation relationship be one-to-many (an annotation decorating multiple Ecore elements) with some expression determining which Ecore elements match an annotation, then you can add operations to your decorator model that find the related Ecore elements (possibly using OCL expressions embedded in the model).<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Mon, 2009-12-21 at 15:58 -0500, Dameer Joog wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi.

Is there a way to have the annotations apply only to certain elements like aspectj does ?

I have a big set of elements and writing the emf GenModel equivalent for each class will be tedious.


</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-lAU8csTYfIdHyf8sHzit--
Previous Topic:Re: [CDO] is it what I want ?
Next Topic:Detecting resource saves and loads
Goto Forum:
  


Current Time: Sat Nov 16 01:21:38 GMT 2019

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

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

Back to the top