Skip to main content Skip to complementary content

Defining custom type attributes

To define attributes of custom types, you can either change an attribute of simple type to that of a default custom type, or define a new custom type and then use it for the attributes.

In this example, two custom type attributes are defined for the Movie entity.

Procedure

  1. Right-click an attribute of a simple type and then select Change to a Simple Type to open the Make Simple Type dialog box where you can select the custom type as needed.

    In this example, select the Custom option, and then select the default custom type URL from the Type list for the SourceURL attribute in the Movie entity.

  2. Click OK to validate your changes.
  3. Define a new custom type and then use it for attributes.

    In this example, to define a custom type RatingType, right-click in the Data Model Types area, and then select Create a Simple Type to open the New Simple Type dialog box.

  4. Select the Custom option, and enter a name RatingType in the Type field.
  5. Click OK to close the dialog box.

    The new custom type is created and listed in the Data Model Types area.

  6. In the Data Model Types area, right-click RatingType, and then select Change Base Type to open the Change Base Type dialog box.
  7. Select int from the Type list, and click OK to close the dialog box.
  8. To define the minimum value allowed for the custom type, right-click the custom type, select Edit minInclusive from the contextual menu to open the MinInclusive Facet dialog box, and then enter a value in the field and click OK to close the dialog box.

    In this example, enter 1.

  9. To define the maximum value allowed for the custom type, right-click the custom type, select Edit maxInclusive from the contextual menu to open the MaxInclusive Facet dialog box, and then enter a value in the field and click OK to close the dialog box.

    In this example, enter 9.

    In this example, a custom type RatingType is defined based on the int type with a minimum value of 1 and a maximum value of 9.

  10. In the Movie entity, right-click the attribute Rating, and then select Change to a Simple Type to open the Make Simple Type dialog box where you can select the custom type as needed.

    In this example, select the Custom option, and then select RatingType from the Type list for the Rating attribute in the Movie entity.

Results

In the data model Movie, you have defined two custom type attributes SourceURL and Rating for the Movie entity.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!