Working with the graphical data model designer - 6.5

Talend Data Fabric Studio User Guide

EnrichVersion
6.5
EnrichProdName
Talend Data Fabric
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

You can design a data model from scratch using a graphical designer which is implemented by the Design tab in the data model editor.

If needed, you can switch to the default data model editor at any time to make changes which will be synchronized immediately in the graphical designer. For more information, see Setting up a data model.

The editor also enables you to switch to the XML schema source by clicking the Schema Source tab. After clicking the Schema Source tab at the bottom of the editor, you can create the data model directly in the schema source, that is, an XML schema document. For more information, see the section How to work with the schema source of a data model.

The following scenario shows how to design the data model DStar from scratch using the graphical designer.

Prerequisite: You have just created a new data model DStar. For more information, see How to create a data model.

In this scenario, you will learn how to do the following basic tasks using the graphical designer:

In addition, you can learn:

Creating entities in a data model using a graphical designer

Firstly, you need to create entities in the newly created data model DStar as described in How to create a data model.

  1. In the MDM Repository tree view, double-click the data model to open its editor.

  2. Click the Design tab.

  3. From the Palette on the right side, click Entity and then click in the Data Model Entities area.

    A dialog box pops up.

  4. Enter a name for the new entity. In this example, it is Agency.

    If you want to define a complete structure and reuse it in other entities, enter a name in the complex type field to define a new complex type. For more information, see How to create business entities in the data model.

  5. Click OK to close the dialog box.

    The newly created entity Agency of anonymous type is displayed in the Data Model Entities area with a by default element, which takes its name from the entity name with the suffix Id.

    The complex type, if any, will be displayed in the Data Model Types area.

  6. Repeat the procedure to create a new entity Agent in the data model DStar.

Adding simple type elements to entities

You need to add elements to the business entities you have just created in Creating entities in a data model using a graphical designer.

The following example introduces how to add simple type elements to the entity Agency.

  1. From the Palette, click Element and then click in the upper part of the entity.

    A dialog box pops up.

  2. Keep the default option Simple Type and click Next.

    The [Create Element] dialog box pops up.

  3. In the Business Element Name field, enter a name for the new element.

  4. In the Type area, select an appropriate type for the new element. In this example, select string from the Built-in Type list.

    You can also select a custom type from the Custom Type list. By default, several custom types are available, for example, UUID, PICTURE, and URL. If needed, you can define custom types according to your needs. For more information, see Adding custom type elements to entities.

  5. Set the number of maximum and minimum occurrences according to your needs. In this example, to make the Name element mandatory, set 1 to both occurrences.

    You can also define multi-occurrence attributes by setting a specific number in the Maximum Occurrence field, or select the Unbounded check box so that the maximum number of occurrences is not bounded.

  6. Click Finish to close the dialog box.

    The new element Name of string type is added to the Agency entity.

  7. Repeat the procedure to add as many elements as needed to the entity Agency.

    In this example, add the following:

    Business Element Name

    Type

    Minimum Occurrence

    Maximum Occurrence

    City

    string

    0

    1

    State

    string

    0

    1

    Zip

    string

    0

    1

    Region

    string

    0

    1

    MoreInfo

    MoreInfo (custom type)

    0

    1

  8. Repeat the procedure to add as many elements as needed to the entity Agent.

    In this example, add the following elements:

    Business Element Name

    Type

    Minimum Occurrence

    Maximum Occurrence

    Firstname

    string

    1

    1

    Lastname

    string

    1

    1

    CommissionCode

    string

    1

    1

    StartDate

    date

    1

    1

    TermDate

    date

    0

    1

    Status

    string

    0

    1

Adding custom type elements to entities

You can either add a new element of the default custom type or create a new custom type and use it in elements.

The following example shows how to add the element MoreInfo of a newly created custom type MoreInfo to the Agency entity.

  1. From the Palette, click Element and then click in the upper part of the entity.

    A dialog box pops up.

  2. Keep the default option Simple Type and click Next.

    The [Create Element] dialog box pops up.

  3. In the Business Element Name field, enter a name for the element.

  4. Select the Custom Type option, and enter a new name in the field to create a new custom type.

    The newly created custom type will be shown in the Data Model Types area in the upper part of the data model editor, and will be available in the Custom Type list.

  5. Click Finish to close the dialog box.

The element MoreInfo of the custom type MoreInfo is shown in the Agency entity.

Adding complex type elements to entities

When designing a data model, you can define a complex type with a complete structure which can be reused by elements or entities. After clicking the Design tab in the data model editor, you can check all complex types created in your data model in the Data Model Types area.

Each complex type can serve as the basis for another complex type. You can firstly define a higher level complex type with all common elements; next, define another complex type to extend the higher level complex type and then be extended in turn. For more information, see Data model inheritance and polymorphism.

After creating complex types, you are allowed to make updates on them in the Data Model Types area, and the updates will be synchronized in the elements using them directly.

The following example introduces how to define a complex type AddressType, and then define another two complex types EUAddressType and USAddressType by extending the existing type AddressType to add specific elements to complete the US and EU addresses while inheriting the elements from the main address type.

  1. Open the data model editor, and then click the Design tab.

  2. From the Palette, click ComplexType and then click in the Data Model Types area.

    A dialog box pops up.

  3. Enter a name for the complex type and then select the Sequence option in order to list the address elements in the defined order.

    Make sure the name of a complex type does not contain special characters such as, @, #, or -.

  4. Click OK to close the dialog box.

    A new complex type AddressType is displayed in the Data Model Types area. Now you need to add elements to the new complex type.

  5. From the Palette, click TypeElement and then click in the upper part of the complex type which you want to extend.

    The [Create Element] dialog box pops up.

  6. Select the element type, and then click Next. In this example, select Simple Type.

  7. Enter an element name in the Business Element Name field, select the type from the list, and set the maximum and minimum occurrences.

    In this example, add an element Line1 of string type whose maximum and minimum occurrences are both 1.

  8. Click Finish.

    A new element Line1 is added to the complex type AddressType.

  9. Repeat the procedure to add two other elements: Line2 and City.

Now you can extend the AddressType to define the inheritance types for the US and EU addresses. In this example, the EUAddressType extends the main AddressType by adding a postal code and a country, whereas the USAddressType extends the main AddressType by adding a zip code and a state.

  1. From the Palette, click ComplexType and then click in the Data Model Types area.

    A dialog box pops up.

  2. Enter a name for the complex type. In this example, it is EUAddressType.

    Make sure the name of a complex type does not contain special characters such as, @, #, or -.

  3. Select the complex type you want to extend from the list, AddressType in this example.

  4. Click OK.

    The new complex type EUAddressType which extends AddressType is added. Now you can add elements specific to the EUAddressType.

  5. From the Palette, click TypeElement and then click in the upper part of the complex type which you want to add new elements.

    The [Create Element] dialog box pops up.

  6. Enter a name PostalCode for the new element, select string from the Built-in Type list, and then set both the maximum and minimum occurrences to 1.

  7. Click Finish.

  8. Repeat the procedure to add another new element Country to the complex type EUAddressType.

  9. Follow the same steps to create another complex type USAddressType by extending the existing AddressType. You can add two new elements ZipCode and State which are specific to USAddressType.

Now you can use the complex types when adding elements to entities.

The following example assumes that you have created a new entity Region in the data model DStar and you want to add several new complex type elements to the entity. For more information, see Creating entities in a data model using a graphical designer.

  1. From the Palette, click Element and then click in the upper part of the entity.

    The [Create Element] dialog box pops up.

  2. Select the Complex Type option, and then click Next.

  3. Enter a name for the new element. In this example, we want to add a complex type element EUAddress first.