-
-
- Using the Prolog IDE
-
-
-
Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
The Prolog Console View lets you
The Prolog Console offers a unified entry point for interacting with different Prolog processes. The name of the current Prolog process is always displayed in the top left corner of the Console. If no current Prolog Process is selected, the process selector (first button in the Prolog Console's toolbar) displays a yellow warning triangle:
With the buttons in the toolbar of the Prolog Console you can:
If you want to restart a process there are three possible ways to handle the reconsulting of files.
A query is typed at the Console's prompt and terminated with a full-stop ('.'). Hitting <enter> after the full stop issues the query to the Prolog system and displays the results (if any). If there are multiple resultes, the Console background will turn yellow to indicate that the Console is waiting for user directives as whether to continue or terminate the query. Typing semicolon(';') or simply hitting the space bar displays the next result or 'false', if there are no more results. Hitting <enter> or typing 'a' aborts the query.
If you started a query that does not seem to stop you can try one of the following:
To trace a query from the very start, just prepend “trace,
” to your query (e.g. type “trace, p(X,Y).
”).
This will open by default the GUI tracer.
The Prolog Console supports code completion using the key binding <Ctrl><Space> or <TAB>. The following elements are shown in the completion:
the following table shows some examples for the completion (click on the images to enlarge).
The Prolog Console View supports a history mechanism (see keyboard shortcuts).
If you manually consulted multiple files into a Prolog process you can click the button on the right-hand-side of the Console's toolbar to create a file that will load all manually consulted files. Of course, you can edit it manually afterwards. Load file creation is handy if you want to consult the same set of files in a different process or after restarting Eclipse. It avoids errors otherwise caused by forgetting to (re)load certain recently created files.
By default, the created load file will be marked as an entry point.
If you click the arrow on the right side of the toolbar you can use some of the graphical tools of SWI-Prolog:
In addition to the usual editing operations (Select All, Copy, Cut, Paste) the context menu of the Prolog Console lets you paste the complete path of the file that is open in the currently active Prolog Editor. This is very helpful if you want to set breakpoints manually, for example.
Sometimes you find a predicate name in the console and you want to use it in a search query. This happens for example if you have some undefined predicate and you want to find all references to it. For this you can mark the predicate name in the console and select “Open Search Dialog” from the context menu. The Prolog Search dialog will be opened and it will get the current selection of the console as input.
SWI-Prolog reports warnings and errors while consulting a file. If the location is given, the prolog console links the message to the location, where the problem occurs.
The Prolog Console appearance can be configured in the PDT Preferences via Window → Preferences → PDT → Prolog Console → Appearance: