[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmt.amw] Re: Annotations in Ecore weaving metamodel

Hello,

1/

AMW needs the annotations to load the woven models correctly, and to set up the "sub-setting" of references. This enables to handle any kind of extensions to the core weaving metamodel.

Consider the following extension:

class Model extends WModel {

    -- @subsets wovenModel
    reference aModel container : WModelRef;
}

The annotation says 'aModel' reference subsets the 'wovenModel' reference from the core weaving metamodel. In the moment a weaving model is loaded or created, the tool uses this information to correctly set up the woven panels. And if you query over the 'wovenModel' reference, you can obtain all the references that subset it (ie, 'aModel').

The same is also valid when sub-setting the 'end' reference:

class Link extends WLink {

   -- @subsets end
   reference left container : WLinkEnd oppositeOf link;

   -- @subsets end
   reference right container : WLinkEnd oppositeOf link;
}

Without this annotation, we cannot say which are the extensions to the 'end' and 'wovenModel' references.

Another important annotation is 'welementRefType'. It indicates the type of 'WElementRef' that is created in the 'ownedElementRef' reference. This reference has a 'WElementRef' type in the core metamodel. This annotation enables referring to a concrete 'WElementRef'.

This annotation is also used to correctly load the ItemProvider with the implementation of some referencing method (e.g., XMI-IDs, XPointer, or a user-defined method).

-- @welementRefType ElementRef
class ModelRef extends WModelRef {
}

You can find more information on how to create weaving metamodels in the AMW FAQ:

http://wiki.eclipse.org/index.php/AMW_FAQ#How_to_create_weaving_metamodel_extensions.3F

2/
Yes, you need to have these annotations when you create an Ecore weaving metamodel. The plug-in automatically creates them when a KM3 extension is loaded. Then, you obtain the Ecore metamodel using the "Save WMM in Ecore format".



Regards,

Marcos.

Nathalie Lepine wrote:
Hello,

I created a weaving model with the extensions "mm_base_extension.km3". I exported it in ecore with "Save weaving metamodel in ecore format" in the weaver menu. The Ecore result contains annotations.

Does the AMW implemention use these annotations and why ?
Does it mean that if I create my own ecore weaving metamodel, I have also to use annotations ?


Thanks,

Nathalie Lépine.