> ## 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).
</Note>

## 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*.

<img src="https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step1.png?fit=max&auto=format&n=nrz9o5m15i2WLCpp&q=85&s=6e8c77ef5f611c245df07dbf3419cc0c" alt="Switch to the DRD view" width="1132" height="489" data-path="get-started/dmn/img/modeler-drd-step1.png" />

## Set the name and the id of the DRD

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

<img src="https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step2.png?fit=max&auto=format&n=nrz9o5m15i2WLCpp&q=85&s=8cd598d9fcdffa9f3b5eb784858847fa" alt="Set the DRD id and name" width="1132" height="543" data-path="get-started/dmn/img/modeler-drd-step2.png" />

## 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](/reference/dmn/drg#required-decisions) providing input for the beverages evaluation.

<img src="https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step3.png?fit=max&auto=format&n=nrz9o5m15i2WLCpp&q=85&s=4ae17a5a975db75ab5cd253c3b84e4da" alt="Add the Beverages decision" width="1132" height="538" data-path="get-started/dmn/img/modeler-drd-step3.png" />

<img src="https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step4.png?fit=max&auto=format&n=nrz9o5m15i2WLCpp&q=85&s=9ae0dbc2e455ee151fd1bd5f75a23792" alt="Connect the required decision" width="1132" height="543" data-path="get-started/dmn/img/modeler-drd-step4.png" />

## 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)

<img src="https://mintcdn.com/aseeflow/nrz9o5m15i2WLCpp/get-started/dmn/img/modeler-drd-step5.png?fit=max&auto=format&n=nrz9o5m15i2WLCpp&q=85&s=7d86e770b962c4979aad1d0162129241" alt="Configure the Beverages decision table" width="1132" height="510" data-path="get-started/dmn/img/modeler-drd-step5.png" />

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).
</Note>

## 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).
</Note>

## 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/camunda/app/cockpit) and navigate to the *Decisions* section.

<img src="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" alt="Beverages decision overview in Cockpit" width="1192" height="615" data-path="get-started/dmn/img/cockpit-decision-overview-beverages-dmn.png" />

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

<img src="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" alt="Beverages decision history in Cockpit" width="1421" height="749" data-path="get-started/dmn/img/cockpit-decision-history-beverages-dmn.png" />

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](/reference/dmn/drg)
* Explore the full [Decision Engine](/user-guide/process-engine/decisions) documentation
