Changes between Version 17 and Version 18 of WebInterface/RunningSemanticQueries


Ignore:
Timestamp:
Dec 10, 2012, 11:14:42 PM (12 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WebInterface/RunningSemanticQueries

    v17 v18  
    100100 
    101101Only the owner of a skeleton can edit or delete it. 
     102 
     103 
     104 
     105 
     106{{{#!comment 
     107 
     108= Running semantic queries = 
     109This service is available under the ”Queries” menu. 
     110 
     111[[Image(webinterface_queries.jpg)]][[BR]] 
     112 
     113''Web interface after running a query from the y record field definition.'' 
     114 
     115== Constructing semantic queries == 
     116To learn more about semantic queries see the [SemanticQuery Semantic Queries page]. 
     117 
     118The query construct assistant is located in the 'Queries' tab. 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. 
     119 
     120Pressing ”Run” evaluates the query and displays the result. 
     121== Starting queries == 
     122 
     123'''Before browsing source files, it is recommended to pre-generate them from the [wiki:WebInterface#Browsingloadedfiles File browser].''' 
     124 
     125A file browser is placed at the right side of the page. A file can be viewed by clicking on it. 
     126You can also filter files in the filter textbox. The filter can contain the * (any number) and ? (only one) wildcards for unknown characters. 
     127 
     128You can set a starting point for a query in two ways: 
     129* Selecting a region or pointing at a position in the shown code. 
     130* Clicking on a node (bold text) - the selected node will be highlighted.  
     131Note that, the forms which contain errors are not clickable.  
     132 
     133After selecting a node you can either: 
     134* Run pre-defined queries from that node from the now shown context menu - the result of these won't appear in the ’previous queries’ tab. 
     135* Run previously made queries for that node type by selecting one from the ”Choose previous query” dropdown box. 
     136* Run a query from the query construct assistant text-box (either from the context menu or the Queries tab), which will start from that node. 
     137* Start a new investigation (beta feature) from the clause the selected node is in.  
     138 
     139The 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. 
     140 
     141[[Image(webinterface_prevqueries.jpg, right)]][[BR]] 
     142== Previous Queries == 
     143 
     144For your convenience, the interface stores previously executed queries and their results, which are listed at the left side of the page under the ”Queries” tab. You can either choose to list only queries which belong to the current user, or all queries stored in the system. 
     145 
     146Clicking 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. 
     147 
     148Users can delete their own queries from the list by clicking the corresponding ”X” icon. 
     149 
     150By 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. 
     151 
     152You 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. 
     153This is useful, because named queries can be identified easier, and are also more readable. 
     154The actual query string can still be shown by clicking the ’?’ icon. 
     155 
     156Users can add or modify a comment on any query by clicking the corresponding ”C” icon. 
     157== Running Queries == 
     158The list of currently running queries are displayed anytime in the ”Queries” tab. The list is updated every second. A running query (started by the current user) can be aborted by pressing the corresponding ’X’ icon. The user is notified about the success of the abort. 
     159== Displaying the result of queries == 
     160The results of the last query are displayed at the left side of the page under the ”Last Result” tab. Clicking on an entry shows that result by either selecting the result node or highlighting the result depending on that node being selectable or not. 
     161You can also hide/show groups of results for an easier overview. 
     162Metric results can also be ordered by name or value. 
     163== Skeleton of queries == 
     164Large amounts of queries are similar to each-other. The only difference is usually the actual value of their filter parameter or the used sub-query. Some examples are shown below. 
     165 
     166{{{ 
     167mods[name = a].funs[(name = f) and (arity = 2)].refs  
     168mods[name = b].funs[(name = g) and (arity = 3)].refs 
     169}}} 
     170 
     171or 
     172 
     173{{{ 
     174mods.funs[arity = 2]  
     175mods.funs[exported and is_tail_rec] 
     176}}} 
     177 
     178A new abstract level is introduced, where these queries are not only similar to each-other, but are equal, we called these Skeletons. They are actually queries with parameters. Examples are shown below. 
     179 
     180{{{ 
     181mods[name = $ModName$].funs[name = $FunName$ and arity = $Arity$].refs 
     182mods.funs[$FunSubQuery$] 
     183}}} 
     184== Usage of skeletons == 
     185A skeleton can be constructed by typing its body into the query construct assistant, then clicking the ’Save as skeleton’ button. The desired name of the skeleton can be typed in the appearing textbox. The skeleton can then be saved by clicking the ’Save’ button. If any error occurs during saving, an error message is shown. 
     186 
     187A previously saved skeleton can be evaluated like a function by filling it's actual parameter values. A valid parameter cannot contain the {{{`}}} character (back-tick), because the {{{`}}} character is the delimiter of the parameter values. Auto-complete in the query textbox also offers skeleton names. 
     188 
     189An example of a valid skeleton is shown below: 
     190 
     191{{{ 
     192Name: skeleton_name 
     193Body: mods.funs[$FunSubQuery$] 
     194Call: skeleton_name(` (arity>0) and (name like s) `). 
     195}}} 
     196 
     197Constructed skeletons are listed under the ’Queries’ tab, when selecting Skeletons from the dropdown box. 
     198 
     199[[Image(webinterface_skeletons.jpg, right)]][[BR]] 
     200When clicking on a skeleton, a valid ’skeleton call’ will be placed in the query construct assistant, where the actual parameters should be filled out (spaces between `` characters). 
     201 
     202After 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 as usual. 
     203 
     204By clicking the ? icon, the body and owner of the corresponding skeleton will be shown. 
     205 
     206By clicking the corresponding ’E’ icon, you can edit the body of the skeleton in the query construct assistant. Clicking the ’Update skeleton’ button will update the body of the skeleton. 
     207 
     208By clicking the corresponding ’X’ icon, the skeleton will be deleted. 
     209 
     210Only the owner of a skeleton can edit or delete it. 
     211 
     212 
     213}}}