Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Navigation through associations
Navigation through associations [message #477432] Sat, 24 May 2008 22:56 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

i have a problem concering the evaluation of navigable ends from an
association. In fact:

I have two classes A and B, where I can navigate through B but not in
opposite. With eclipse's uml diagram editor, i have modeled these
classes and add an Association between them. As MemberEnd the
Association got Class A and B, as NavigableOwnedEnd, the Association got
ONLY Class B.

Is this the correct way to model only a one way navigation from class A
to class B? And how to exactly query this?

When i try asso.getNavigableOwnedEnds() then i get the Property, but
there is no possibility to identify this property as an associaton for
class A. It could also be a Property in class B. I miss something like
ownedEnd.ownedBy()...

I'm a clear? Any help will be appreciated.

Thx
--tm
Re: Navigation through associations [message #477433 is a reply to message #477432] Sun, 25 May 2008 09:14 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hi timothy,

> I have two classes A and B, where I can navigate through B but not in
> opposite.

You mean you want to navigate from A to B but not from B to A?

>With eclipse's uml diagram editor, i have modeled these
> classes and add an Association between them. As MemberEnd the
> Association got Class A and B, as NavigableOwnedEnd, the Association got
> ONLY Class B.
>
> Is this the correct way to model only a one way navigation from class A
> to class B?

I guess the end that points to A doesn't appear in B?

It is ONE correct way, yes. The Binary case, two classes A,B and ends a,b.

In the simplest case, each end is owned by the Class at the other end.

b is owned by A
a is owned by B

If an end is owned by a class at the other end, it is navigable through that
class, so here both ends would be navigable:

But the ends may also be (independently) owned by the Association itself. In
this case, the end is only navigable if it appears in the "NavigableOwnedEnds"
list of the association.

So, an alternative to what the UML editor created would be to make the navigable
end b owned by A instead of the Association, and leave a as is.

> When i try asso.getNavigableOwnedEnds() then i get the Property, but
> there is no possibility to identify this property as an associaton for
> class A.

You do this by querying the Association itself, i.e. the memberEnds of the
Association tell you whats going on.

>It could also be a Property in class B.

No. The property is owned _by the association itself_

It is a little bit confusing. I think James once gave a good example: Suppose
you want to model some sort of a Map that maps A's to B's without modifying A.

You'd create an association between A and B and make both ends owned by that
Association, where the end that points to B appears in the "NavigableOwnedEnds"
list.

Hope I didn't confuse you too much.
Felix
Re: Navigation through associations [message #477434 is a reply to message #477433] Sun, 25 May 2008 19:13 Go to previous messageGo to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi Felix,

thanks for your rapid answer at first. This topic is not easy, i think.
How can I get the ownedEnd of an Association from inside a class? There
is no method like class.getOwnedEnds() or something else.

I understand the navigable mechanism (it is exactly so, as you have
mentioned id: A has an association, which leads one to B, but not in
opposite), but what is the difference between memberEnd and ownedEnd,
sharper, what does it mean, owened by the asociation itself?

So, if I am right, an Asso always exists at least of two memberEnds, but
this make no suggestion about the navigable directions? These are
specified with the navigable owenedEnds! Correct?

Another question concerning Associations: It is possible to connect an
Attribute with an Asscociation. What advantages does this kind of
Property modeling have?

Wow, this association's stuff is really confusing.

thx again :)

Felix Dorner schrieb:
> Hi timothy,
>
>> I have two classes A and B, where I can navigate through B but not in
>> opposite.
>
> You mean you want to navigate from A to B but not from B to A?
>
>> With eclipse's uml diagram editor, i have modeled these classes and
>> add an Association between them. As MemberEnd the Association got
>> Class A and B, as NavigableOwnedEnd, the Association got ONLY Class B.
>>
>> Is this the correct way to model only a one way navigation from class
>> A to class B?
>
> I guess the end that points to A doesn't appear in B?
>
> It is ONE correct way, yes. The Binary case, two classes A,B and ends a,b.
>
> In the simplest case, each end is owned by the Class at the other end.
>
> b is owned by A
> a is owned by B
>
> If an end is owned by a class at the other end, it is navigable through
> that class, so here both ends would be navigable:
>
> But the ends may also be (independently) owned by the Association
> itself. In this case, the end is only navigable if it appears in the
> "NavigableOwnedEnds" list of the association.
>
> So, an alternative to what the UML editor created would be to make the
> navigable end b owned by A instead of the Association, and leave a as is.
>
>> When i try asso.getNavigableOwnedEnds() then i get the Property, but
>> there is no possibility to identify this property as an associaton for
>> class A.
>
> You do this by querying the Association itself, i.e. the memberEnds of
> the Association tell you whats going on.
>
>> It could also be a Property in class B.
>
> No. The property is owned _by the association itself_
>
> It is a little bit confusing. I think James once gave a good example:
> Suppose you want to model some sort of a Map that maps A's to B's
> without modifying A.
>
> You'd create an association between A and B and make both ends owned by
> that Association, where the end that points to B appears in the
> "NavigableOwnedEnds" list.
>
> Hope I didn't confuse you too much.
> Felix
Re: Navigation through associations [message #477435 is a reply to message #477434] Sun, 25 May 2008 19:31 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Timothy Marc wrote:
> Hi Felix,
>
> thanks for your rapid answer at first. This topic is not easy, i think.
> How can I get the ownedEnd of an Association from inside a class? There
> is no method like class.getOwnedEnds() or something else.

If the end is owned by the Association, then the class simply doesn't "know"
that it participates in an Association. This is useful for the map example, or
if you simply do not want to change the class for whatever reason.

If the end is owned by a Class, then it is just a "Property" with its
Association attribute set to the Association it participates in:

class.getAttributes() gives the list of the attributes, you? d then need to
check for each Property in the list, if its "Association" field is set. Maybe
there's a faster way, but this is how i would do it.


> So, if I am right, an Asso always exists at least of two memberEnds, but
> this make no suggestion about the navigable directions?
Right.

These are
> specified with the navigable owenedEnds! Correct?

The memberEnds just say who participates in the association. There appear _all_
ends, be they owned by a Class that participates, or by the association itself.
The naviagbleOwned ends are a subset of the memberEnds and mark those ends that
are 1) owned by the Association and 2) should be navigable.

> Another question concerning Associations: It is possible to connect an
> Attribute with an Asscociation. What advantages does this kind of
> Property modeling have?

I think you would need an AssociationClass for this, which is both a Class and
an Association at a time.
Re: Navigation through associations [message #477436 is a reply to message #477435] Sun, 25 May 2008 20:37 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
>
> If the end is owned by the Association, then the class simply doesn't
> "know" that it participates in an Association. This is useful for the
> map example, or if you simply do not want to change the class for
> whatever reason.
>

At the meta-level, regardless who owns the association ends, it is
always possible to figure out all the associations a class (actually, a
Type) is part of by invoking:

associations = someClass.getAssociations();

Cheers,

Rafael
Re: Navigation through associations [message #477437 is a reply to message #477436] Sun, 25 May 2008 21:15 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
From the UML 2.1.1 Superstructure section 7.3.3:

"Navigability means instances participating in links at runtime
(instances of an association) can be accessed efficiently
from instances participating in links at the other ends of the
association. The precise mechanism by which such access is
achieved is implementation specific. If an end is not navigable, access
from the other ends may or may not be possible,
and if it is, it might not be efficient. Note that tools operating on
UML models are not prevented from navigating
associations from non-navigable ends."

Rafael Chaves wrote:
>>
>> If the end is owned by the Association, then the class simply doesn't
>> "know" that it participates in an Association. This is useful for the
>> map example, or if you simply do not want to change the class for
>> whatever reason.
>>
>
> At the meta-level, regardless who owns the association ends, it is
> always possible to figure out all the associations a class (actually, a
> Type) is part of by invoking:
>
> associations = someClass.getAssociations();
>
> Cheers,
>
> Rafael
Re: Navigation through associations [message #477438 is a reply to message #477432] Sun, 25 May 2008 21:32 Go to previous messageGo to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Timothy, there are two ways of modeling an association end as navigable.
From section 7.3.44:

"[3] The query isNavigable() indicates whether it is possible to
navigate across the property.

Property::isNavigable() : Boolean
isNavigable = not classifier->isEmpty() or
association.owningAssociation.navigableOwnedEnd->includes(self)

IOW, you can create a navigable end by either:

a) association.createNavigableOwnedEnd(name, null) or
b) class.getAttribute(name, null).setAssociation(association)

And you can easily find out if an end is navigable by invoking
property.isNavigable().

Cheers,

Rafael
http://textuml.net

Timothy Marc wrote:
> Hi all,
>
> i have a problem concering the evaluation of navigable ends from an
> association. In fact:
>
> I have two classes A and B, where I can navigate through B but not in
> opposite. With eclipse's uml diagram editor, i have modeled these
> classes and add an Association between them. As MemberEnd the
> Association got Class A and B, as NavigableOwnedEnd, the Association got
> ONLY Class B.
>
> Is this the correct way to model only a one way navigation from class A
> to class B? And how to exactly query this?
>
> When i try asso.getNavigableOwnedEnds() then i get the Property, but
> there is no possibility to identify this property as an associaton for
> class A. It could also be a Property in class B. I miss something like
> ownedEnd.ownedBy()...
>
> I'm a clear? Any help will be appreciated.
>
> Thx
> --tm
Re: Navigation through associations [message #477442 is a reply to message #477435] Mon, 26 May 2008 11:00 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Dear Felix and Rafael,

okay, i think a had a wrong idea what navigableOwnEnd wants to realize.
Navigable means, that it is possible to access the Classifier, that is
connected with the association and the starting point of this navigation is
the association itself.

When i want to figure out, that A has a navigable association to B (A->B)
this should be done with a Property in A called dst:B for example and then,
link this Property with an Association. Right?

Navigation from inside the association, in opposite, could only be realized
by the navigableOwnedEnds from the Association.

thx
--tm


"Felix Dorner" <felix_do@web.de> schrieb im Newsbeitrag
news:g1cequ$mc3$1@build.eclipse.org...
> Timothy Marc wrote:
>> Hi Felix,
>>
>> thanks for your rapid answer at first. This topic is not easy, i think.
>> How can I get the ownedEnd of an Association from inside a class? There
>> is no method like class.getOwnedEnds() or something else.
>
> If the end is owned by the Association, then the class simply doesn't
> "know" that it participates in an Association. This is useful for the map
> example, or if you simply do not want to change the class for whatever
> reason.
>
> If the end is owned by a Class, then it is just a "Property" with its
> Association attribute set to the Association it participates in:
>
> class.getAttributes() gives the list of the attributes, you? d then need
> to check for each Property in the list, if its "Association" field is set.
> Maybe there's a faster way, but this is how i would do it.
>
>
>> So, if I am right, an Asso always exists at least of two memberEnds, but
>> this make no suggestion about the navigable directions?
> Right.
>
> These are
>> specified with the navigable owenedEnds! Correct?
>
> The memberEnds just say who participates in the association. There appear
> _all_ ends, be they owned by a Class that participates, or by the
> association itself. The naviagbleOwned ends are a subset of the memberEnds
> and mark those ends that are 1) owned by the Association and 2) should be
> navigable.
>
>> Another question concerning Associations: It is possible to connect an
>> Attribute with an Asscociation. What advantages does this kind of
>> Property modeling have?
>
> I think you would need an AssociationClass for this, which is both a Class
> and an Association at a time.
>
>
>
Re: Navigation through associations [message #626615 is a reply to message #477432] Sun, 25 May 2008 09:14 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hi timothy,

> I have two classes A and B, where I can navigate through B but not in
> opposite.

You mean you want to navigate from A to B but not from B to A?

>With eclipse's uml diagram editor, i have modeled these
> classes and add an Association between them. As MemberEnd the
> Association got Class A and B, as NavigableOwnedEnd, the Association got
> ONLY Class B.
>
> Is this the correct way to model only a one way navigation from class A
> to class B?

I guess the end that points to A doesn't appear in B?

It is ONE correct way, yes. The Binary case, two classes A,B and ends a,b.

In the simplest case, each end is owned by the Class at the other end.

b is owned by A
a is owned by B

If an end is owned by a class at the other end, it is navigable through that
class, so here both ends would be navigable:

But the ends may also be (independently) owned by the Association itself. In
this case, the end is only navigable if it appears in the "NavigableOwnedEnds"
list of the association.

So, an alternative to what the UML editor created would be to make the navigable
end b owned by A instead of the Association, and leave a as is.

> When i try asso.getNavigableOwnedEnds() then i get the Property, but
> there is no possibility to identify this property as an associaton for
> class A.

You do this by querying the Association itself, i.e. the memberEnds of the
Association tell you whats going on.

>It could also be a Property in class B.

No. The property is owned _by the association itself_

It is a little bit confusing. I think James once gave a good example: Suppose
you want to model some sort of a Map that maps A's to B's without modifying A.

You'd create an association between A and B and make both ends owned by that
Association, where the end that points to B appears in the "NavigableOwnedEnds"
list.

Hope I didn't confuse you too much.
Felix
Re: Navigation through associations [message #626616 is a reply to message #477433] Sun, 25 May 2008 19:13 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi Felix,

thanks for your rapid answer at first. This topic is not easy, i think.
How can I get the ownedEnd of an Association from inside a class? There
is no method like class.getOwnedEnds() or something else.

I understand the navigable mechanism (it is exactly so, as you have
mentioned id: A has an association, which leads one to B, but not in
opposite), but what is the difference between memberEnd and ownedEnd,
sharper, what does it mean, owened by the asociation itself?

So, if I am right, an Asso always exists at least of two memberEnds, but
this make no suggestion about the navigable directions? These are
specified with the navigable owenedEnds! Correct?

Another question concerning Associations: It is possible to connect an
Attribute with an Asscociation. What advantages does this kind of
Property modeling have?

Wow, this association's stuff is really confusing.

thx again :)

Felix Dorner schrieb:
> Hi timothy,
>
>> I have two classes A and B, where I can navigate through B but not in
>> opposite.
>
> You mean you want to navigate from A to B but not from B to A?
>
>> With eclipse's uml diagram editor, i have modeled these classes and
>> add an Association between them. As MemberEnd the Association got
>> Class A and B, as NavigableOwnedEnd, the Association got ONLY Class B.
>>
>> Is this the correct way to model only a one way navigation from class
>> A to class B?
>
> I guess the end that points to A doesn't appear in B?
>
> It is ONE correct way, yes. The Binary case, two classes A,B and ends a,b.
>
> In the simplest case, each end is owned by the Class at the other end.
>
> b is owned by A
> a is owned by B
>
> If an end is owned by a class at the other end, it is navigable through
> that class, so here both ends would be navigable:
>
> But the ends may also be (independently) owned by the Association
> itself. In this case, the end is only navigable if it appears in the
> "NavigableOwnedEnds" list of the association.
>
> So, an alternative to what the UML editor created would be to make the
> navigable end b owned by A instead of the Association, and leave a as is.
>
>> When i try asso.getNavigableOwnedEnds() then i get the Property, but
>> there is no possibility to identify this property as an associaton for
>> class A.
>
> You do this by querying the Association itself, i.e. the memberEnds of
> the Association tell you whats going on.
>
>> It could also be a Property in class B.
>
> No. The property is owned _by the association itself_
>
> It is a little bit confusing. I think James once gave a good example:
> Suppose you want to model some sort of a Map that maps A's to B's
> without modifying A.
>
> You'd create an association between A and B and make both ends owned by
> that Association, where the end that points to B appears in the
> "NavigableOwnedEnds" list.
>
> Hope I didn't confuse you too much.
> Felix
Re: Navigation through associations [message #626617 is a reply to message #477434] Sun, 25 May 2008 19:31 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Timothy Marc wrote:
> Hi Felix,
>
> thanks for your rapid answer at first. This topic is not easy, i think.
> How can I get the ownedEnd of an Association from inside a class? There
> is no method like class.getOwnedEnds() or something else.

If the end is owned by the Association, then the class simply doesn't "know"
that it participates in an Association. This is useful for the map example, or
if you simply do not want to change the class for whatever reason.

If the end is owned by a Class, then it is just a "Property" with its
Association attribute set to the Association it participates in:

class.getAttributes() gives the list of the attributes, you? d then need to
check for each Property in the list, if its "Association" field is set. Maybe
there's a faster way, but this is how i would do it.


> So, if I am right, an Asso always exists at least of two memberEnds, but
> this make no suggestion about the navigable directions?
Right.

These are
> specified with the navigable owenedEnds! Correct?

The memberEnds just say who participates in the association. There appear _all_
ends, be they owned by a Class that participates, or by the association itself.
The naviagbleOwned ends are a subset of the memberEnds and mark those ends that
are 1) owned by the Association and 2) should be navigable.

> Another question concerning Associations: It is possible to connect an
> Attribute with an Asscociation. What advantages does this kind of
> Property modeling have?

I think you would need an AssociationClass for this, which is both a Class and
an Association at a time.
Re: Navigation through associations [message #626618 is a reply to message #477435] Sun, 25 May 2008 20:37 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
>
> If the end is owned by the Association, then the class simply doesn't
> "know" that it participates in an Association. This is useful for the
> map example, or if you simply do not want to change the class for
> whatever reason.
>

At the meta-level, regardless who owns the association ends, it is
always possible to figure out all the associations a class (actually, a
Type) is part of by invoking:

associations = someClass.getAssociations();

Cheers,

Rafael
Re: Navigation through associations [message #626619 is a reply to message #477436] Sun, 25 May 2008 21:15 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
From the UML 2.1.1 Superstructure section 7.3.3:

"Navigability means instances participating in links at runtime
(instances of an association) can be accessed efficiently
from instances participating in links at the other ends of the
association. The precise mechanism by which such access is
achieved is implementation specific. If an end is not navigable, access
from the other ends may or may not be possible,
and if it is, it might not be efficient. Note that tools operating on
UML models are not prevented from navigating
associations from non-navigable ends."

Rafael Chaves wrote:
>>
>> If the end is owned by the Association, then the class simply doesn't
>> "know" that it participates in an Association. This is useful for the
>> map example, or if you simply do not want to change the class for
>> whatever reason.
>>
>
> At the meta-level, regardless who owns the association ends, it is
> always possible to figure out all the associations a class (actually, a
> Type) is part of by invoking:
>
> associations = someClass.getAssociations();
>
> Cheers,
>
> Rafael
Re: Navigation through associations [message #626620 is a reply to message #477432] Sun, 25 May 2008 21:32 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
Timothy, there are two ways of modeling an association end as navigable.
From section 7.3.44:

"[3] The query isNavigable() indicates whether it is possible to
navigate across the property.

Property::isNavigable() : Boolean
isNavigable = not classifier->isEmpty() or
association.owningAssociation.navigableOwnedEnd->includes(self)

IOW, you can create a navigable end by either:

a) association.createNavigableOwnedEnd(name, null) or
b) class.getAttribute(name, null).setAssociation(association)

And you can easily find out if an end is navigable by invoking
property.isNavigable().

Cheers,

Rafael
http://textuml.net

Timothy Marc wrote:
> Hi all,
>
> i have a problem concering the evaluation of navigable ends from an
> association. In fact:
>
> I have two classes A and B, where I can navigate through B but not in
> opposite. With eclipse's uml diagram editor, i have modeled these
> classes and add an Association between them. As MemberEnd the
> Association got Class A and B, as NavigableOwnedEnd, the Association got
> ONLY Class B.
>
> Is this the correct way to model only a one way navigation from class A
> to class B? And how to exactly query this?
>
> When i try asso.getNavigableOwnedEnds() then i get the Property, but
> there is no possibility to identify this property as an associaton for
> class A. It could also be a Property in class B. I miss something like
> ownedEnd.ownedBy()...
>
> I'm a clear? Any help will be appreciated.
>
> Thx
> --tm
Re: Navigation through associations [message #626624 is a reply to message #477435] Mon, 26 May 2008 11:00 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Dear Felix and Rafael,

okay, i think a had a wrong idea what navigableOwnEnd wants to realize.
Navigable means, that it is possible to access the Classifier, that is
connected with the association and the starting point of this navigation is
the association itself.

When i want to figure out, that A has a navigable association to B (A->B)
this should be done with a Property in A called dst:B for example and then,
link this Property with an Association. Right?

Navigation from inside the association, in opposite, could only be realized
by the navigableOwnedEnds from the Association.

thx
--tm


"Felix Dorner" <felix_do@web.de> schrieb im Newsbeitrag
news:g1cequ$mc3$1@build.eclipse.org...
> Timothy Marc wrote:
>> Hi Felix,
>>
>> thanks for your rapid answer at first. This topic is not easy, i think.
>> How can I get the ownedEnd of an Association from inside a class? There
>> is no method like class.getOwnedEnds() or something else.
>
> If the end is owned by the Association, then the class simply doesn't
> "know" that it participates in an Association. This is useful for the map
> example, or if you simply do not want to change the class for whatever
> reason.
>
> If the end is owned by a Class, then it is just a "Property" with its
> Association attribute set to the Association it participates in:
>
> class.getAttributes() gives the list of the attributes, you? d then need
> to check for each Property in the list, if its "Association" field is set.
> Maybe there's a faster way, but this is how i would do it.
>
>
>> So, if I am right, an Asso always exists at least of two memberEnds, but
>> this make no suggestion about the navigable directions?
> Right.
>
> These are
>> specified with the navigable owenedEnds! Correct?
>
> The memberEnds just say who participates in the association. There appear
> _all_ ends, be they owned by a Class that participates, or by the
> association itself. The naviagbleOwned ends are a subset of the memberEnds
> and mark those ends that are 1) owned by the Association and 2) should be
> navigable.
>
>> Another question concerning Associations: It is possible to connect an
>> Attribute with an Asscociation. What advantages does this kind of
>> Property modeling have?
>
> I think you would need an AssociationClass for this, which is both a Class
> and an Association at a time.
>
>
>
Previous Topic:Navigation through associations
Next Topic:Re: Model Reader - Documentation issue.
Goto Forum:
  


Current Time: Sat Apr 20 02:16:35 GMT 2024

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

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

Back to the top