How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852414] |
Sun, 15 May 2022 08:59  |
Eclipse User |
|
|
|
I posted this same question on StackOverflow before with the same title. Here at the forum, I'm not able to post all the links to the original question and images.
I hope that I'm posting in the right place.
____________
I'm creating a straightforward class diagram using the Eclipse Papyrus but I'm not able to represent instances correctly.
First of all, I'm using the SysML 1.6 profile, so my classes are actually represented in a Block Diagram instead of classes, but I believe that this does not change anything in my problem.
After creating a simple class/block in my block definition diagram (bdd) I defined some attributes for my block like Name and Quantity.
When I tried to create some instances of my block ("parts" in SysML naming convention) using an "Instance Specification" I was not able to inherit these attributes and fill them with essential information like the "name" and "quantity" in my example.
It's possible to see that my classifier is correctly set as "My component".
The https://wiki.eclipse.org/Papyrus_Starter_Guide#6.3.2.9_Create_new_objects is clear and says that these Instance Specifications should include my attributes so I don't know what I'm doing wrong.
I've tried since now:
- Create instances in the same block diagram (bdd);
- Create instances in another dedicated diagram of the type internal block definition (ibd);
- Use the Papyrus context menu to show/hide all my compartments. Any of them works to show my attributes.
Apparently, the same problem occurs without any SysML profile and using pure UML like this question from 2016.
Does anyone have a tip or explanation for this behavior?
Papyrus version: 6.1.0
|
|
|
|
Re: How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852437 is a reply to message #1852416] |
Mon, 16 May 2022 10:41   |
Eclipse User |
|
|
|
Hi Carsten!
First of all, thank you for your quick response and for your help.
However, I believe that my question without the images and links was a little bit tricky. Sorry for this inconvenience.
I'm not having a problem with generalization between two UML classes. Instead, I'm having problems with my class attributes being filled when I tried to represent my instances.
I'll try to describe my current Papyrus model even without images and hope that it clears my problem a little bit.
I have a uml:Class named "Book" with two attributes "author" which is an EString and "numberOfChapters" which is an EInt. I created it inside a block definition diagram (bdd).
I'm able to create another class "Magazine" that inherits the attributes from "Book" without problems, for example. Following your explanation, I'm able to render these attributes in Papyrus.
After finishing my work with my classes, I created an internal block definition (ibd) and inside this diagram, I created an Instance block (using the "Part" element from the Pallete) that is an instance of my "Book" class. Now, I'm not able to render my "author" and "numberOfChapters" in my diagram, but I'm also not able to fill out these properties (with some values like "James Joyce" for the "author" and 40 for the "numberOfChapters", for example). I have a block "Ulysses:Book[1]" in my ibd without any rendered attributes.
Maybe I used the wrong terms in my question, but I'm trying to represent my SysML instances with filled attributes in my ibd. Do you know if it is possible to do it using Papyrus?
As I said before, I'm not able to post images here, but if you search the exact same title on the StackOverflow site, I posted the exact same question (before my discovery about these Eclipse forums) with some images from my actual Papyrus instance.
PS: I didn't get it. This message was for me too?
[Updated on: Mon, 16 May 2022 10:47] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03674 seconds