Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » AssociationClass directions
AssociationClass directions [message #528205] Mon, 19 April 2010 12:53 Go to next message
Lisa  is currently offline Lisa
Messages: 6
Registered: April 2010
Junior Member
Hi everyone,
I've creater an AssociationClass using:

UMLFactory.eINSTANCE.createAssociationClass();

than I created two owned members as follows:

Property ownedEnd1 = associationClass.createOwnedEnd(null, class1_);
ownedEnd1.setLower(end1LowerBound);
ownedEnd1.setUpper(end1UpperBound);
ownedEnd1.setAggregation(end1AggregationKind);
ownedEnd1.setIsNavigable(true);
Property ownedEnd2 = associationClass.createOwnedEnd(null, class2_);
ownedEnd2.setLower(end2LowerBound);
ownedEnd2.setUpper(end2UpperBound);
ownedEnd2.setAggregation(end2AggregationKind);
ownedEnd2.setIsNavigable(true);

and both class1_ and class2_ are instance of org.eclipse.uml2.uml.Class

my question is how do I set the direction of the association that will be created between class1_ and class2

thanks,
Lisa
Re: AssociationClass directions [message #529602 is a reply to message #528205] Mon, 26 April 2010 10:00 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 768
Registered: July 2009
Senior Member
Hi, Lisa,

As with simple Associations, the "directionality" is implied by which
ends of the association-class are navigable. Your code snippet sets
both ends navigable. Let one of them not be navigable. e.g., if
ownedEnd1 is not navigable, then the "direction" is from class1_ to class2_.

Also as with associations, an end of an AssociationClass can be owned by
one of the classifiers that it associates (e.g., class1_ or class2_),
rather than the association-class itself. Such an end is implicitly
navigable.

HTH,

Christian


On 19/04/10 12:53 PM, Lisa wrote:
> Hi everyone,
> I've creater an AssociationClass using:
>
> UMLFactory.eINSTANCE.createAssociationClass();
>
> than I created two owned members as follows:
>
> Property ownedEnd1 = associationClass.createOwnedEnd(null, class1_);
> ownedEnd1.setLower(end1LowerBound);
> ownedEnd1.setUpper(end1UpperBound);
> ownedEnd1.setAggregation(end1AggregationKind);
> ownedEnd1.setIsNavigable(true);
> Property ownedEnd2 = associationClass.createOwnedEnd(null, class2_);
> ownedEnd2.setLower(end2LowerBound);
> ownedEnd2.setUpper(end2UpperBound);
> ownedEnd2.setAggregation(end2AggregationKind);
> ownedEnd2.setIsNavigable(true);
>
> and both class1_ and class2_ are instance of org.eclipse.uml2.uml.Class
>
> my question is how do I set the direction of the association that will
> be created between class1_ and class2
>
> thanks,
> Lisa
Re: AssociationClass directions [message #529626 is a reply to message #529602] Mon, 26 April 2010 11:05 Go to previous messageGo to next message
Lisa  is currently offline Lisa
Messages: 6
Registered: April 2010
Junior Member
Hi Christian,
thanks for your answer. in specify both ends navigable, I'd like to make a bidirectional association. If, for a normal association, I specify both ends as navigable, I obtain in the resulting diagram a connection with two arrows, indeed bidirectional. With association classes instead, no matter wg
which or how many ends are navigable, no arrow is produced in the resulting digram, it seems to me a bug of eclipse API.

Lisa
Re: AssociationClass directions [message #529640 is a reply to message #529626] Mon, 26 April 2010 11:30 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 768
Registered: July 2009
Senior Member
Hi, Lisa,

I would expect most tools to indicate a bi-navigable association without
any arrows (arrows usually being used only to indicate navigation in one
direction; however, it is up to the tool to decide or offer a user
preference).

If a diagram is not showing the association as bi-navigable using arrows
as it does for normal associations, then that isn't a problem in the
semantic model (MDT UML2 API) but a problem in your diagramming tool.
That's out of the scope of this newsgroup.

Cheers,

Christian


On 26/04/10 11:05 AM, Lisa wrote:
> Hi Christian,
> thanks for your answer. in specify both ends navigable, I'd like to make
> a bidirectional association. If, for a normal association, I specify
> both ends as navigable, I obtain in the resulting diagram a connection
> with two arrows, indeed bidirectional. With association classes instead,
> no matter wg
> which or how many ends are navigable, no arrow is produced in the
> resulting digram, it seems to me a bug of eclipse API.
>
> Lisa
Re: AssociationClass directions [message #530457 is a reply to message #529640] Thu, 29 April 2010 13:00 Go to previous messageGo to next message
Lisa  is currently offline Lisa
Messages: 6
Registered: April 2010
Junior Member
Hi Christian,
you are right, after your post I tryied to export in XMI a diagram with directional associations on associationClasses, it seems there is a difference in how my tool understands directions semantic and how eclipse uml2 APIs represent it.
I'll check if both XMI representation are correct regarding XMI standard.

Thanks for your help,
Lisa
Re: AssociationClass directions [message #628406 is a reply to message #529602] Mon, 26 April 2010 11:05 Go to previous messageGo to next message
Lisa  is currently offline Lisa
Messages: 6
Registered: April 2010
Junior Member
Hi Christian,
thanks for your answer. in specify both ends navigable, I'd like to make a bidirectional association. If, for a normal association, I specify both ends as navigable, I obtain in the resulting diagram a connection with two arrows, indeed bidirectional. With association classes instead, no matter wg
which or how many ends are navigable, no arrow is produced in the resulting digram, it seems to me a bug of eclipse API.

Lisa
Re: AssociationClass directions [message #628408 is a reply to message #628406] Mon, 26 April 2010 11:30 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 768
Registered: July 2009
Senior Member
Hi, Lisa,

I would expect most tools to indicate a bi-navigable association without
any arrows (arrows usually being used only to indicate navigation in one
direction; however, it is up to the tool to decide or offer a user
preference).

If a diagram is not showing the association as bi-navigable using arrows
as it does for normal associations, then that isn't a problem in the
semantic model (MDT UML2 API) but a problem in your diagramming tool.
That's out of the scope of this newsgroup.

Cheers,

Christian


On 26/04/10 11:05 AM, Lisa wrote:
> Hi Christian,
> thanks for your answer. in specify both ends navigable, I'd like to make
> a bidirectional association. If, for a normal association, I specify
> both ends as navigable, I obtain in the resulting diagram a connection
> with two arrows, indeed bidirectional. With association classes instead,
> no matter wg
> which or how many ends are navigable, no arrow is produced in the
> resulting digram, it seems to me a bug of eclipse API.
>
> Lisa
Re: AssociationClass directions [message #628422 is a reply to message #529640] Thu, 29 April 2010 13:00 Go to previous message
Lisa  is currently offline Lisa
Messages: 6
Registered: April 2010
Junior Member
Hi Christian,
you are right, after your post I tryied to export in XMI a diagram with directional associations on associationClasses, it seems there is a difference in how my tool understands directions semantic and how eclipse uml2 APIs represent it.
I'll check if both XMI representation are correct regarding XMI standard.

Thanks for your help,
Lisa
Previous Topic:create InterfaceRealization issue
Next Topic:[Announce] New co-lead of MDT-UML2
Goto Forum:
  


Current Time: Sat Aug 23 05:40:25 EDT 2014

Powered by FUDForum. Page generated in 0.12886 seconds