Create Relations
You can use a relation notation as convenient shorthand to represent multiple contexts.
A relation is a vertical list of similar contexts arranged horizontally. In other words, each row of a relation table is a context and each column consists of context entries, where the column name is the common key attribute for all cell entries under it that act as value attributes of respective contexts (rows). For details about contexts and key-value pairs, see Using Contexts. In a relation, each cell entry is an independent logical notation.
In the output of a relation notation, outputs of all contexts within it are clearly distinguished. You can also invoke the output of a particular context or context entry from another decision.
The following relation contains the stock information for a particular brand of phone in the form of multiple contexts:
Description of the illustration dmn-relation.png
Similar to list notations, use either Phone[1] or Phone[-3] to access the entire context related to black-colored phones. To access all cell entries of a particular column, use the relation name in combination with the column name, for example, Phone.Price returns all entries of the Price column in a list. To access a particular context entry (for example, “Rose Gold”), use Phone.Color[3] or Phone.Color[-1].
The following image is the result of the entire relation, which has results of each context listed separately:
Note:
If you add a function as one of the cell entries, then the relation as a whole doesn’t return a result. However, you will still be able to invoke results of other cell entries or contexts throughout the decision model.