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 query component that will encapsulate the knowledgebase setup, the query building and the query execution. Further there is a data component with the Prolog text of the queried table. Both components will be used across all the deployment scenarios.
We envision the terminal application as providing use two functions. It should us show how a query is built and it should us provide the results to a query execution. The terminal application should interact with the end-user solely by means of the standard input and the standard output. These two streams are directly accessed from Java system environment and not mediate by the Jekejeke Prolog interpreter.
In summary the application flow will work as follows:
1. The terminal application sets up the Prolog runtime.
2. The terminal application consults the Prolog code.
3. The terminal application asks the end-user for the search criteria.
4. The terminal application lets the query interpreter build the query.
5. The terminal application shows the query term to the end-user.
6. The terminal application lets the query interpreter execute the query.
7. The terminal application shows the result to the end-user.
8. The terminal application tears down the
Including a tear down step is a good practice. It might be that
the main routine of the Java class is called without exiting the
current process. In case the current process does not exit the
knowledge base will be reclaimed by the Java garbage collection
since there will be no more local variable referencing it. The
Prolog runtime might nevertheless have held resources, which are
only freed if the tear down procedure is called.