Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Newbie: Add attribute to a class in UML class diargram
Newbie: Add attribute to a class in UML class diargram [message #657755] Thu, 03 March 2011 21:07 Go to next message
Sergey Metcherin is currently offline Sergey MetcherinFriend
Messages: 14
Registered: February 2011
Junior Member
Good day, colleagues!

I've just install Papyrus and create first UML class diagram. Then I created class from the pallete. But now I don't see a way to create attributes for the class. I have Properties tab at the bottom of the window, it has 4 tabs: UML, Profile, Appearence, Advanded. I don't see any tool for attribute creation at any of these tabs.

Can you help me? How can I create class attributes in Papyrus?

Eclipse - Helios SR2, Papytus - 0.7.2
Re: Newbie: Add attribute to a class in UML class diargram [message #657806 is a reply to message #657755] Fri, 04 March 2011 07:48 Go to previous messageGo to next message
nicolas h is currently offline nicolas hFriend
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
Hi,
After adding a class from the palette, you can select on the palette the node "property" and move it into your AttributeCompartment's class.

You can also open the Model Explorer, right click on your class, and select "New Child / Create a new Property".

--
nicolas
Re: Newbie: Add attribute to a class in UML class diargram [message #659592 is a reply to message #657806] Mon, 14 March 2011 17:41 Go to previous messageGo to next message
JP  is currently offline JP Friend
Messages: 1
Registered: March 2011
Junior Member
Hi Nicolas,

The point that Sergey is driving at is when you create an XML schema, you have a mix of elements and attributes.

The point is if you are using EA or RSA, the UML allows you to distinguish between elements and attributes.

How does Papyrus distinguish between an property for an element and a property for an attribute?

The only way I was able to do this was to create a UML to XML Schema profile when using Topcased.

Here is to illustrate my example of XSD with elements and attributes:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns="http://www.edna-site.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.edna-site.org">
<xs:include schemaLocation="UMLPrimitiveTypes.library.xsd"/>
<xs:element name="Class0" type="xs:string"/>
<xs:complexType name="Class0">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="oid"
type="xs:Integer" />
<xs:element maxOccurs="1" minOccurs="0" name="name"
type="xs:String" />
<xs:element ref="Class0"></xs:element>
</xs:sequence>
<xs:attribute name="oid" type="xs:int"></xs:attribute>
</xs:complexType>
</xs:schema>


Cheers, JP

[Updated on: Mon, 14 March 2011 17:43]

Report message to a moderator

Re: Newbie: Add attribute to a class in UML class diargram [message #1326847 is a reply to message #659592] Thu, 01 May 2014 23:46 Go to previous messageGo to next message
leo bravo is currently offline leo bravoFriend
Messages: 1
Registered: May 2014
Junior Member
Embarrassed Mad

very anti natural to do that and still couldn't find the option....

The feature at the bottom of the properties window only shows owned attributes....

Can't imagine how hard would be adding properties....
Re: Newbie: Add attribute to a class in UML class diargram [message #1333652 is a reply to message #1326847] Mon, 05 May 2014 06:53 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 932
Registered: February 2011
Senior Member
Hi Leo,

Attributes and Properties in UML are actually exactly the same thing. The semantic element is a "Property", which can have many roles. When a Property is owned by a Structured Classifier, it plays the role of an Attribute.

So... "Owned attributes" actually displays the Properties of the Class.

Thus, you have three options for creating attributes/properties for a Class:

- Most natural one: In a Class diagram, select "Property" from the Palette, and create it on your Class (Drag & Drop, or Click & Click)
- From the properties view: Select a Class, go to the UML tab, then click on the green "+" near "Owned attribute", and select "Property"
- From the model explorer: Right click on a Class, New Child > Property

Camille


Camille Letavernier
Previous Topic:Delete option is disabled
Next Topic:Moving with mouse inside diagram view
Goto Forum:
  


Current Time: Sun Nov 29 23:39:09 GMT 2020

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

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

Back to the top