blob: affdd7054bacfae90f6e23f2e2f94e5d64d43ce8 [file] [log] [blame]
[[_drools.guideddecisiontreeeditor]]
= Guided Decision Trees
The Workbench supports authoring of simple Decision Trees.
[NOTE]
====
The editor does not support nested Data Objects at present.
It is therefore advised to only use Guided Decision Trees with flat Data Object models.
====
== The initial editor layout
When a new Guided Decision Tree is created the editor is initially blank.
The left-hand side is a palette of available Data Objects, their fields and Actions.
The right-hand side is the area where you can drag and drop Data Objects, their fields or Actions to build a tree.
The editor will show a connector between the node being dragged and applicable children to which it can be attached.
When the drag is complete the new node will be attached to the applicable child.
Root nodes will not have a connector shown when being dragged to an empty tree.
Completing the drag positions the root node in the centre of the editor.
There are various restrictions when composing a tree:-
. A tree must have a Data Object at the root.
. A tree can only have one root.
. Data Objects can have either other Data Objects, field constraints or Actions as children.
+
The field constraints must be on fields of the same Data Object as the parent node.
. Field constraints can have either other field constraints or Actions as children.
+
The field constraints must be on fields of the same Data Object as the parent node.
. Actions can only have other Actions as children.
.Guided Decision Trees - Empty editor
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditor1.png[align="center"]
Expanding the palette reveals Tree Nodes for the Data Object and its fields.
.Guided Decision Trees - Expanded palette
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditor2.png[align="center"]
== First steps
Drag a Data Object on to the tree authoring area.
.Guided Decision Trees - Data Object root node
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditor3.png[align="center"]
Clicking on a node selects it.
Icons to manipulate the node appear when the node is selected.
The icons are:
. Delete
+
Deleting a node will also delete all children.
. Edit
+
Collapsed nodes cannot be edited as they contain numerous children.
. Collapse
.Guided Decision Trees - Selected node
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditor4.png[align="center"]
== Editing Data Object nodes
Selecting a Data Object node and clicking the edit icon shows a popup to manage the node.
The popup shows the Data Object type and allows it to be bound to a variable.
Bound Data Objects can be modified or retracted by Actions.
.Guided Decision Trees - Data Object Editor
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditor5.png[align="center"]
== Editing Field Constraint nodes
Selecting a Field Constraint node and clicking the edit icon shows a popup to manage the node.
The popup shows the Data Object type and field and allows the field to be bound to a variable.
An operator, applicable to the Data Model field's data-type, can be selected and a corresponding value entered.
.Guided Decision Trees - Field Constraint Editor
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditor6.png[align="center"]
== Editing Action nodes
Selecting an Insert Action node and clicking the edit icon shows a popup to manage the node.
The popup allows selection of the Data Object to be inserted and whether it's insertion is "logical". Please refer to Drools documentation regarding Truth Maintenance for more information.
Fields for the new Data Object can have values set.
.Guided Decision Trees - Action "Insert" Editor
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditorActionInsert.png[align="center"]
Selecting an Insert Retract node and clicking the edit icon shows a popup to manage the node.
The popup allows any Data Object bound in the path from the selected node to the root node to be selected for retraction.
.Guided Decision Trees - Action "Retract" Editor
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditorActionRetract.png[align="center"]
Selecting an Insert Update node and clicking the edit icon shows a popup to manage the node.
The popup allows any Data Object bound in the path from the selected node to the root node to be modified.
Fields for the modified Data Object can have values set.
.Guided Decision Trees - Action "Update" Editor
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditorActionUpdate.png[align="center"]
== Managing the tree
Even simple trees can grow in size and become difficult to maintain.
It is therefore possible to collapse parts of the tree, giving more space in the user interface to maintain different parts of the tree.
If a node has children, when selected, it will have an icon to collapse the children.
Clicking this icon will collapse children.
A collapsed node can equally be expanded by selecting it and clicking on the exapnd icon.
A collapsed node cannot be edited as it contains numerous children.
Deleting a collapsed node deletes all children too.
.Guided Decision Trees - Collapsing nodes
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditorCollapse1.png[align="center"]
.Guided Decision Trees - Collapsed node
image::Workbench/AuthoringAssets/GuidedDecisionTreeEditorCollapse2.png[align="center"]