Task 4: Creating a data model
About this task
In this task, you...
- Create a data model for weather.
- Enumerate a data type for temperatures in the data model.
- Add a composite data type for weather to the data model.
- Declare a dependency.
- Update the logic in the decision model.
- Run the model to check your changes.
You create a data model to define custom data types for your service. Basic data types, including string and integer, are predefined by default in Automation Decision Services. However, organizations often need custom data types that match their operations. For example, a car rental company might need special types such as car, fleet and rental price. These types are defined in a data model, and can be used in multiple artifacts in a decision service (see Creating a data model).
Step 1: Creating a data model and enumerating a data type
About this task
In this step, you create a data model and enumerate the values for a custom data type (see Working with enumeration types).
Procedure
- Click My Service in the navigation breadcrumbs to return to the main page of your decision service.
- Open the Data tab.
- Click Create to create a data model.
- Enter Data in the Name field, and click
Create. The data model editor opens.
-
In the data model editor, click the
button next to Data types, and click
Enumeration type in the menu. - Change the name of the new enumeration type from new enum to
temperature.
Take a moment explore the editor. The first part displays the language, the documentation, and the different verbalizations of the vocabulary elements. You can collapse this part by clicking the arrow to the right of the type name.
- In the Values section, click the Add button twice to add two more values.
- Change the names of the values to
cold,warm, andhot.Your changes are automatically saved. The enumeration type temperature is now defined by these values.
Step 2: Adding a composite data type
About this task
In this step, you add a composite data type that uses the enumeration type temperature. You define a composite data type by using a set of attributes (see Working with composite types).
Procedure
Step 3: Declaring a dependency
About this task
Procedure
- Click the Navigation history button
in the top right
toolbar, and click My Model to open it. - Open the Dependencies tab.
- Click the Add button to declare a new dependency.
- Select Data in the table and click
Add. The custom data types are now ready to be used in the decision model.
Step 4: Changing the logic
About this task
In this step, you update the decision model to use the data types that you defined in your data model.
Procedure
Step 5: Running the model
About this task
In this step, you run the model to test your changes.