Trace Query with right-click menuΒΆ

Sunflower offers 3 options to trace the execution of a query: Trace Query, Trace Query (all bindings), and Trace Query (all bindings, all explanations). When the body of a query is highlighted in the Text Editor, these 3 options automatically become enabled in the right-click menu, as shown in Fig. 240.

Right-click menu shows the 3 enabled trace query options

Fig. 240 Right-click menu shows the 3 enabled trace query options

To use these trace query options, be sure that only the body of a query is highlighted. If the label of a query is also included in the highlighted query, it will result in a parse error.

All 3 trace query options display trace results in the Query Results window.

The first option (Trace Query) selects one instantiation of the highlighted query to display, along with one selected explanation. For example, in Fig. 241, the trace results for highlighted query “Who has a brother?” is shown in the Query Results window. It shows one instantiation: Herb is a brother of Greg, along with one selected explanation for the instantiation.

**Trace Query** shows 1 selected instantiation and 1 explanation

Fig. 241 Trace Query shows 1 selected instantiation and 1 explanation

The second option is Trace Query (all bindings). It shows all instantiations for the highlighted query, and one selected explanation for each instantiation. Fig. 242 shows such an example. The 6 instantiations of the highlighted query “Who has a brother?” are shown in the Query Results window, along with a single explanation for each instantiation.

**Trace Query (all bindings)** shows all instantiations with 1 explanation each

Fig. 242 Trace Query (all bindings) shows all instantiations with 1 explanation each

Lastly, the Trace Query (all bindings, all explanations) option shows all instantiations for the highlighted query. For each instantiation, it also shows all explanations, as shown in Fig. 243. Compared to the case of Trace Query (all bindings), where only one explanation for the instantiation: Emma has brother Darryn is listed in the Query Results window, Trace Query (all bindings, all explanations) lists both explanations for the same instantiation.

**Trace Query (all bindings, all explanations)** shows all instantiations with all explanations

Fig. 243 Trace Query (all bindings, all explanations) shows all instantiations with all explanations

Results generated from the option Trace Query can be saved for regression testing with the FloraScript command CompareTraceWithFile. The use of this command is explained in Regression Testing With FloraScript and Saved Query Results.