|
|
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 |
JP 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 #1333652 is a reply to message #1326847] |
Mon, 05 May 2014 06:53 |
Camille Letavernier Messages: 952 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
|
|
|
Powered by
FUDForum. Page generated in 0.04156 seconds