Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Retrieve endpoints of Association
icon5.gif  Retrieve endpoints of Association [message #898703] Fri, 27 July 2012 09:20 Go to next message
K C is currently offline K CFriend
Messages: 7
Registered: July 2012
Junior Member
Hi all,

I am using uml2 APIs and Ecore.

I need to retrieve the endpoints of the associations.

I have tried in many ways but I still don't succeed in it.

May you help me somehow?

I guess it is a quite simple question...

Thanks and regards.
Re: Retrieve endpoints of Association [message #898719 is a reply to message #898703] Fri, 27 July 2012 10:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Have you looked at Association.memberEnd ?

Regards

Ed Willink


On 27/07/2012 10:20, K C wrote:
> Hi all,
>
> I am using uml2 APIs and Ecore.
>
> I need to retrieve the endpoints of the associations.
>
> I have tried in many ways but I still don't succeed in it.
>
> May you help me somehow?
>
> I guess it is a quite simple question...
>
> Thanks and regards.
Re: Retrieve endpoints of Association [message #898729 is a reply to message #898719] Fri, 27 July 2012 11:36 Go to previous messageGo to next message
K C is currently offline K CFriend
Messages: 7
Registered: July 2012
Junior Member
Thanks for the reply!

Yes, I have already looked to memberEnd.

Here is a piece of my code:
for (Property p : association.getMemberEnds()){
---> I don't know how to continue...I tried to call the getValue method but I need the Stereotype object as first argument and I really don't know what I have to put in there...
}

Do you know if I have to use another method than the getValue to retrieve the value of a property?

Thanks.
Re: Retrieve endpoints of Association [message #898795 is a reply to message #898729] Fri, 27 July 2012 16:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You clearly need to explain real problem and your attempts much more
clearly.

I have no idea why getValue and Stereotype are part of this discussion.

Regards

Ed Willink



On 27/07/2012 12:36, K C wrote:
> Thanks for the reply!
>
> Yes, I have already looked to memberEnd.
>
> Here is a piece of my code:
> for (Property p : association.getMemberEnds()){
> ---> I don't know how to continue...I tried to call the getValue
> method but I need the Stereotype object as first argument and I really
> don't know what I have to put in there...
> }
>
> Do you know if I have to use another method than the getValue to
> retrieve the value of a property?
>
> Thanks.
Re: Retrieve endpoints of Association [message #899390 is a reply to message #898795] Tue, 31 July 2012 16:26 Go to previous messageGo to next message
K C is currently offline K CFriend
Messages: 7
Registered: July 2012
Junior Member
Hi, sorry for having not explained well myself Rolling Eyes .

Following you may find an example of what I have to do.

Consider two classes H and K linked with an association A.

I don't know a priori the end-points of the association so I thought to retrieve them from the Association object.
Is it possible to retrieve them in other ways? For example by means of Class objects (H and K here).

Consider using Association object A: as you said, I guess I have to retrieve the Properties inside Member End. These properties contain the 'names' of the unknown end-point classes (H and K).

My second question is: how can I retrieve the endpoints of an association having the Association object?

Thank you so much.

Regards.
Re: Retrieve endpoints of Association [message #899393 is a reply to message #899390] Tue, 31 July 2012 16:31 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I'm completely baffled by your question. It seems to amount to an
absolutely trivial how-do-I-navigate-a-model, for which I can only
sugggest some basic modeling tutorial then a UML tutorial.

Regards

Ed Willink


On 31/07/2012 17:26, K C wrote:
> Hi, sorry for having not explained well myself :roll: .
>
> Following you may find an example of what I have to do.
>
> Consider two classes H and K linked with an association A.
>
> I don't know a priori the end-points of the association so I thought
> to retrieve them from the Association object.
> Is it possible to retrieve them in other ways? For example by means of
> Class objects (H and K here).
>
> Consider using Association object A: as you said, I guess I have to
> retrieve the Properties inside Member End. These properties contain
> the 'names' of the unknown end-point classes (H and K).
>
> My second question is: how can I retrieve the endpoints of an
> association having the Association object?
>
> Thank you so much.
>
> Regards.
Re: Retrieve endpoints of Association [message #899396 is a reply to message #899393] Tue, 31 July 2012 16:38 Go to previous messageGo to next message
K C is currently offline K CFriend
Messages: 7
Registered: July 2012
Junior Member
Hi,

I already said that my question would have been trivial for people that usually work with UML2 APIs.

I have looked for tutorials but unfortunately I haven't find any explanation on how to retrieve the end-points of an Association.

This is why I wrote on this forum.

Since you told is a trivial question, may you explain me what I have to do?

Thanks.
Re: Retrieve endpoints of Association [message #899470 is a reply to message #899396] Wed, 01 August 2012 05:00 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

To access x you use getX().

Regards

Ed Willink

On 31/07/2012 17:38, K C wrote:
> Hi,
>
> I already said that my question would have been trivial for people
> that usually work with UML2 APIs.
>
> I have looked for tutorials but unfortunately I haven't find any
> explanation on how to retrieve the end-points of an Association.
>
> This is why I wrote on this forum.
>
> Since you told is a trivial question, may you explain me what I have
> to do?
>
> Thanks.
Re: Retrieve endpoints of Association [message #899493 is a reply to message #899470] Wed, 01 August 2012 07:44 Go to previous messageGo to next message
K C is currently offline K CFriend
Messages: 7
Registered: July 2012
Junior Member
Hi,

sorry but I really don't understand.

The getX() you are referring is the getMemberEnds() method of the Association?

Once I have the list of properties (return object of getMemberEnds) how can I retrieve the data inside a property?

My question is: how can I retrieve the endpoints of an association?

Please someone can reply to my simple question...

Thanks.
Re: Retrieve endpoints of Association [message #899498 is a reply to message #899493] Wed, 01 August 2012 08:12 Go to previous messageGo to next message
Mauro Faella is currently offline Mauro FaellaFriend
Messages: 31
Registered: June 2012
Member
Hi,
getMembers() method of Association should do what you want. ìIt returns an Elist of NamedElement.
Re: Retrieve endpoints of Association [message #899518 is a reply to message #899498] Wed, 01 August 2012 09:22 Go to previous messageGo to next message
K C is currently offline K CFriend
Messages: 7
Registered: July 2012
Junior Member
Hi Mauro,

thanks for the reply.

Following an example:

Class SecurityRisk linked to Class ProtectionTarget with Relation Threatens.

Using UML2 Eclipse Plugin I can see that the Member End property of Threatens object contains two properties:
- <Property> secrisk: SecurityRisk,
- <Property> protTarget : ProtectionTarget.

I want to retrieve the two strings (that are the class names) 'SecurityRisk' and 'ProtectionTarget'.

For now with the APIs I can just get the names of the properties i.e. 'secrisk' and 'protTarget'.

Thanks and regards.

[Updated on: Wed, 01 August 2012 09:23]

Report message to a moderator

Re: Retrieve endpoints of Association [message #899522 is a reply to message #899518] Wed, 01 August 2012 09:35 Go to previous messageGo to next message
Mauro Faella is currently offline Mauro FaellaFriend
Messages: 31
Registered: June 2012
Member
The strings that you want to retrieve are the Type of Property... (getType() on each members)
You can find this kind of information into the OMG UML documentation Wink
Re: Retrieve endpoints of Association [message #899525 is a reply to message #899522] Wed, 01 August 2012 09:48 Go to previous message
K C is currently offline K CFriend
Messages: 7
Registered: July 2012
Junior Member
Hi Mauro,
you have saved me!

Yes, using getType().getName() I succeeded in retrieving the names of the classes!

Yes, you are right, I have better to read the UML documentation but I have to find the time as I am doing lots of stuff at the same time... Sad

Thank you very much.
Previous Topic:GetParts compared to getOwnedAttributes
Next Topic:Cannot retrieve applied stereotypes of a UML element
Goto Forum:
  


Current Time: Fri Mar 29 05:51:29 GMT 2024

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

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

Back to the top