Query and inspect your Java, Smalltalk, C and Cobol programs.
1. Open the Tools menu in the VisualWorks launcher, and select the SOUL Query Browser menu item:
2. Type a query in the edit pane of the SOUL Query Browser window:
Note that you do not have to type the 'if' keyword queries start with.
Example query for a Java program:
if ?s isStatement, ?s returnStatementHasExpression: ?e
The above query quantifies over all return statements ?s in the Java program and the expressions ?e they return. The single-argument predicate isStatement/1 and two-argument predicate returnStatementHasExpression:/2 stem from SOUL's CAVA library. This library uses a syntax that is reminiscent of the one of Smalltalk for sending messages to objects.
Example query for a Smalltalk program:
if class(?c), methodInClass(?m,?c)
The above query quantifies over all classes ?c in the Smalltalk image and their methods ?m. The single-argument predicate class/1 and two-argument predicate methodInClass/2 stem from SOUL's LiCoR library. This library uses a traditional Prolog-like syntax.
3. The query must be accepted before you can evaluate it: right click on the query to open a context menu and select Accept:
4. Select the repository in which the query has to be evaluated. The definition of the query's predicates will be looked up in the selected repository. Choose 'JavaEclipse' if you are querying a Java program. Choose 'LiCoR-Smalltalk' if you are querying a Smalltalk program.
5. Click on the 'All Results' button to compute all solutions to the query. Alternatively, the 'Next Result' button will compute one result at a time.
Having computed the solutions to the query, you are ready to inspect them.