Login | Register
My pages Projects Community openCollabNet

argouml
Wiki: XSD/Class Associations

Wiki: XSD/Class Associations

Edit this page | XSD | Links to this page | Page information | Attachments | Refresh page

 

Class Associations

Associations come in three essential flavors within UML 1.4 and are termed as the following in the ArgoUML tool:

  • Association.
  • Aggregation.
  • Composition.

XSD provides for similar class associations within schema and is flexible enough to depict each of the association types in a different manner. XSD allows for global or local declarations of data types and elements which enable and restrict object reuse in a similar fashion to the intent of the different association lines. The following table depicts the different means by which this design is proposing to treat each of the different line types:

Aspect

Association

Aggregation

Composition

Element Declaration

Global

Local

Local

Type Definition

Global

Global

Local

Further examples and description are provided in the remainder of this section.

Association

Explicitly Named

When the line is named, the line name should be the element name regardless of what the destination box is named. The destination box does however determine the complex type name.


<xsd:complexType name=”BusinessType”>
  <xsd:element name=”LegalName” type=”xsd:string”/>
  <xsd:element name=”DateOriginated” type=”xsd:date”/>
  <xsd:element ref=”CityLicense”/>
</xsd:complexType>

<xsd:complexType name=”LicenseType”>
  <xsd:element name=”ExpirationDate” type=”xsd:dateTime”/>
  <xsd:element name=”LicenseID” type=”xsd:string”/>
</xsd:complexType>


<xsd:element name=”Business” type=”BusinessType”/>
<xsd:element name=”CityLicense” type=”LicenseType”/>


Unnamed

When a name is not provided with the association, the destination box name should be assumed to be the element name.


<xsd:complexType name=”BusinessType”>
  <xsd:element name=”LegalName” type=”xsd:string”/>
  <xsd:element name=”DateOriginated” type=”xsd:date”/>
  <xsd:element ref=”License”/>
</xsd:complexType>

<xsd:complexType name=”LicenseType”>
  <xsd:element name=”ExpirationDate” type=”xsd:dateTime”/>
  <xsd:element name=”LicenseID” type=”xsd:string”/>
</xsd:complexType>


<xsd:element name=”Business” type=”BusinessType”/>
<xsd:element name=”License” type=”LicenseType”/>


Aggregation

Explicitly Named

When the line is named, the line name should be the element name regardless of what the destination box is named. The destination box does however determine the complex type name.


<xsd:complexType name=”BusinessType”>
  <xsd:element name=”LegalName” type=”xsd:string”/>
  <xsd:element name=”DateOriginated” type=”xsd:date”/>
  <xsd:element name=”CityLicense” type=”LicenseType”/>
</xsd:complexType>

<xsd:complexType name=”LicenseType”>
  <xsd:element name=”ExpirationDate” type=”xsd:dateTime”/>
  <xsd:element name=”LicenseID” type=”xsd:string”/>
</xsd:complexType>


<xsd:element name=”Business” type=”BusinessType”/>


Unnamed

When a name is not provided with the association, the destination box name should be assumed to be the element name.


<xsd:complexType name=”BusinessType”>
  <xsd:element name=”LegalName” type=”xsd:string”/>
  <xsd:element name=”DateOriginated” type=”xsd:date”/>
  <xsd:element name=”License” type=”LicenseType”/>
</xsd:complexType>

<xsd:complexType name=”LicenseType”>
  <xsd:element name=”ExpirationDate” type=”xsd:dateTime”/>
  <xsd:element name=”LicenseID” type=”xsd:string”/>
</xsd:complexType>


<xsd:element name=”Business” type=”BusinessType”/>


Composition

Explicitly Named

When the line is named, the line name should be the element name regardless of what the destination box is named. As the type is an anonymous declaration, no Complex Type name is required.


<xsd:complexType name=”BusinessType”>
  <xsd:element name=”LegalName” type=”xsd:string”/>
  <xsd:element name=”DateOriginated” type=”xsd:date”/>
  <xsd:element name=”CityLicense”>
    <xsd:complexType>
      <xsd:element name=”ExpirationDate” type=”xsd:dateTime”/>
      <xsd:element name=”LicenseID” type=”xsd:string”/>
    </xsd:complexType>
  </xsd:element>
</xsd:complexType>


<xsd:element name=”Business” type=”BusinessType”/>


Unnamed

When a name is not provided with the association, the destination box name should be assumed to be the element name.


<xsd:complexType name=”BusinessType”>
  <xsd:element name=”LegalName” type=”xsd:string”/>
  <xsd:element name=”DateOriginated” type=”xsd:date”/>
  <xsd:element name=”License”>
    <xsd:complexType>
      <xsd:element name=”ExpirationDate” type=”xsd:dateTime”/>
      <xsd:element name=”LicenseID” type=”xsd:string”/>
    </xsd:complexType>
  </xsd:element>
</xsd:complexType>


<xsd:element name=”Business” type=”BusinessType”/>


XSD/Class Associations (last edited 2008-12-19 19:38:41 -0800 by ?mathco)