This section describes the basic features of JQuery.
Creating a new query tab
You can create a query tab for as many working sets as you want. You are limited by the amount of memory in your system, so it is recommended that only two or three tabs be used at the same time. To create a new query tab:
Click on the icon or select New Query Tab from the drop down menu (). This will bring up a working set selector in which you can select/create/edit the working set that this query tab will operate on.
Warning: Only select the code that you want to be able to query. Do not select an entire project or large library jar files (unless you want to query on those files). It can take a very long time and use a lot of memory to parse a huge number of files.
It is recommended that you first parse your codebase and then edit your working set to include only the class files that you need (i.e the class files in java.lang or java.util in rt.jar).
Select a working set and click OK. The query tab will then show up. Depending on the size of the codebase in your working set it may take a few seconds for it to show up.
Right-click in the tree subtab to start updating the database.
As a query tab is linked to a working set, you can change the working set for a query tab to add or remove files. To do this:
Select Edit Tab's Working Set from the drop down menu (). This will bring up a working set editor in which you can modify the working set.
After you have finshed modifying the working set, click on Finish.
Right-click in the tree subtab to start updating the database. This will only cause new files to get parsed. You will still have to re-execute any queries you currently have in order to make the new results show up.
To close a query tab, click on the icon on the tab or select Close Query Tab from the drop down menu ().
Note: Closing a query tab does not delete any of the data in the JQuery database for that tab. If you re-create a query tab for a working set for which you had a previous query tab, it will load the old one. If you actually want to delete the data, follow the instructions for "Clearing all JQuery data".
To run a top-level query:
Right-click on the tree subtab of the query tab.
Select Avaliable Top-Level Queries and then the top-level query you want.
To run a sub-query:
Right-click on the element that you want to run a sub-query on.
Select one of the query options from the menu.
To write your own top-level query:
Right-click on the tree subtab of the query tab.
Select New Top-Level Query... and then write your query using the query editor.
To write your own sub-query:
Right-click on the element that you want to run a sub-query on.
Select New Sub-Query... and then write your query using the query editor.
For more information on the query editor, see the section on Editing a query.
To re-exectute a query:
Right-click on the icon for the query you want to re-execute.
Select Re-execute Query from the menu that pops up.
If you notice that a query is taking far too long to execute, you can stop it by clicking on the icon or selecting Stop Query from the drop down menu ().
To edit a query:
Double-click on the icon for the query you want to edit or right-click on it and select Edit Query from the context menu. This brings up the query editor.
Modify the query:
Query Name - The name that will show up on the query node in the tree.
Query - The query to be run. You can right-click on this text box to get a list of predicates that you can insert into your query.
Order of variables - The hierarchical order of the results. To initially populate this list from your query, click on Get Vars. You can change the order in which the variables are displayed by selecting them and using the Move Up and Move Down buttons. To hide a particular variable from the results, uncheck the checkbox for that variable and it will not show up in the tree.
Click OK to run the edited query.
To delete a query:
Right-click on the icon for the query you want to delete.
Select Delete Query from the menu that pops up.
It is possible for the JQuery database to become corrupted from a system crash or an incorrect shutdown of Eclipse. In most cases JQuery will recover by itself, but if you find that the data being returned from queries looks corrupted you can force JQuery to reparse your working set and refresh its database:
Select "Force Complete Refresh" from the drop down menu ().
Right-click in the tree subtab to start updating the database. A complete refresh can take up to twice as long as an initial update.
You may find that you have created query tabs for working sets that you aren't using anymore and that too much data is currently in the JQuery database. You can reset JQuery to its initial state which will delete all query tabs and any queries that you have done by doing the following:
Close Eclipse.
Remove the ca.ubc.jquery directory from the .metadata directory in your workspace.
Restart Eclipse. Any query tabs that you were currently working on will have dissapeared as well as any rules files or fact libraries that you have added (you will have to re-add them).
|