Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How to inherit attributes in class/block diagram using Eclipse Papyrus?(Question about how to correctly use class and object diagrams)
How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852414] Sun, 15 May 2022 12:59 Go to next message
James Miranda is currently offline James MirandaFriend
Messages: 3
Registered: May 2022
Junior Member
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 #1852416 is a reply to message #1852414] Sun, 15 May 2022 16:12 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Hi James,
the standard UML way. Connecting two uml:Class elements with a uml:Generalization the uml:Class element on the client end inherits the attributes from the uml:Class element on the provider end. A sysml:Block is merely a uml:Stereotype applied on uml:Class. Consequently the some applies for blocks.
That also works over several uml:Generalization relations, like A defines some attributes, A generalizes B, B generalizes C. The C also inherits from A.
The attributes are not rendered within a diagram by default, but you can drag'n'drop them from the model explorer if you want them showed.
Works like that at least since Papyrus version 0.7 ;-)
/Carsten

PS Martin-Harris Construction ???

[Updated on: Sun, 15 May 2022 16:24]

Report message to a moderator

Re: How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852437 is a reply to message #1852416] Mon, 16 May 2022 14:41 Go to previous messageGo to next message
James Miranda is currently offline James MirandaFriend
Messages: 3
Registered: May 2022
Junior Member
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 14:47]

Report message to a moderator

Re: How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852440 is a reply to message #1852437] Mon, 16 May 2022 16:01 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 479
Registered: May 2015
Location: Germany
Senior Member
Hi James,
ok, you want the attributes and operations of the block shown in the part.
Brief answer:
The OMG SysML 1.6 specification does not define this and the Papyrus SysML 1.6 add-on realizes SysMl 1.6.
/Carsten
Re: How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852460 is a reply to message #1852440] Tue, 17 May 2022 08:43 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Without your example I cannot be sure that I understand the problem.

I can just relate that when developing the OCL support for Instance evaluation, I realized that the poor naming and duality of Instance / InstanceSpecification made it very easy to be confused and so work at the wrong meta-level. This could explain the invisibility of your inherited attributes.

Regards

Ed Willink
Re: How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852509 is a reply to message #1852460] Thu, 19 May 2022 12:05 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 341
Registered: July 2009
Location: Paris Saclay, France
Senior Member
Hi,

This is a confusion about part. A part is not an instance. A part is a role that play the block inside your type. In the semantic the part is a property exactly as an attribute.

I you want an instance create an instanceSpecification with slots and you can associate a value for each slot.

Patrick
Re: How to inherit attributes in class/block diagram using Eclipse Papyrus? [message #1852619 is a reply to message #1852509] Fri, 27 May 2022 13:19 Go to previous message
James Miranda is currently offline James MirandaFriend
Messages: 3
Registered: May 2022
Junior Member
Thank you everyone for your explanations.

I got now that I was a misunderstanding what a Part is in the SysML.
Previous Topic:Exception on Papyrus JUnit tests
Next Topic:Is there any way to do api parsing for Sysml1.6?
Goto Forum:
  


Current Time: Sat Apr 27 03:34:15 GMT 2024

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

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

Back to the top