Exercises

Last modified by Carlijn Kokkeler on 2022/10/19 13:32

In this microlearning, we will educate you on what we mean when we talk about message definitions.

Should you have any questions, please contact academy@emagiz.com.

1. Prerequisites

  • Basic knowledge of the eMagiz platform

2. Key concepts

This microlearning centers around understanding the concept data modeling in design. Please note the following items for completing this exercise

  • Ensure to make a small Capture phase that draws the system CAPE and a message type "TransportOrder"
  • The system CAPE provides messages as JSON

3. CDM, CDM & system message, message mapping

By following the steps below, you should gain a better understanding of the differences between CDM, CDM messages, and system messages.

  • Creating a CDM
    • Please import the file Order.xsd in your CDM. The code for this file can be found in section 4. Code for xsd files.
  • Creating a CDM message
    • Now, go to your CDM message and select Order as root entity.
    • Add all other entities and attributes from Order.xsd, which were imported into the CDM, to your CDM message definition.
  • Creating a system message
    • In one of your System messages, import the file TransportOrder.xsd. The code for this file can be found in section 4. Code for xsd files.
  • Creating a CDM message
    • Select CreateOrder as root entity and add all other entities and attributes to your system definition.
  • Complete message mapping
    • Now that you have completed these steps, go to Message mapping and complete the mapping. Please add the following to the Design mapping
      • Ensure to properly map the address type
      • Ensure to properly document mappings where required
  • Update the CDM and CDM message and remove the housenumber attribute
    • Update the mapping accordingly
  • Update the System and CDM message to set the country attributes as enumerations
    • System message uses an ISO-2 standard for country code
    • CDM message uses an ISO-3 standard for country code
        

The solutions to these exercises can be found here.

4. Code for xsd files

4.1 Code for Order.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns="http://www.mappingexercises.com/ns/capetms/cdm/1.0/"
          attributeFormDefault="unqualified"
          elementFormDefault="qualified"
          targetNamespace="http://www.mappingexercises.com/ns/capetms/cdm/1.0/">
  <xs:complexType name="Order">
     <xs:sequence>
        <xs:element name="Date" type="xs:dateTime"/>
        <xs:element name="OrderId" type="nonEmptyString"/>
        <xs:element name="Customer" type="Customer"/>
        <xs:element name="PickupAddress" type="PickupAddress"/>
        <xs:element name="DeliveryAddress" type="DeliveryAddress"/>
        <xs:element maxOccurs="unbounded" name="OrderLine" type="OrderLine"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Customer">
     <xs:sequence>
        <xs:element name="Name" type="nonEmptyString"/>
        <xs:element name="Email" type="nonEmptyString"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="PickupAddress">
     <xs:sequence>
        <xs:element name="Name" type="nonEmptyString"/>
        <xs:element name="Street" type="nonEmptyString"/>
        <xs:element name="StreetNumber" type="nonEmptyString"/>
        <xs:element name="PostalCode" type="nonEmptyString"/>
        <xs:element name="City" type="nonEmptyString"/>
        <xs:element name="Country" type="nonEmptyString"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="DeliveryAddress">
     <xs:sequence>
        <xs:element name="Name" type="nonEmptyString"/>
        <xs:element name="Street" type="nonEmptyString"/>
        <xs:element name="StreetNumber" type="nonEmptyString"/>
        <xs:element name="PostalCode" type="nonEmptyString"/>
        <xs:element name="City" type="nonEmptyString"/>
        <xs:element name="Country" type="nonEmptyString"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="OrderLine">
     <xs:sequence>
        <xs:element name="PackageUnit" type="nonEmptyString"/>
        <xs:element name="Quantity" type="xs:long"/>
        <xs:element name="Description" type="nonEmptyString"/>
        <xs:element name="Weight" type="xs:decimal"/>
     </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="nonEmptyString">
     <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
     </xs:restriction>
  </xs:simpleType>
  <xs:element name="Order" type="Order"/>
</xs:schema>

