Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How to model restrictions in relationships in UML Profile and stereotype properties
How to model restrictions in relationships in UML Profile and stereotype properties [message #1413839] Fri, 29 August 2014 14:56 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 128
Registered: April 2013
Senior Member
Hello all,

I would like to model restrictions on dependencies between different kind of newly created stereotypes in my profile.

E.g. I have a stereotype of type dependency and a stereotype of type class. I now want to model that the 2nd stereotype only can be the client of the 1st stereotype and not the target.

Another issue is the stereotype properties. How are they modeled?

Thanks a lot for any appreciated support.

Kind regards, Alexander
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1414168 is a reply to message #1413839] Sat, 30 August 2014 13:33 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 987
Registered: July 2009
Senior Member
Hi, Alexander,

See some replies in-line, below.

HTH,

Christian

On 2014-08-29 14:56:32 +0000, Alexander Fülleborn said:

> Hello all,
>
> I would like to model restrictions on dependencies between different
> kind of newly created stereotypes in my profile.

OCL constraints should be able to specify these restrictions, and
Papyrus Luna evaluates such constraints in validation of models that
have the profile applied.


> E.g. I have a stereotype of type dependency and a stereotype of type
> class. I now want to model that the 2nd stereotype only can be the
> client of the 1st stereotype and not the target.

Let's call the class stereotype "Client". Then an OCL constraint like
this (totally untried and untested) on the dependency stereotype might
do what you want:

self.supplier->select(oclIsKindOf(uml::Class))->forAll(sup |
sup.oclAsType(uml::Class).extension_Client->isEmpty())

I'm assuming the cast as Class will be needed to resolve the Client
stereotype's metaclass extension end.


> Another issue is the stereotype properties. How are they modeled?

I don't understand the question. They are modeled like any other
properties of a class in a Papyrus UML model, or do you have a more
specific concern about how they work at run-time?


> Thanks a lot for any appreciated support.
>
> Kind regards, Alexander
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1414460 is a reply to message #1414168] Sun, 31 August 2014 11:07 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 128
Registered: April 2013
Senior Member
Hi Christian,

many thanks for your helpful answers. Concerning the constraints with OCL, I will try it asap. Concerning the stereotype properties, I have successfully been able to implement them, as you said. Now I struggle with making them visible within the diagram. What do I need to set in order to see the values of the stereotype properties in my diagrams (this is indeed a concern about how they work at run-time, as you asked)?

Thanks and kind regards, Alexander
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1414866 is a reply to message #1414460] Mon, 01 September 2014 13:33 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 682
Registered: February 2011
Senior Member
Hi,

The new OCL 2.4 selector "->selectByKind(uml::Class)" might simplify the definition of the constraint (You don't need to cast anymore, since it's a mix between select() and oclAsType()).

To display the stereotype properties in the diagram, you need to select a stereotyped element in the diagram, then go to the Properties view, Appearance tab, select the stereotype property and click the "display" button. Then, you can choose to display it in a Compartment (default) or as a Comment ("Display place", in the same tab of the properties view)

Regards,
Camille


Camille Letavernier
Papyrus developer
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1437154 is a reply to message #1414866] Sat, 04 October 2014 00:15 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi ,
I have a profile in which I created 3 stereotypes that extend the metaclass "Class" called "ProviderView", "HumanConsumerView" and "Base"
I also created a stereotype that extends the metaclass "Extension" called "ViewExtension".
I want to define a constraint in OCL language. It says:
{ An element ViewExtension is an association between a departure class stereotyped "Base" and a receiver class stereotyped "ProviderView" or "HumanConsumerView" }

The context here is the stereotype "ViewEtension".
I think we can divide this constraint into 2 contraints:
N°1: self.base_Association.getAppliedStereotype('AWSProfile::ViewExtension').oclIsUndefined()=false implies
self.base_Extension.memberEnd.class->forAll(e|e->exists(c|not c.getAppliedStereotype('AWSProfile::ProviderView').oclIsUndefined()) or
e->exists(c|not c.getAppliedStereotype('AWSProfile::HumanConsumerView').oclIsUndefined()))
N°2: self.base_Extension.getAppliedStereotype('AWSProfile::ViewExtension').oclIsUndefined()=false implies
self.base_Extension.memberEnd.class->exists(c|not c.getAppliedStereotype('AWSProfile::Base').oclIsUndefined())

I don't know how to specify the departure and the receiver here Sad


I use Eclipse Kepler SR2 and Papyrus v 0.10.2 20140611 release.
Please I need help for this...any suggestion please....


Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1437645 is a reply to message #1437154] Sat, 04 October 2014 19:58 Go to previous messageGo to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 104
Registered: July 2009
Senior Member
Hi Walid,

First tip -> move to luna. Both papyrus and OCL have an enormous amount of bugs fixed in this area

Second tip -> Use the OCL syntax completion to check what's possible, and make sure you have the UML spec next to you (unless you know it by heart Smile
For instance, the "getAppliedStereotype('AWSProfile::ViewExtension')" should probably be replaced by something like extension_ViewExtension

Third tip (I saved the best one for last) -> If you really want help, post your profile file here...
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1437654 is a reply to message #1437645] Sat, 04 October 2014 20:15 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi
Thank you Klaas for answering..
I know that Luna is better, but it doesn't take account about the shape format of a stereotype, that's why I prefer Kepler...
Doesn't matter, I work on Luna at the same time..
About the second tip, do you mean by OCL Syntax completion, the OCL Xtext assistant (ctrl+ space)? and what is UML spec? sorry, i want to understand this vocabulary.
I uploaded the profile and a model to test the constraint.
Thank you again..
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1437958 is a reply to message #1437654] Sun, 05 October 2014 08:16 Go to previous messageGo to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 104
Registered: July 2009
Senior Member
Walid Ban wrote on Sat, 04 October 2014 16:15
Hi
Thank you Klaas for answering..
I know that Luna is better, but it doesn't take account about the shape format of a stereotype, that's why I prefer Kepler...
Doesn't matter, I work on Luna at the same time..
About the second tip, do you mean by OCL Syntax completion, the OCL Xtext assistant (ctrl+ space)? and what is UML spec? sorry, i want to understand this vocabulary.

Yes I mean the OCL syntax completion. UML spec = UML specification.
But looking at your profile, it looks like you've understood this pretty well

Quote:

I uploaded the profile and a model to test the constraint.
Thank you again..

The profile is quite big (which makes it harder to debug/understand).
My first problem with the profile: why do you extend the meta-class Extension to create a ViewExtension stereotype (instead of extending an association)? Are you aware that Extension is a special meta-class, not to be used in a standard model? Or do I miss something in your profile?

Klaas
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1437973 is a reply to message #1437958] Sun, 05 October 2014 08:53 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Hi
I understand you..
Well, I have a customized palette, in which I have a button that can draw an Extension. Yes, we can't find this in the standard palette, but we can find it in my customized palette (because its origin is the profile).

So, here, the supplier is a class stereotyped "Base".
The client could be a class stereotyped "ProviderView" or "HumanConsumerView"
I just need a tip of how integrating these two concepts (in bold) in my constraint..


Thank you
Regards
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1438058 is a reply to message #1437973] Sun, 05 October 2014 12:13 Go to previous messageGo to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 104
Registered: July 2009
Senior Member
Walid Ban wrote on Sun, 05 October 2014 04:53
Hi
I understand you..

Either you don't, or I don't understand you Smile

In the profile, your stereotype extends the UML meta-class Extension (See UML specification 2.5 beta2, section 12.4). This is a very specific class, that normally only serves in profile definitions. My question was: Why does your stereotype extends this element, and not a standard UML meta-class Association?

@Papyrus team: I don't understand why it's uberhaupt possible to apply the ViewExtension stereotype to an association in the model? Given the definition in the profile, I would expect that it's not even possible?

Klaas



Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1438065 is a reply to message #1438058] Sun, 05 October 2014 12:26 Go to previous messageGo to next message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
Ok , I understand you.
My stereotype extends Extension Meta-Class, and not a standard UML meta-class Association because in an association, there's no difference between the two related classes. I mean there's no specific direction or sens or orientation between two related classes. An association is just a simple line that links two classes, but the extension is an arrow . So, a specific direction or orientation is defined here. I hope that you understand me.
That's why I speak about a supplier and a client(that owns the head of the arrow)
I hope that you understand me
regards
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1438701 is a reply to message #1438065] Mon, 06 October 2014 11:35 Go to previous messageGo to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 104
Registered: July 2009
Senior Member
There are other meta-classes (for instance Dependency, and some other 'DirectedRelationship' variants) that do have a direction natively built in.

The fact is, that given the Extension meta-class is intended for very specific purposes, you might encounter weird results due to using it...
Re: How to model restrictions in relationships in UML Profile and stereotype properties [message #1440049 is a reply to message #1438701] Tue, 07 October 2014 22:11 Go to previous message
Walid Ban is currently offline Walid BanFriend
Messages: 53
Registered: January 2013
Member
No Message Body

[Updated on: Tue, 07 October 2014 22:51]

Report message to a moderator

Previous Topic:Problems with stereotype display
Next Topic:Sequence Diagram Lifeline Header Scroll
Goto Forum:
  


Current Time: Thu Jul 30 02:04:55 GMT 2015

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

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