Version 3 (modified by manualwiki, 13 years ago) (diff) |
---|
Semantic queries
This service is available under the ”Queries” menu.
Constructing semantic queries
The query construct assistant is located at the top-left corner of the page. While typing a query the interface offers possible continuations for uncompleted sub-terms. An offered option can be chosen from a drop-down list. This auto-complete mechanism helps new RefactorErl users using the language, and also all developers to speed up query constructions and avoiding constructing wrong queries.
Pressing ”Run” evaluates the query and displays the result.
Starting queries
A file browser is placed at the left side of the page under the ’File browser’ tab. A file can be viewed by clicking on it. You can set a starting point for a query in two ways:
- Selecting a region or pointing at a position in the shown code. You can only start queries from the query construct assistant this way.
- Clicking on a node (bold text) - the selected node will be highlighted.
After selecting a node you can either:
- Run pre-defined queries for that node from the top-right corner of the screen - the result of these won't appear in the ’previous queries’ tab.
- Run previously made queries for that node type by selecting one from the Choose previous query dropdown box.
- Run a query from the query construct assistant text-box, which will start from that node.
The first result of the query will be shown (if there was any). Results can be browsed with the appearing Prev and Next buttons. The total number of results as well as the currently shown result's number are displayed under those buttons. You can also select results from the ”Last result” tab.
Previous Queries
For your convenience, the interface stores previously executed queries and their results, which are listed at the left side of the page under the ”Previous Queries” tab. You can either choose to list only queries which belong to the current user, or all queries stored in the system.
Clicking a previous query the interface first examines if the database has changed since that query was last run. If there were no changes, the stored result is displayed, otherwise the query is re-executed, the stored result is updated, and the new result is displayed.
Users can delete their own queries from the list by clicking the corresponding ”X” icon.
By clicking the corresponding ”?” icon, the query string and previously added comments are shown. If the query was started from a position, the starting file and position are also shown.
You can rename a query by clicking on the corresponding ’E’ icon, writing a new name in the appearing text-field, then pressing the ’Save’ button. This is useful, because named queries can be identified easier, and are also more readable. The actual query string can still be shown by clicking the ’?’ icon.
Users can add or modify a comment on any query by clicking the corresponding ”C” icon.
Running Queries
The list of currently running queries is displayed at the left side of the page at ”Running Queries” tab. The list is updated in every second. A running query,which has been started by the current user, can be aborted by pressing the corresponding X icon. The current user, who started the query, is notified about the success of the abort.
Displaying the result of queries
Results are displayed at the left side of the page at ”Last Result” tab in a table. The source of the entries of the result’s can be visualised by clicking on the given entry in the detail. If the source is loaded to the database, it will be shown in a text-box located to the right of the table. The part of the source code responsible for the entry will be highlighted in the text-box.
Skeleton of queries
Large amount of queries are similar to each-other. The difference usually originates from the actual value of their filter parameter or from the used sub-query. Examples are shown below.
mods[name = a].funs[(name = f) and (arity = 2)].refs mods[name = b].funs[(name = g) and (arity = 3)].refs
or
mods.funs[arity = 2] mods.funs[exported and is_tail_rec]
A new abstract level is introduced, where those queries are not only similar to each-other, but those queries do equal to each-other, we called it Skeleton. Examples are shown below.
mods[name = $ModName$].funs[name = $FunName$ and arity = $Arity$].refs mods.funs[$FunSubQuery$]
Usage of the skeleton
The service of the skeletons is available under ’Queries’ menu. A skeleton can be constructed by typing its body, which observes the rules of the valid skeleton, into the query construct assistant, than ’Save as skeleton’ button should be pressed. By pressing the ’Save as skeleton’ button, a dialogue box appears, where the wanted name of the constructed skeleton should be typed. By clicking the ’Save’ button, which is placed in the dialogue box, the skeleton will be saved. The constructed skeleton appears in the list of available skeletons, which is located at the ’Skeletons’ tab, whether the save was success. If any error occurs during the save, an error message will be shown.
A previously saved skeleton can be evaluated by calling as a function with the actual values of the parameters. A valid actual parameter can contain nearly anything, only the ’ character is needed to avoid, because the ’ character is the delimiter of the value of an actual parameter. Auto-complete does not only offer the possible endings, but also does offer the joint skeletons.
A valid skeleton call is shown below:
Name = skeleton_name Body = mods.funs[$FunSubQuery$] skeleton_name(’ (arity>0) and (name like s) ’).
Previously saved skeletons are listed at ’Skeletons’ tab.
By clicking the name of the skeleton, a valid ’skeleton call’ will be placed in the query construct assistant, where the actual parameters should be written by replacing character with the corresponding parameter value.
By clicking the ? icon, the body of the skeleton and the owner of the skeleton will be shown.
After a successful evaluation of a skeleton, the generated semantic query string and its result are saved in the ’Previous queries’ list, and the result of the semantic query will be shown in the right side of the page.
Only the owner of the skeleton can edit its body, or can delete it.
By clicking the corresponding ’E’ icon, the body of the skeleton will be placed into the query construct assistant. After the necessary changes had been made then the ’Update skeleton’ button has been pressed, the body of the skeleton will be updated.
By clicking the corresponding ’X’ icon, the skeleton will be deleted.
Attachments (3)
- webinterface_queries.jpg (83.2 KB) - added by manualwiki 12 years ago.
- webinterface_skeletons.jpg (32.7 KB) - added by manualwiki 12 years ago.
- webinterface_prevqueries.jpg (32.4 KB) - added by manualwiki 12 years ago.
Download all attachments as: .zip