Table of Contents

Search

  1. Preface
  2. XML Concepts
  3. Using XML with PowerCenter
  4. Working with XML Sources
  5. Using the XML Editor
  6. Working with XML Targets
  7. XML Source Qualifier Transformation
  8. Midstream XML Transformations
  9. Appendix A: XML Datatype Reference
  10. Appendix B: XPath Query Functions Reference

XML Guide

XML Guide

Type 1 Entity Relationship Example

Type 1 Entity Relationship Example

An XML Type 1 entity relationship is a relationship between two views. Each view must be rooted as a global complex type. One view must be derived from the other.
The following schema contains a PublicationType, BookType, and MagazineType. PublicationType is the base type. A publication includes Title, Author, and Date. BookType and MagazineType are derived types that extend the PublicationType. Book has ISBN and Publisher, and Magazine has Volume and Edition.
<xsd:complexType name=
"PublicationType"
>    <xsd:sequence>      <xsd:element name="Title" type="xsd:string"/>      <xsd:element name="Author" type="xsd:string" maxOccurs="unbounded"/>      <xsd:element name="Date" type="xsd:string"/>    </xsd:sequence> </xsd:complexType> <xsd:element name="Publication" type="PublicationType"/> <xsd:complexType name=
"BookType"
>    <xsd:complexContent>    <xsd:extension base="PublicationType">    <xsd:sequence>      <xsd:element name="ISBN" type="xsd:string"/>      <xsd:element name="Publisher" type="xsd:string    </xsd:sequence>    </xsd:extension>    </xsd:complexContent> </xsd:complexType> <xsd:complexType name=
"MagazineType"
>    <xsd:complexContent>    <xsd:extension base="PublicationType">    <xsd:sequence>      <xsd:element name="Volume" type="xsd:string"/>      <xsd:element name="Edition" type="xsd:string"/>    </xsd:sequence>    </xsd:extension>    </xsd:complexContent> </xsd:complexType> </xsd:schema>
When you create XML views as entities in an XML definition, the Title and Date metadata from PublicationType do not repeat in BookType or MagazineType. Instead, these views contain the metadata that distinguishes them from the PublicationType: ISBN and Publisher for BookType, and Volume and Edition for MagazineType. They have foreign keys that link them to PublicationType.
This example uses reduced metadata explosion because none of the elements in the base type repeat in the derived types.
Author is a multiple-occurring element in Publication. Author becomes an XML view.
The following figure shows the default views the Designer generates from the schema:
The default view from the schema shows XML views for Publication, PublicationType, Author, MagazineType, and BookType. MagazineType and BookType XML views include their distinguishing metadata. Author is a multiple-occurring element in Publication and has its own XML view. The MagazineType and BookType XML views have foreign keys that link them to PublicationType.
The following figure shows an XML file that has a publication, a magazine, and books:
The XML file shows a publication, a magazine, and books in its code definition.
If you process the sample XML file using the XML definition in the preceding figure, you create data in the following views:
  • PublicationType view.
    Contains the title and date for each publication.
    The following figure shows the PublicationType view:
  • BookType view.
    Contains the ISBN and publisher. BookType contains a foreign key to PublicationType.
    The following figure shows the BookType view:
  • MagazineType view.
    Contains volume and edition. MagazineType also contains a foreign key to the PublicationType.
    The following figure shows the MagazineType view:
  • Author view.
    Contains authors for all the publications. The Designer generates a separate view for Author because Author is a multiple-occurring element. Each publication can contain multiple authors.
    The following figure shows the Author view:

0 COMMENTS

We’d like to hear from you!