> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aseeflow.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Model, Evaluate, and Deploy a Decision Requirements Graph

> [!NOTE]
>
> The visual representation of a Decision Requirements Graph (DRG) is called a Decision Requirements Diagram (DRD).

## Switch from decision table to DRD

Open the existing *Dish* decision table and click *View DRD* to access the Decision Requirements Diagram view, which displays a single decision named *Dish*.

![Switch to the DRD view](https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step1.png?fit=max\&auto=format\&n=nrz9o5m15i2WLCpp\&q=85\&s=6e8c77ef5f611c245df07dbf3419cc0c)

## Set the name and the id of the DRD

Click the canvas and open the properties panel. Update the [id](https://docs.aseeflow.org/1.x/reference/dmn/drg#decision-requirements-graph-id) to `dinnerDecisions` and the [name](https://docs.aseeflow.org/1.x/reference/dmn/drg#decision-requirements-graph-name) to *Dinner Decisions*.

![Set the DRD id and name](https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step2.png?fit=max\&auto=format\&n=nrz9o5m15i2WLCpp\&q=85\&s=8cd598d9fcdffa9f3b5eb784858847fa)

## Create a new decision in the DRD

Select the decision icon from the palette to add a new decision. Name it *Beverages* and set its type to *Decision Table* using the wrench icon. Configure the id as `beverages` via the properties panel.

Connect the *Dish* decision to *Beverages* to indicate that *Dish* is a [required decision](https://docs.aseeflow.org/1.x/reference/dmn/drg#required-decisions) providing input for the beverages evaluation.

![Add the Beverages decision](https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step3.png?fit=max\&auto=format\&n=nrz9o5m15i2WLCpp\&q=85\&s=4ae17a5a975db75ab5cd253c3b84e4da)

![Connect the required decision](https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step4.png?fit=max\&auto=format\&n=nrz9o5m15i2WLCpp\&q=85\&s=9ae0dbc2e455ee151fd1bd5f75a23792)

## Configure the decision table and add the rules

Set up the *Beverages* decision table with:

* Input: *Dish* (expression: `desiredDish`, type: string)
* Input: *Guests with children* (expression: `guestsWithChildren`, type: boolean)
* Output: *Beverages* (name: `beverages`, type: string)
* Hit Policy: COLLECT (with LIST operator)

![Configure the Beverages decision table](https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step5.png?fit=max\&auto=format\&n=nrz9o5m15i2WLCpp\&q=85\&s=7d86e770b962c4979aad1d0162129241)

Save your changes and replace the DMN file in `src/main/resources`.

> [!NOTE]
>
> **Catch up: get the sources of Step-5**
>
> ```bash theme={null}
> git clone https://github.com/aseeflow/aseeflow-get-started-dmn.git
> git checkout -f Step-5
> ```
>
> Or [download as a `.zip`](https://github.com/aseeflow/aseeflow-get-started-dmn/archive/Step-5.zip).

## Evaluate the decision

Extend the application class to evaluate the *Beverages* decision by adding a `guestsWithChildren` variable:

```java theme={null}
package org.camunda.bpm.getstarted.dmn;

@ProcessApplication("Dinner App DMN")
public class DinnerApplication extends ServletProcessApplication
{

  protected final static Logger LOGGER = Logger.getLogger(DinnerApplication.class.getName());

    @PostDeploy
    public void evaluateDecisionTable(ProcessEngine processEngine) {

      DecisionService decisionService = processEngine.getDecisionService();

      VariableMap variables = Variables.createVariables()
        .putValue("season", "Spring")
        .putValue("guestCount", 10)
        .putValue("guestsWithChildren", false);

      DmnDecisionTableResult dishDecisionResult = decisionService.evaluateDecisionTableByKey("dish", variables);
      String desiredDish = dishDecisionResult.getSingleEntry();

      LOGGER.log(Level.INFO, "\n\nDesired dish: {0}\n\n", desiredDish);

      DmnDecisionTableResult beveragesDecisionResult = decisionService.evaluateDecisionTableByKey("beverages", variables);
      List<Object> beverages = beveragesDecisionResult.collectEntries("beverages");

      LOGGER.log(Level.INFO, "\n\nDesired beverages: {0}\n\n", beverages);
    }

}
```

> [!NOTE]
>
> **Catch up: get the sources of Step-6**
>
> ```bash theme={null}
> git clone https://github.com/aseeflow/aseeflow-get-started-dmn.git
> git checkout -f Step-6
> ```
>
> Or [download as a `.zip`](https://github.com/aseeflow/aseeflow-get-started-dmn/archive/Step-6.zip).

## Build and deploy the web application

Build with Maven and replace `dinner-dmn-0.1.0-SNAPSHOT.war` in `$ASEEFLOW_HOME/server/apache-tomcat/webapps`.

Check the Tomcat log for successful deployment indicators:

```
INFO org.camunda.commons.logging.BaseLogger.logInfo
ENGINE-07015 Detected @ProcessApplication class 'org.camunda.bpm.getstarted.dish.DishApplication'
INFO org.camunda.commons.logging.BaseLogger.logInfo
ENGINE-08024 Found processes.xml file at ../webapps/dinner-dmn-0.1.0-SNAPSHOT/WEB-INF/classes/META-INF/processes.xml
INFO org.camunda.commons.logging.BaseLogger.logInfo
ENGINE-08023 Deployment summary for process archive 'dinner-dmn':

        dinnerDecisions.dmn

INFO org.camunda.bpm.getstarted.dmn.DinnerApplication.evaluateDecisionTable

Desired dish: Stew

INFO org.camunda.bpm.getstarted.dmn.DinnerApplication.evaluateDecisionTable

Desired beverages: [Guiness, Water]

INFO org.camunda.commons.logging.BaseLogger.logInfo
ENGINE-08050 Process application Dinner App DMN successfully deployed
```

## Verify the evaluation with Cockpit

Open [Cockpit](http://localhost:8080/aseeflow/app/cockpit) and navigate to the *Decisions* section.

![Beverages decision overview in Cockpit](https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/cockpit-decision-overview-beverages-dmn.png?fit=max\&auto=format\&n=nrz9o5m15i2WLCpp\&q=85\&s=89d2076972d92ffd9372b213f2d00238)

Click the *Beverages* decision and select an id to review the historic evaluation data.

![Beverages decision history in Cockpit](https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/cockpit-decision-history-beverages-dmn.png?fit=max\&auto=format\&n=nrz9o5m15i2WLCpp\&q=85\&s=f1368f7c74790170885c62d7c41fc3e3)

Verify that both rules matched, producing beverages outputs of *Guiness* and *Water*. Note that the *Dish* decision evaluates as part of the *Beverages* evaluation, providing *Stew* for the `desiredDish` input.

## Next steps

* Learn more about DRGs in the [DMN Reference](https://docs.aseeflow.org/1.x/reference/dmn/drg)
* Explore the full [Decision Engine](https://docs.aseeflow.org/1.x/user-guide/process-engine/decisions) documentation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.