We give an overview of the components and the execution flow that we will use in the solution. Some components will later be reused. In particular we will define a pane component that will encapsulate the Swing user interface. The same Swing user interface will be reused by the applet deployment.
We envision a slightly different flow from the terminal application. Namely the end-user will have more choices. The choices start already when providing the search criteria. Since we will have input fields for the search criteria, it will be easier for the end-user to leave a field blank. He simple does not have to click into it and provide some value. Then the choices continue since we plan to provide two buttons. One button is there to display the built query term. The other button is there to display the query result.
The above diagram only shows the flow in the context of pressing the search button which will display the query results. This can be considered the main flow. Then there is the alternative flow of the debug button which will display the built query. What is also missing in the above diagram is the initialization, which has do be done only once. In summary the application flow will work as follows:
1. The standalone application sets up the Prolog runtime.
2. The standalone application consults the Prolog code.
3. The end-user enters search criteria in the user interface panel.
4. The end-user presses the search button in the user interface panel.
5. The standalone application lets the query interpreter build the query.
6. The standalone application lets the query interpreter execute the query.
7. The user interface panel shows the result to the end-user.
8. The flow continues with step 3.
4a.1. The end-user presses the debug button in the user interface panel.
4a.2. The standalone application lets the query interpreter build the query.
4a.3. The user interface panel shows the query term to the end-user.
4a.4. The flow continues with step 3.
Although we have shown the flow in great detail here, two reservations are appropriate. First of all we have omitted any error handling scenarios and the closing of the window. Second the above flow does not show much reuse. For example the main scenario and the alternative scenario do both retrieve the search criteria and build the query. As result of these two reservations the later implemented code might look a little bit different and eventually include additional functionality.