Question about the EMF implementation of the UML metamodel [message #1698688] |
Wed, 17 June 2015 05:36  |
Eclipse User |
|
|
|
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 ?
|
|
|
|
Re: Question about the EMF implementation of the UML metamodel [message #1699009 is a reply to message #1698688] |
Fri, 19 June 2015 08:42  |
Eclipse User |
|
|
|
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 ?
|
|
|
Powered by
FUDForum. Page generated in 0.24605 seconds