Modeling data
A data model is a collection of data types that represents the data you need to feed your decision. In this data model, you use built-in data types and custom data types as building blocks to model the structure of the real-life data that you want to represent.
For example, in a decision that computes the discount rate to apply to the purchases of a loyal customer, you would create a data model that represents the customer details and the content of its shopping cart.
- What information the node can store and send.
- The possibilities when authoring the decision logic.
- Create a data model from scratch and define each data type you need manually.
- Import a data model definition file that contains per-defined data types. See Importing a data model definition file.
Data types
Each term that you define in a data model is associated to a data type. This data type can either be a built-in type, or a custom type.
The following built-in data types are supported in Decision Designer:
| Data type | Description | Examples | |
|---|---|---|---|
| Boolean | A value that can be either true or false |
n/a | |
| calendar duration | A duration expressed by units of time | P6M10D for a period of 6 months and 10 days |
|
| date | A specific calendar date | 01/01/2019 |
|
| date & time | The combination of date and time | 01/01/2019 12:30:00 |
|
| day of week | A day of the week | Tuesday |
|
| integer | big integer | A whole number |
|
| byte | A whole number that can range from -128 to 127 |
|
|
| int | A whole number that can range from -2,147,483,648 to 2,147,483,647 |
|
|
| long | A whole number that can range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
|
|
| short | A whole number that can range from -32,768 to 32,767 |
|
|
| month | A month of the year | January |
|
| number | big decimal | A number that can be decimal |
|
| double | A 64-bit number that can be decimal |
|
|
| float | A 32-bit number that can be decimal |
|
|
| string | A set of characters | "Hello world" |
|
| time | A specific time value | 12:30:00 |
|
| time period | A specific time period that is characterized by a start time and an end time | 2019-07-14T01:01:01Z/2019-07-15T01:01:01Z |
|
| year | A year | 2019 |
|
- Composite type
-
A composite type is a composite of other existing data types. You might create a composite type whose attributes include built-in types, or other custom types. The attributes of a composite type describe the characteristics of the real-world entity that it represents.
A car, for example, can be characterized by its brand, its ID, and its category. To represent it, you can create a composite type car that contains the following attributes:- brand, of built-in type string
- ID, of built-in type number
- car category, of custom type car category
For more information about composite types, see Creating composite types.
- Enumeration type
An enumeration type is a data type that contains a specific set of values. The data that the enumeration represents can only take a value from this list.
The custom type car category, for example, can be described as an enumeration that can only take one the three following values: compact, full size, or premium.
For more information about enumeration types, see Working with enumeration types.
You can also enrich your data model with custom data types and functions from imported external libraries. For more information about building and importing external libraries, see Working with external libraries.
Verbalization
For each element that you define in the data model, a default verbalization is applied. This default verbalization defines how these elements are referenced in business rules and decision tables.
The verbalization depends on the type of element, for example whether it is a simple type or a composite type with several attributes. You can see examples of this default verbalization in the data model editor when you open the details of an element. For more information about the default verbalization that is applied to attributes, see Default verbalization.
You can edit the default verbalization directly in the data model editor.
- An expression accesses the data associated with a composite type, for example
{name} of {this} - An action modifies the data associated with a composite type, for example
set the name of {this} to {name}
You might want to edit the default verbalization of expression and action phrases to make them easier to understand or avoid wordiness.
- A definite and an indefinite article for both data types and attributes
- A quantitative article for data types only
You can change this default verbalization to specify, for example, the plural of a term that has an irregular form.
JSON name
Each element that you define in a data model has an associated JSON name. This JSON name is used when running or executing a decision service. Each data type must have a unique JSON name. Each attribute must have a unique JSON name within its enclosing data type.
The JSON name is derived directly from the element name, but uses the camel case convention. The JSON name can be edited.
- Have a maximum length of 64 characters.
- Be valid JavaScript identifiers.
- Not be Java reserved words.
- Not be JavaScript reserved words.
- Only contain letters, digits,
$, and_. - Not start with a digit.
- Not contain any space.