Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How to modify UML relationships?
How to modify UML relationships? [message #478601] Tue, 14 July 2009 15:31 Go to next message
Waqas is currently offline WaqasFriend
Messages: 32
Registered: July 2009
Member
Hi,

I want to extend the UML's PackageMerge metaclass. The PackageMerge forces
that the classes to be merged must have same name. I plan to relax this
restriction and merge any two classes that perform similar
responsibilities irrespective of the name of classes. Can someone guide me
how to relax this check in UML. I have created a UML stereotype that
extends the PackageMerge class but could not find a way to remove this
'same name' restriction.

A general guideline about extending UML relationships (to come up with new
relationships) will also be helpful to me.

Thanks
Waqas
Re: How to modify UML relationships? [message #478602 is a reply to message #478601] Tue, 14 July 2009 20:51 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Waqas,

What you're looking to do sounds more like a generalization than a
specialization or extension, i.e. you are trying to remove/relax a
constraint rather than add/strengthen one. As such, it may be more
appropriate to choose a different metaclass as the basis for your
stereotype.

Unfortunately, there's no automated way to make the package merge
implementation in UML2 adopt the altered semantics imposed by your
stereotype. If you want to reuse the existing behavior, I'd suggest
creating a specialization of the UMLUtil.PackageMerger utility class
that overrides the necessary methods to achieve the behavior you are
looking for (e.g. to inspect applied stereotypes and look for your
special stereotype and related tag values) and use it instead of the
default one to process your packages accordingly.

Kenn

Waqas wrote:
> Hi,
>
> I want to extend the UML's PackageMerge metaclass. The PackageMerge
> forces that the classes to be merged must have same name. I plan to
> relax this restriction and merge any two classes that perform similar
> responsibilities irrespective of the name of classes. Can someone guide
> me how to relax this check in UML. I have created a UML stereotype that
> extends the PackageMerge class but could not find a way to remove this
> 'same name' restriction.
>
> A general guideline about extending UML relationships (to come up with
> new relationships) will also be helpful to me.
>
> Thanks
> Waqas
>
>
>
Re: How to modify UML relationships? [message #478614 is a reply to message #478602] Fri, 17 July 2009 13:57 Go to previous messageGo to next message
Waqas is currently offline WaqasFriend
Messages: 32
Registered: July 2009
Member
Hi Kenn,

Few more questions:

To generalize the merge relationship in UML, do i need to first extend the
merge relationship (using stereotypes) and then generalize that
stereotype?

Can i directly generalize the merge relationship in UML and make it part
of the UML meta-model (heavy-weight extension).

My aim is to use the new merge relationship in different projects (just
like we can apply profile to any model).

Your suggestion to specialize the UMLUtil.PackageMerger class and use it
to inspect the applied stereotypes seems to be a lengthy work to this
simple problem. Shall i define this specialization in the profile where i
have created new stereotype as extension to merge relationship?

Thanks
Waqas
Re: How to modify UML relationships? [message #478621 is a reply to message #478614] Tue, 21 July 2009 15:31 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Waqas,

Some responses below ...

"Waqas " <waqaskamal@gmail.com> wrote in message
news:6e8cd812373cffd81c335954946b865a$1@www.eclipse.org...
> Hi Kenn,
>
> Few more questions:
>
> To generalize the merge relationship in UML, do i need to first extend the
> merge relationship (using stereotypes) and then generalize that
> stereotype?

If your goal is to modify or introduce behavior, you will not be able to
accomplish this with the profile/stereotype concept.
IE, generalizing a stereotype will still not let you modify behavior in the
extended meta class.

>
> Can i directly generalize the merge relationship in UML and make it part
> of the UML meta-model (heavy-weight extension).

Yes - you could do that but that seems like overkill for this type of
problem.

>
> My aim is to use the new merge relationship in different projects (just
> like we can apply profile to any model).
>
> Your suggestion to specialize the UMLUtil.PackageMerger class and use it
> to inspect the applied stereotypes seems to be a lengthy work to this
> simple problem. Shall i define this specialization in the profile where i
> have created new stereotype as extension to merge relationship?

I would agree with Kenn that simply specializing the package merger would be
the simplest/best approach.
You could introduce a keyword or stereotype to indicate the new relationship
and then have code to invoke the specialized package merger once you have
identified the new relationship.
Ultimately though, I think you will need to modify the merger util as
opposed to changing behavior from the core metaclass in UML.
>
> Thanks
> Waqas
>
Re: How to modify UML relationships? [message #627784 is a reply to message #478601] Tue, 14 July 2009 20:51 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Waqas,

What you're looking to do sounds more like a generalization than a
specialization or extension, i.e. you are trying to remove/relax a
constraint rather than add/strengthen one. As such, it may be more
appropriate to choose a different metaclass as the basis for your
stereotype.

Unfortunately, there's no automated way to make the package merge
implementation in UML2 adopt the altered semantics imposed by your
stereotype. If you want to reuse the existing behavior, I'd suggest
creating a specialization of the UMLUtil.PackageMerger utility class
that overrides the necessary methods to achieve the behavior you are
looking for (e.g. to inspect applied stereotypes and look for your
special stereotype and related tag values) and use it instead of the
default one to process your packages accordingly.

Kenn

Waqas wrote:
> Hi,
>
> I want to extend the UML's PackageMerge metaclass. The PackageMerge
> forces that the classes to be merged must have same name. I plan to
> relax this restriction and merge any two classes that perform similar
> responsibilities irrespective of the name of classes. Can someone guide
> me how to relax this check in UML. I have created a UML stereotype that
> extends the PackageMerge class but could not find a way to remove this
> 'same name' restriction.
>
> A general guideline about extending UML relationships (to come up with
> new relationships) will also be helpful to me.
>
> Thanks
> Waqas
>
>
>
Re: How to modify UML relationships? [message #627793 is a reply to message #478602] Fri, 17 July 2009 13:57 Go to previous message
Waqas is currently offline WaqasFriend
Messages: 32
Registered: July 2009
Member
Hi Kenn,

Few more questions:

To generalize the merge relationship in UML, do i need to first extend the
merge relationship (using stereotypes) and then generalize that
stereotype?

Can i directly generalize the merge relationship in UML and make it part
of the UML meta-model (heavy-weight extension).

My aim is to use the new merge relationship in different projects (just
like we can apply profile to any model).

Your suggestion to specialize the UMLUtil.PackageMerger class and use it
to inspect the applied stereotypes seems to be a lengthy work to this
simple problem. Shall i define this specialization in the profile where i
have created new stereotype as extension to merge relationship?

Thanks
Waqas
Re: How to modify UML relationships? [message #627800 is a reply to message #478614] Tue, 21 July 2009 15:31 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Waqas,

Some responses below ...

"Waqas " <waqaskamal@gmail.com> wrote in message
news:6e8cd812373cffd81c335954946b865a$1@www.eclipse.org...
> Hi Kenn,
>
> Few more questions:
>
> To generalize the merge relationship in UML, do i need to first extend the
> merge relationship (using stereotypes) and then generalize that
> stereotype?

If your goal is to modify or introduce behavior, you will not be able to
accomplish this with the profile/stereotype concept.
IE, generalizing a stereotype will still not let you modify behavior in the
extended meta class.

>
> Can i directly generalize the merge relationship in UML and make it part
> of the UML meta-model (heavy-weight extension).

Yes - you could do that but that seems like overkill for this type of
problem.

>
> My aim is to use the new merge relationship in different projects (just
> like we can apply profile to any model).
>
> Your suggestion to specialize the UMLUtil.PackageMerger class and use it
> to inspect the applied stereotypes seems to be a lengthy work to this
> simple problem. Shall i define this specialization in the profile where i
> have created new stereotype as extension to merge relationship?

I would agree with Kenn that simply specializing the package merger would be
the simplest/best approach.
You could introduce a keyword or stereotype to indicate the new relationship
and then have code to invoke the specialized package merger once you have
identified the new relationship.
Ultimately though, I think you will need to modify the merger util as
opposed to changing behavior from the core metaclass in UML.
>
> Thanks
> Waqas
>
Previous Topic:static profile definition?
Next Topic:Re: genmodel for state machine diagram
Goto Forum:
  


Current Time: Fri Apr 19 15:51:21 GMT 2024

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

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

Back to the top