Skip to main content



      Home
Home » Modeling » UML2 » A Questino about Composition
A Questino about Composition [message #478175] Fri, 06 February 2009 14:25 Go to next message
Eclipse UserFriend
I used RSA 7.5 to create a composition. Class University owns Class
Department.
I tried to use UML 2 API to get the composite end at Class University as
follows:

...
EList<Property> properties = cClass.getAllAttributes();
for(int k=0;k<properties.size();k++){
Property property = properties.get(k);

Association association = property.getOwningAssociation();
if(association!=null){
..........
}

Based on UML2, an association end is a Property. But when I use
getOwningAssociation() on one composite end, shouldn't I get the
corresponding composition? In reality, the association is null?
Also, I find the description of getOwningAssociation is simple?
Can someone give me some explanation here? THanks.
Wuwei
Re: A Questino about Composition [message #478207 is a reply to message #478175] Fri, 27 February 2009 14:37 Go to previous message
Eclipse UserFriend
Hi Wuwei,

I would expect University to have a property of type Department, something
like department::Department.
The aggregation type of department would be Composite.

So the association in your case does not directly own
department::Department, it is University that owns the property. Therefore,
the getOwningAssociation on the property department would return null -
which is what you are seeing I believe.

The spec sheds some insight on this in section 7.3.44 in the semantics
discussion:
When a property is owned by a classifier other than an association via
ownedAttribute, then it represents an attribute of the class or data type.
When related to an association via memberEnd or one of its specializations,
it represents an end of the association.


Cheers,
- James.

"Wuwei " <wws_ques@yahoo.com> wrote in message
news:1fd28190efcd340045eb8987b9a357d9$1@www.eclipse.org...
>I used RSA 7.5 to create a composition. Class University owns Class
>Department.
> I tried to use UML 2 API to get the composite end at Class University as
> follows:
>
> ..
> EList<Property> properties = cClass.getAllAttributes(); for(int
> k=0;k<properties.size();k++){
> Property property = properties.get(k);
>
> Association association = property.getOwningAssociation();
> if(association!=null){
> .........
> }
>
> Based on UML2, an association end is a Property. But when I use
> getOwningAssociation() on one composite end, shouldn't I get the
> corresponding composition? In reality, the association is null? Also, I
> find the description of getOwningAssociation is simple?
> Can someone give me some explanation here? THanks.
> Wuwei
>
Re: A Questino about Composition [message #627407 is a reply to message #478175] Fri, 27 February 2009 14:37 Go to previous message
Eclipse UserFriend
Hi Wuwei,

I would expect University to have a property of type Department, something
like department::Department.
The aggregation type of department would be Composite.

So the association in your case does not directly own
department::Department, it is University that owns the property. Therefore,
the getOwningAssociation on the property department would return null -
which is what you are seeing I believe.

The spec sheds some insight on this in section 7.3.44 in the semantics
discussion:
When a property is owned by a classifier other than an association via
ownedAttribute, then it represents an attribute of the class or data type.
When related to an association via memberEnd or one of its specializations,
it represents an end of the association.


Cheers,
- James.

"Wuwei " <wws_ques@yahoo.com> wrote in message
news:1fd28190efcd340045eb8987b9a357d9$1@www.eclipse.org...
>I used RSA 7.5 to create a composition. Class University owns Class
>Department.
> I tried to use UML 2 API to get the composite end at Class University as
> follows:
>
> ..
> EList<Property> properties = cClass.getAllAttributes(); for(int
> k=0;k<properties.size();k++){
> Property property = properties.get(k);
>
> Association association = property.getOwningAssociation();
> if(association!=null){
> .........
> }
>
> Based on UML2, an association end is a Property. But when I use
> getOwningAssociation() on one composite end, shouldn't I get the
> corresponding composition? In reality, the association is null? Also, I
> find the description of getOwningAssociation is simple?
> Can someone give me some explanation here? THanks.
> Wuwei
>
Previous Topic:uml.ecore and ecore.ecore
Next Topic:Subsetted/Redefined Property -> DanglingHREF
Goto Forum:
  


Current Time: Fri Jul 04 19:37:42 EDT 2025

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

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

Back to the top