Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » Generalization Set in the profile level(Using a Generalization Set of Stereotypes)
Generalization Set in the profile level [message #489107] Thu, 01 October 2009 14:16 Go to next message
Bob Missing name is currently offline Bob Missing nameFriend
Messages: 12
Registered: October 2009
Junior Member
Hello,

I'm currently making a UML profile and I just tested some stereotypes on the UML metaclass Class. I just applied a few stereotypes on a class diagram and they're working fine. But, here comes the question:

The thing is that I can apply multiple stereotypes on the same class at the same time. For example, in a class diagram, I can apply both the stereotype <<Kind>> and <<Role>> to a class Person simultaneously, which is undesirable.

My idea to avoid this is by making a generalization set on the profile level that is {disjoint, complete}. In this example, let's say I have a stereotype <<Object>> that extends the UML metaclass Class, then I would like to make a generalization set with <<Kind>> and <<Role>> having as the general part <<Object>>. By doing this, I wouldn't be able to apply both <<Kind>> and <<Role>> in the class Person simultaneously.

So, is this feature (creating a generalization set in the profile level) available?

I'm not really familiar with the tools yet, but what I do in a Class Diagram level (*.umlclass file) to create a Generalization Set is:
1- I make one generalizaton, say B->A.
2- I make another generalization, the first target is the class C and the other target is the B->A generalization. That way, the graphical editor creates a generalization set with B->A and C->A.

I tried to do this in the profile level (*.umlprofile file) but it wasn't possible.

Thanks.
Re: Generalization Set in the profile level [message #491806 is a reply to message #489107] Thu, 15 October 2009 22:23 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 62
Registered: July 2009
Member
Hi Bob,

It's not possibe to filter applicable stereotypes in such way. However, you can:

1) Filter available stereotypes in Apply Stereotype action. In order to do this customize ApplicableStereotypesItemProvider class.

2) Or create an OCL constraint for Stereotype and then validate diagram as described in bug 260741. The problem here is that I don't know how to describe OCL constraint for this case and I am not sure if it is possible at all.

Best wishes,
Tanya.
Re: Generalization Set in the profile level [message #493568 is a reply to message #491806] Tue, 27 October 2009 00:03 Go to previous messageGo to next message
Bob Missing name is currently offline Bob Missing nameFriend
Messages: 12
Registered: October 2009
Junior Member
Well, thanks for the answer. But, do you have any examples of OCL in the profile definition level? Because I tried something basic for testing purposes, for example:

On the graphic editor, I chose "OCL Constraint" in the palette, added a text to its body and after that attached the constraint to a stereotype via Constrained Element, also picked in the palette.

The text was "context subQuantityOf inv: self.isEssential = true" and the Constraint was attached to a class named subQuantityOf. One of its super metaclasses (super stereotypes) has the attribute isEssential : Boolean.

After re-defining the profile, I got no effect in the diagrams that use it and when I apply a subQuantityOf stereotype, the attribute isEssential is set to false.
Re: Generalization Set in the profile level [message #494727 is a reply to message #493568] Mon, 02 November 2009 11:55 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 62
Registered: July 2009
Member
Hi Bob,

Stereotype constrains are created for declaration purposes. It is intended to warn the user rather than prohibit anything. When you run 'Validate' action on your Class diagram you'll see a warning message.

For your case I suggest to use default value as described here -- create Boolean Literal with value==true for your stereotype property. Now it is possible to create Default values for stereotypes in UML Editor only. For UML2 Tools diagram editors there is the bug 293914 .

Best wishes,
Tanya.
Re: Generalization Set in the profile level [message #498279 is a reply to message #494727] Mon, 16 November 2009 10:22 Go to previous messageGo to next message
Bob Missing name is currently offline Bob Missing nameFriend
Messages: 12
Registered: October 2009
Junior Member
Actually, the focus of my last question was on OCL Constraints in the profile level, the default value thing was just an example I gave (and by the way is not working, but I can ask that question later).

Can you give me any short example, that I define some OCL constraint in a stereotype, (re)define the profile, make a class diagram, validate it and the editor shows me a warning related to the OCL Constraint I created in the profile level? I would be very satisfied to see a running example of OCL constraints working.

Thanks.
Re: Generalization Set in the profile level [message #624907 is a reply to message #489107] Thu, 15 October 2009 22:23 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 62
Registered: July 2009
Member
Hi Bob,

It's not possibe to filter applicable stereotypes in such way. However, you can:

1) Filter available stereotypes in Apply Stereotype action. In order to do this customize ApplicableStereotypesItemProvider class.

2) Or create an OCL constraint for Stereotype and then validate diagram as described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=260741 The problem here is that I don't know how to describe OCL constraint for this case and I am not sure if it is possible at all.

Best wishes,
Tanya.
Re: Generalization Set in the profile level [message #625113 is a reply to message #624907] Tue, 27 October 2009 00:03 Go to previous messageGo to next message
Bob Missing name is currently offline Bob Missing nameFriend
Messages: 12
Registered: October 2009
Junior Member
Well, thanks for the answer. But, do you have any examples of OCL in the profile definition level? Because I tried something basic for testing purposes, for example:

On the graphic editor, I chose "OCL Constraint" in the palette, added a text to its body and after that attached the constraint to a stereotype via Constrained Element, also picked in the palette.

The text was "context subQuantityOf inv: self.isEssential = true" and the Constraint was attached to a class named subQuantityOf. One of its super metaclasses (super stereotypes) has the attribute isEssential : Boolean.

After re-defining the profile, I got no effect in the diagrams that use it and when I apply a subQuantityOf stereotype, the attribute isEssential is set to false.
Re: Generalization Set in the profile level [message #625127 is a reply to message #625113] Mon, 02 November 2009 11:55 Go to previous messageGo to next message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 62
Registered: July 2009
Member
Hi Bob,

Stereotype constrains are created for declaration purposes. It is intended to warn the user rather than prohibit anything. When you run 'Validate' action on your Class diagram you'll see a warning message.

For your case I suggest to use default value as described http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Intro duction_to_UML2_Profiles/article.html# -- create Boolean Literal with value==true for your stereotype property. Now it is possible to create Default values for stereotypes in UML Editor only. For UML2 Tools diagram editors there is the https://bugs.eclipse.org/bugs/show_bug.cgi?id=293914 .

Best wishes,
Tanya.
Re: Generalization Set in the profile level [message #625313 is a reply to message #625127] Mon, 16 November 2009 10:22 Go to previous message
Bob Missing name is currently offline Bob Missing nameFriend
Messages: 12
Registered: October 2009
Junior Member
Actually, the focus of my last question was on OCL Constraints in the profile level, the default value thing was just an example I gave (and by the way is not working, but I can ask that question later).

Can you give me any short example, that I define some OCL constraint in a stereotype, (re)define the profile, make a class diagram, validate it and the editor shows me a warning related to the OCL Constraint I created in the profile level? I would be very satisfied to see a running example of OCL constraints working.

Thanks.
Previous Topic:Re: Deployment Diagram
Next Topic:Null Pointer Exception on class diagram opening
Goto Forum:
  


Current Time: Tue Apr 23 17:32:33 GMT 2024

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

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

Back to the top