# Interactive Consultant¶

The Interactive Consultant tool enables experts to digitize their knowledge of a specific problem domain. With the resulting knowledge base, an online interface is automatically created that serves as a web tool supporting end users to find solutions for specific problems within that knowledge domain.

The tool uses source code in the IDP-Z3 language as input. However, there are some specific changes and additions when using IDP-Z3 in the Interactive Consultant, which are explained further in this chapter.

## Display¶

The display block configures the user interface of the Interactive Consultant. It consists of a set of display facts, i.e., predicate and function applications terminated by ..

The following predicates and functions are available:

expand

$$expand(s_1, .., s_n)$$ specifies that symbols $$s_1, .., s_n$$ are shown expanded, i.e., that all sub-sentences of the theory where they occur are shown on the screen.

For example, expand(Length). will force the Interactive Consultant to show all sub-sentences containing Length.

hide

$$hide(s_1, .., s_n)$$ specifies that symbols $$s_1, .., s_n$$ are not shown on the screen.

For example, hide(Length). will force the Interactive Consultant to not display the box containing Length information.

view

view = normal. (default) specifies that symbols are displayed in normal mode.

view = expanded. specifies that symbols are displayed expanded.

relevant

$$relevant(s_1, .., s_n)$$ specifies that symbols $$s_1, .., s_n$$ are relevant, i.e. that they should never be greyed out.

Irrelevant symbols and sub-sentences, i.e. symbols whose interpretation do not constrain the interpretation of the relevant symbols, are greyed out by the Interactive Consultant.

goal
$$goal(s)$$ specifies that symbols $$s$$ is a goal, i.e. that it is relevant and shown expanded.
moveSymbols

When the display block contains moveSymbols., the Interactive Consultant is allowed to change the layout of symbols on the screen, so that relevant symbols come first.

By default, the symbols do not move.

optionalPropagation

When the display block contains optionalPropagation, a toggle button will be available in the interface which allows toggling immediate propagation on and off.

By default, this button is not present.

## Vocabulary annotations¶

To improve the display of functions and predicates in the Interactive Consultant, they can be annotated with their intended meaning, a short comment, or a long comment. These annotations are enclosed in [ and ], and come before the symbol declaration.

Intended meaning
[this is a text] specifies the intended meaning of the symbol. This text is shown in the header of the symbol’s box.
Short info
[short:this is a short comment] specifies the short comment of the symbol. This comment is shown when the mouse is over the info icon in the header of the symbol’s box.
Long info
[long:this is a long comment] specifies the long comment of the symbol. This comment is shown when the user clicks the info icon in the header of the symbol’s box.

## Environment¶

Often, some elements of a problem instance are under the control of the user (possibly indirectly), while others are not.

To capture this difference, the IDP language allows the creation of 2 vocabularies and 2 theories. The first one is called ‘environment’, the second ‘decision’. Hence, a more advanced skeleton of an IDP knowledge base is:

vocabulary environment {
// here comes the specification of the vocabulary to describe the environment
}

vocabulary decision {
extern vocabulary environment
// here comes the specification of the vocabulary to describe the decisions and their consequences
}

theory environment:environment {
// here comes the definitions and constraints satisfied by any environment possibly faced by the user
}

theory decision:decision {
// here comes the definitions and constraints to be satisfied by any solution
}

structure environment:environment {
// here comes the interpretation of some environmental symbols
}

structure decision:decision {
// here comes the interpretation of some decision symbols
}

display {
// here comes the configuration of the user interface
}

## Default Structure¶

The default structure functions similarly to a normal Structure, in the sense that it can be used to set values of symbols. However, these values are set as if they were given by the user: they are shown in the interface as selected values. The symbols can still be assigned different values, or they can be unset.

In this way, this type of structure is used to form a default set of values for symbols. Such a structure is given the name ‘default’, to denote that it specifies default values. The syntax of the block remains the same.

structure default {
// here comes the structure
}