Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Question about the EMF implementation of the UML metamodel(Regarding the containments associations)
Question about the EMF implementation of the UML metamodel [message #1698688] Wed, 17 June 2015 09:36 Go to next message
Patrick Tournet is currently offline Patrick TournetFriend
Messages: 17
Registered: July 2009
Location: Aix-en-Provence, FRANCE
Junior Member
Hi,

While looking at the UML implementation using EMF I noticed something that I couldn't figure out by myself, so I'm hoping that someone will be able to explain the following :

In the 2.4.1 UML spec, there's a containment association between Element and itself (owner/ownedElement) and there's also one between Package and PackageableElement (owningPackage/packagedElement).
But in the EMF implementation, the first one is modeled as a derived bi-directionnal reference
    <eStructuralFeatures xsi:type="ecore:EReference" name="ownedElement" ordered="false"
        upperBound="-1" eType="#//Element" changeable="false" volatile="true" transient="true"
        derived="true" eOpposite="#//Element/owner">
      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
        <details key="documentation" value="The Elements owned by this Element.&#xA;&lt;p>From package UML::CommonStructure.&lt;/p>"/>
      </eAnnotations>
      <eAnnotations source="union"/>
    </eStructuralFeatures>
    <eStructuralFeatures xsi:type="ecore:EReference" name="owner" ordered="false"
        eType="#//Element" changeable="false" volatile="true" transient="true" derived="true"
        eOpposite="#//Element/ownedElement">
      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
        <details key="documentation" value="The Element that owns this Element.&#xA;&lt;p>From package UML::CommonStructure.&lt;/p>"/>
      </eAnnotations>
      <eAnnotations source="union"/>
    </eStructuralFeatures>

while the second one is modeled as a composition
    <eStructuralFeatures xsi:type="ecore:EReference" name="packagedElement" ordered="false"
        upperBound="-1" eType="#//PackageableElement" containment="true">
      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
        <details key="documentation" value="Specifies the packageable elements that are owned by this Package.&#xA;&lt;p>From package UML::Packages.&lt;/p>"/>
      </eAnnotations>
      <eAnnotations source="subsets" references="#//Namespace/ownedMember"/>
    </eStructuralFeatures>

So, I was wondering why the difference between those two... It seems to me that both are doing the same thing, but is there any particular reason to chose one approach over the other ? Or did I miss something ?


I can do anything and I can do it better than anyone. Be as I am : be the best ! Wink
Re: Question about the EMF implementation of the UML metamodel [message #1698694 is a reply to message #1698688] Wed, 17 June 2015 10:06 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 552
Registered: July 2009
Senior Member
My 2c :
owner/ownedElement is the UML equivalent of eContainer()/eContents() from ecore.
It can be used to navigate easily in the model, but this should be read-only.
It is deduced from the real containments (hence the derived and transient properties).
Re: Question about the EMF implementation of the UML metamodel [message #1699009 is a reply to message #1698688] Fri, 19 June 2015 12:42 Go to previous message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1162
Registered: July 2009
Location: Canada
Senior Member

Hi, Patrick,

There are two aspects of the owner/ownedElement association in UML that
aren't (well) supported by Ecore for containment references: it is
derived and it a superset of other associations. So, the UML
implementation had to be pragmatic about how to represent these
association ends in Ecore.

But, it shouldn't matter to most applications: the UML representation
of the UML metamodel, as provided by the org.eclipse.uml2.uml.resources
bundle, is correct in these details and should be referenced as
necessary by applications. The Ecore representation has nothing to do
with standard UML anyways; it's just an implementation detail.

HTH,

Christian


On 2015-06-17 09:36:42 +0000, Patrick TOURNET said:

> Hi,
>
> While looking at the UML implementation using EMF I noticed something
> that I couldn't figure out by myself, so I'm hoping that someone will
> be able to explain the following :
>
> In the 2.4.1 UML spec, there's a containment association between
> Element and itself (owner/ownedElement) and there's also one between
> Package and PackageableElement (owningPackage/packagedElement).
> But in the EMF implementation, the first one is modeled as a derived
> bi-directionnal reference
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="ownedElement" ordered="false"
> upperBound="-1" eType="#//Element" changeable="false"
> volatile="true" transient="true"
> derived="true" eOpposite="#//Element/owner">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="The Elements owned by this Element.
> <p>From package UML::CommonStructure.</p>"/>
> </eAnnotations>
> <eAnnotations source="union"/>
> </eStructuralFeatures>
> <eStructuralFeatures xsi:type="ecore:EReference" name="owner"
> ordered="false"
> eType="#//Element" changeable="false" volatile="true"
> transient="true" derived="true"
> eOpposite="#//Element/ownedElement">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="The Element that owns this Element.
> <p>From package UML::CommonStructure.</p>"/>
> </eAnnotations>
> <eAnnotations source="union"/>
> </eStructuralFeatures>
>
> while the second one is modeled as a composition
> <eStructuralFeatures xsi:type="ecore:EReference"
> name="packagedElement" ordered="false"
> upperBound="-1" eType="#//PackageableElement" containment="true">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="Specifies the packageable
> elements that are owned by this Package.
> <p>From package UML::Packages.</p>"/>
> </eAnnotations>
> <eAnnotations source="subsets" references="#//Namespace/ownedMember"/>
> </eStructuralFeatures>
>
> So, I was wondering why the difference between those two... It seems to
> me that both are doing the same thing, but is there any particular
> reason to chose one approach over the other ? Or did I miss something ?
Previous Topic:XMI serialization
Next Topic:Importing IFML metamodel and profile
Goto Forum:
  


Current Time: Wed Jan 17 18:28:23 GMT 2018

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

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