4.2 Code for TransportOrder.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns="https://transportinc.nl/ns/tms/1.0/"
          attributeFormDefault="unqualified"
          elementFormDefault="unqualified"
          targetNamespace="https://transportinc.nl/ns/tms/1.0/">
  <xs:complexType name="CreateOrder">
     <xs:sequence>
        <xs:element name="Order" type="Order"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Order">
     <xs:sequence>
        <xs:element name="OrderID">
           <xs:simpleType>
              <xs:restriction base="xs:string">
                 <xs:maxLength value="200"/>
              </xs:restriction>
           </xs:simpleType>
        </xs:element>
        <xs:element name="OrderDate" type="xs:dateTime"/>
        <xs:element minOccurs="0" name="Order_Customer" type="Order_Customer"/>
        <xs:element name="Address" type="Address"/>
        <xs:element name="PartnerInfo_Order" type="PartnerInfo_Order"/>
        <xs:element name="OrderLine_Order" type="OrderLine_Order"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Order_Customer">
     <xs:sequence>
        <xs:element minOccurs="0" name="Customer" type="Customer"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Customer">
     <xs:sequence>
        <xs:element name="Name">
           <xs:simpleType>
              <xs:restriction base="xs:string">
                 <xs:maxLength value="200"/>
              </xs:restriction>
           </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="0" name="Contact_Customer" type="Contact_Customer"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Contact_Customer">
     <xs:sequence>
        <xs:element maxOccurs="unbounded"
                    minOccurs="0"
                    name="Contact"
                    type="Contact"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Contact">
     <xs:sequence>
        <xs:element name="eMail">
           <xs:simpleType>
              <xs:restriction base="xs:string">
                 <xs:maxLength value="200"/>
              </xs:restriction>
           </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="0" name="Name">
           <xs:simpleType>
              <xs:restriction base="xs:string">
                 <xs:maxLength value="200"/>
              </xs:restriction>
           </xs:simpleType>
        </xs:element>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Address">
     <xs:sequence>
        <xs:element name="Type" type="nonEmptyString"/>
        <xs:element name="Name" type="nonEmptyString"/>
        <xs:element name="Street" type="nonEmptyString"/>
        <xs:element name="PostalCode" type="nonEmptyString"/>
        <xs:element name="City" type="nonEmptyString"/>
        <xs:element name="Country" type="nonEmptyString"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="PartnerInfo_Order">
     <xs:sequence>
        <xs:element maxOccurs="unbounded"
                    minOccurs="0"
                    name="PartnerInfo"
                    type="PartnerInfo"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="PartnerInfo">
     <xs:sequence>
        <xs:element name="UUID">
           <xs:simpleType>
              <xs:restriction base="xs:string">
                 <xs:maxLength value="64"/>
              </xs:restriction>
           </xs:simpleType>
        </xs:element>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="OrderLine_Order">
     <xs:sequence>
        <xs:element maxOccurs="unbounded"
                    minOccurs="0"
                    name="OrderLine"
                    type="OrderLine"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="OrderLine">
     <xs:sequence>
        <xs:element name="Description">
           <xs:simpleType>
              <xs:restriction base="xs:string">
                 <xs:maxLength value="200"/>
              </xs:restriction>
           </xs:simpleType>
        </xs:element>
        <xs:element name="Quantity" type="xs:long"/>
        <xs:element name="Unit" type="Enum"/>
        <xs:element minOccurs="0" name="Weight" type="xs:double"/>
     </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="nonEmptyString">
     <xs:restriction base="xs:string">
        <xs:minLength value="1"/>
     </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="Enum">
     <xs:restriction base="xs:string">
        <xs:enumeration value="COLLI"/>
        <xs:enumeration value="EURO"/>
        <xs:enumeration value="BOX"/>
        <xs:enumeration value="SACK"/>
     </xs:restriction>
  </xs:simpleType>
  <xs:element name="CreateOrder" type="CreateOrder"/>
</xs:schema>

5. Key takeaways

  • The CDM holds all entities and attributes that are relevant within the context of your complete integration landscape.
  • The CDM message is tailor-made for a specific piece of data and only holds the entities and attributes relevant for that piece of data.
  • A system message is specific to a system.

6. Suggested Additional Readings

If you are interested in this topic and want more information on it please read the help text provided by eMagiz.