argouml-tigris-org.github.io

Web pages for the ArgoUML project.

From the ArgoUML wiki at argouml.tigris.org.
Wiki: XSD/Stereotypes

Stereotype Functionality

Items in a UML class diagram can be represented in several different manners within XSD. The purpose of using ArgoUML Stereotype functionality is to allow users to specify exactly how a particular item should be (or is) modeled in XSD.

Approach

With the advent of ArgoUML 0.26, the application now provides users with the capability to include a profile namespace in the form of an .XMI file. This file can include both data types (see XSD/Primitive Data Types) and profile information. It is assumed that users wishing to use particular design stereotypes will include an XSD-specific profile created by this project team.

Class Stereotypes

The XSD-specific profile is anticipated to include the following Class and ElementResidence Scoped items:

  • any
  • choice
  • sequence (DEFAULT)

If no stereotype is specified, the code generation should default to xsd:sequence.

xsd:any

In XSD, the "any" design pattern is meant to provide a way for complex instance objects to include any of its contained simple objects with no prescribed order. Any sub-property can appear in any order within an instance of the parent class.

The way this design patern is specified in XSD is shown in the following example:

<xsd:complexType name="PersonNameType">
  <xsd:any>
    <xsd:element name="SurName" type="xsd:string"/>
    <xsd:element name="GivenName type="xsd:string"/>
  </xsd:any>
</xsd:complexObject>

xsd:choice

The "choice" design patern allows schema creators to specify that any ONE child element/property within a class can be included in a class instance but no other children can exist. Usage of this pattern pre-dates the use of abstraction and substitution in order to address much the same issue where only one out of a list of elements is desired (e.g. First Name OR a Nick Name, but not both).

The way this design patern is specified in XSD is shown in the following example:

<xsd:complexType name="PersonNameType">
  <xsd:choice>
    <xsd:element name="NickName" type="xsd:string"/>
    <xsd:element name="GivenName type="xsd:string"/>
  </xsd:choice>
</xsd:complexObject>

xsd:sequence (DEFAULT)

Sequence means exactly how it is defined in english. An order of chid elements/properties that must exist in the class instance in the same order that they are listed in the schema.

The way this design patern is specified in XSD is shown in the following example:

<xsd:complexType name="PersonNameType">
  <xsd:sequence>
    <xsd:element name="SurName" type="xsd:string"/>
    <xsd:element name="GivenName type="xsd:string"/>
  </xsd:sequence>
</xsd:complexObject>

Generalization Stereotypes

The XSD-specific profile is anticipated to include the following Generalization Scoped items:

  • extension (DEFAULT)
  • restriction

If no stereotype is specified, the code generation should default to xsd:extension.

xsd:extension (DEFAULT)

Extension is the way in which specialized classes add to or augment their generalized parent classes.

The way this design patern is specified in XSD is shown in the following example:

<xsd:complexType name="IberianPersonNameType">
  <xsd:complexContent>
    <xsd:extension base="PersonNameType">
      <xsd:sequence>
        <xsd:element name="SurName" type="xsd:string"/>
        <xsd:element name="GivenName type="xsd:string"/>
      </xsd:sequence>
    </xsd:extension>
  </xsd:complexContent>
</xsd:complexObject>

xsd:restriction

Restricction is the way in which specialized classes reduce their generalized parent classes. This is most commonly used in conjunction with simple data types as a way to restrict an element's values to particular paterns, enumerations or data ranges.

THIS PORTION OF THE DESIGN IS OPEN FOR DISCUSSION. PLEASE PROVIDE YOUR THOUGHTS HERE OR IN THE DEVELOPER FORUMS.

Element Stereotypes

The XSD-specific profile is anticipated to include the following Element [or property] Scoped items:

  • element (DEFAULT)
  • attribute

Object properties can be implemented in XML as either a tag (element) or tag qualifier (attribute). For example, in the following XML expression, "complexType" is an element and "name" is an attribute:

<complexType name="PersonNameType"/>

If no stereotype is specified, the code generation should default to xsd:element.

xsd:element

Element representations are documented as the following in schema:

<xsd:element name="SurName" type="xsd:string"/>

xsd:attribute

Attribute representations are documented as the following in schema:

<xsd:attribute name="SurName" type="xsd:string"/>

XSD/Stereotypes (last edited 2008-12-30 22:00:56 -0700 by mathco)