Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Storing aggregation property in .uml file
Storing aggregation property in .uml file [message #522770] Tue, 23 March 2010 21:15 Go to next message
Jordi Cabot is currently offline Jordi CabotFriend
Messages: 7
Registered: March 2010
Junior Member
Hi all,

I was looking at the xml model representation stored in the .uml file for a simple class diagram containing two classes ("whole" and "part") linked by a composite relationship IsPartOf (diamond next to the "whole" side, a "whole" can contain between 3 and "*" parts).

Everything seemed normal until I realized that the "whole" association end had the right name, type and cardinality but no information about the composition. Surprisingly (to me) the information describing that the association is a composition was stored in the opposite association end (the "part" end). See the XML excerpt below.

This does not seem right to me (and in fact, different from the XML/XMI generated by other modeling tools). So, I'd like to know if you think this is correct, and if so why this is done this way. What am I missing?

<packagedElement xmi:type="uml:Class" xmi:id="_OUqi0DYVEd-QwOAQi-R_Aw" name="Whole"/>
<packagedElement xmi:type="uml:Class" xmi:id="_RiS8cDYVEd-QwOAQi-R_Aw" name="Part"/>
<packagedElement xmi:type="uml:Association" xmi:id="_Ue860DYVEd-QwOAQi-R_Aw" name="IsPartOf" memberEnd="_Ue860TYVEd-QwOAQi-R_Aw _Ue861DYVEd-QwOAQi-R_Aw">
<ownedEnd xmi:id="_Ue860TYVEd-QwOAQi-R_Aw" name="whole" type="_OUqi0DYVEd-QwOAQi-R_Aw" association="_Ue860DYVEd-QwOAQi-R_Aw">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Ue860zYVEd-QwOAQi-R_Aw" value="1"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Ue860jYVEd-QwOAQi-R_Aw" value="1"/>
</ownedEnd>
<ownedEnd xmi:id="_Ue861DYVEd-QwOAQi-R_Aw" name="part" type="_RiS8cDYVEd-QwOAQi-R_Aw" aggregation="composite" association="_Ue860DYVEd-QwOAQi-R_Aw">
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Ue861jYVEd-QwOAQi-R_Aw" value="*"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Ue861TYVEd-QwOAQi-R_Aw" value="3"/>
</ownedEnd>
</packagedElement>
Re: Storing aggregation property in .uml file [message #522784 is a reply to message #522770] Tue, 23 March 2010 22:15 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Jordi,

In UML2, the aggregation semantics is an attribute of the Property "of"
the the aggregating type. I say "of" in quotation marks because often
the composite end will actually be an owned attribute of the composing
classifier.

That is to say, in terms of your scenario, the 'Whole' class "has" an
association-end 'part' that provides the Parts that a Whole composes.
It is also common that the association will not own the 'part' end, but
the Whole class will own it. But, that is not necessary.

The point is, that the relationship of a Whole to a Part is
characterized as a composite aggregation, so in the UML2 that is
expressed as an attribute of the 'part' association end that navigates
from the Whole to the Part.

HTH,

Christian


On 23/03/10 05:15 PM, Jordi Cabot wrote:
> Hi all,
>
> I was looking at the xml model representation stored in the .uml file
> for a simple class diagram containing two classes ("whole" and "part")
> linked by a composite relationship IsPartOf (diamond next to the "whole"
> side, a "whole" can contain between 3 and "*" parts).
> Everything seemed normal until I realized that the "whole" association
> end had the right name, type and cardinality but no information about
> the composition. Surprisingly (to me) the information describing that
> the association is a composition was stored in the opposite association
> end (the "part" end). See the XML excerpt below.
>
> This does not seem right to me (and in fact, different from the XML/XMI
> generated by other modeling tools). So, I'd like to know if you think
> this is correct, and if so why this is done this way. What am I missing?
> <packagedElement xmi:type="uml:Class" xmi:id="_OUqi0DYVEd-QwOAQi-R_Aw"
> name="Whole"/>
> <packagedElement xmi:type="uml:Class" xmi:id="_RiS8cDYVEd-QwOAQi-R_Aw"
> name="Part"/>
> <packagedElement xmi:type="uml:Association"
> xmi:id="_Ue860DYVEd-QwOAQi-R_Aw" name="IsPartOf"
> memberEnd="_Ue860TYVEd-QwOAQi-R_Aw _Ue861DYVEd-QwOAQi-R_Aw">
> <ownedEnd xmi:id="_Ue860TYVEd-QwOAQi-R_Aw" name="whole"
> type="_OUqi0DYVEd-QwOAQi-R_Aw" association="_Ue860DYVEd-QwOAQi-R_Aw">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_Ue860zYVEd-QwOAQi-R_Aw" value="1"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_Ue860jYVEd-QwOAQi-R_Aw" value="1"/>
> </ownedEnd>
> <ownedEnd xmi:id="_Ue861DYVEd-QwOAQi-R_Aw" name="part"
> type="_RiS8cDYVEd-QwOAQi-R_Aw" aggregation="composite"
> association="_Ue860DYVEd-QwOAQi-R_Aw">
> <upperValue xmi:type="uml:LiteralUnlimitedNatural"
> xmi:id="_Ue861jYVEd-QwOAQi-R_Aw" value="*"/>
> <lowerValue xmi:type="uml:LiteralInteger"
> xmi:id="_Ue861TYVEd-QwOAQi-R_Aw" value="3"/>
> </ownedEnd>
> </packagedElement>
Re: Storing aggregation property in .uml file [message #522788 is a reply to message #522784] Tue, 23 March 2010 22:28 Go to previous messageGo to next message
Jordi Cabot is currently offline Jordi CabotFriend
Messages: 7
Registered: March 2010
Junior Member
Hi Christian,

Thanks for your quick answer. I'm afraid I'm still not convinced. I think it is counterintuitive that all the properties that a user sees graphically depicted next to an association end (like cardinality and name of the association end) are stored in the XMI section corresponding to that end except one, the aggregation property that it is stored in the opposite end.

However, the last thing I want is to start a discussion about UML semantics here (and I'm not even sure that the decision on where to add the "aggregation" attribute in the .uml file has to do with the semantics). My goals is to parse .uml files so I just wanted to confirm that this was the selected representation for aggregation/compositions in the .uml file and not a mysterious error in my model.

From your answer I take that this is the desired behaviour so thanks again for clarifying this point. I'll just follow this structure in my program.
Re: Storing aggregation property in .uml file [message #522789 is a reply to message #522784] Tue, 23 March 2010 22:17 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

I should mention, additionally, that the XMI you showed is in exact
concordance with the in-memory representation, and thus what you would
see using the Eclipse UML2 API to inspect the model.

This is all in agreement with the UML 2.x metamodel.

Cheers,

Christian


On 23/03/10 06:15 PM, Christian W. Damus wrote:
> Hi, Jordi,
>
> In UML2, the aggregation semantics is an attribute of the Property "of"
> the the aggregating type. I say "of" in quotation marks because often
> the composite end will actually be an owned attribute of the composing
> classifier.
>
> That is to say, in terms of your scenario, the 'Whole' class "has" an
> association-end 'part' that provides the Parts that a Whole composes. It
> is also common that the association will not own the 'part' end, but the
> Whole class will own it. But, that is not necessary.
>
> The point is, that the relationship of a Whole to a Part is
> characterized as a composite aggregation, so in the UML2 that is
> expressed as an attribute of the 'part' association end that navigates
> from the Whole to the Part.
>
> HTH,
>
> Christian


--------8<--------
Re: Storing aggregation property in .uml file [message #522947 is a reply to message #522788] Wed, 24 March 2010 15:31 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Jordi

I can confirm that what Christian mentioned is indeed correct ( and very
beautifully put also ).
You may want to convince yourself by looking at chapter 7 in the
Superstructure spec. (section 7.3.2 ).

Cheers,
- James.

"Jordi Cabot" <jordi.cabot@inria.fr> wrote in message
news:hobf9p$b1$1@build.eclipse.org...
> Hi Christian,
>
> Thanks for your quick answer. I'm afraid I'm still not convinced. I think
> it is counterintuitive that all the properties that a user sees
> graphically depicted next to an association end (like cardinality and name
> of the association end) are stored in the XMI section corresponding to
> that end except one, the aggregation property that it is stored in the
> opposite end.
>
> However, the last thing I want is to start a discussion about UML
> semantics here (and I'm not even sure that the decision on where to add
> the "aggregation" attribute in the .uml file has to do with the
> semantics). My goals is to parse .uml files so I just wanted to confirm
> that this was the selected representation for aggregation/compositions in
> the .uml file and not a mysterious error in my model.
>
> From your answer I take that this is the desired behaviour so thanks again
> for clarifying this point. I'll just follow this structure in my program.
Re: Storing aggregation property in .uml file [message #628337 is a reply to message #522784] Tue, 23 March 2010 22:17 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

I should mention, additionally, that the XMI you showed is in exact
concordance with the in-memory representation, and thus what you would
see using the Eclipse UML2 API to inspect the model.

This is all in agreement with the UML 2.x metamodel.

Cheers,

Christian


On 23/03/10 06:15 PM, Christian W. Damus wrote:
> Hi, Jordi,
>
> In UML2, the aggregation semantics is an attribute of the Property "of"
> the the aggregating type. I say "of" in quotation marks because often
> the composite end will actually be an owned attribute of the composing
> classifier.
>
> That is to say, in terms of your scenario, the 'Whole' class "has" an
> association-end 'part' that provides the Parts that a Whole composes. It
> is also common that the association will not own the 'part' end, but the
> Whole class will own it. But, that is not necessary.
>
> The point is, that the relationship of a Whole to a Part is
> characterized as a composite aggregation, so in the UML2 that is
> expressed as an attribute of the 'part' association end that navigates
> from the Whole to the Part.
>
> HTH,
>
> Christian


--------8<--------
Re: Storing aggregation property in .uml file [message #628338 is a reply to message #522784] Tue, 23 March 2010 22:28 Go to previous message
Jordi Cabot is currently offline Jordi CabotFriend
Messages: 7
Registered: March 2010
Junior Member
Hi Christian,

Thanks for your quick answer. I'm afraid I'm still not convinced. I think it is counterintuitive that all the properties that a user sees graphically depicted next to an association end (like cardinality and name of the association end) are stored in the XMI section corresponding to that end except one, the aggregation property that it is stored in the opposite end.

However, the last thing I want is to start a discussion about UML semantics here (and I'm not even sure that the decision on where to add the "aggregation" attribute in the .uml file has to do with the semantics). My goals is to parse .uml files so I just wanted to confirm that this was the selected representation for aggregation/compositions in the .uml file and not a mysterious error in my model.

From your answer I take that this is the desired behaviour so thanks again for clarifying this point. I'll just follow this structure in my program.
Re: Storing aggregation property in .uml file [message #628342 is a reply to message #628338] Wed, 24 March 2010 15:31 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Jordi

I can confirm that what Christian mentioned is indeed correct ( and very
beautifully put also ).
You may want to convince yourself by looking at chapter 7 in the
Superstructure spec. (section 7.3.2 ).

Cheers,
- James.

"Jordi Cabot" <jordi.cabot@inria.fr> wrote in message
news:hobf9p$b1$1@build.eclipse.org...
> Hi Christian,
>
> Thanks for your quick answer. I'm afraid I'm still not convinced. I think
> it is counterintuitive that all the properties that a user sees
> graphically depicted next to an association end (like cardinality and name
> of the association end) are stored in the XMI section corresponding to
> that end except one, the aggregation property that it is stored in the
> opposite end.
>
> However, the last thing I want is to start a discussion about UML
> semantics here (and I'm not even sure that the decision on where to add
> the "aggregation" attribute in the .uml file has to do with the
> semantics). My goals is to parse .uml files so I just wanted to confirm
> that this was the selected representation for aggregation/compositions in
> the .uml file and not a mysterious error in my model.
>
> From your answer I take that this is the desired behaviour so thanks again
> for clarifying this point. I'll just follow this structure in my program.
Previous Topic:How to specialize the aggregation for code-generation
Next Topic:Problems with generated createSubsetsAnnotations
Goto Forum:
  


Current Time: Tue Apr 23 12:43:03 GMT 2024

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

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

Back to the top