Working with Queries

To edit an existing query:

You can load an existing (previously saved) query in the Query Editor. Editing an existing query is often an efficient way to create similar queries. You can elect to edit a saved query from either the Proximity Database Browser or from within the Query Editor.

To edit a saved query from the Proximity Database Browser:

  1. From the Query menu, select Edit Query. Proximity displays the Open dialog.

  2. Navigate the the directory containing the query file. Select the query to be edited and press OK.

To edit a saved query from the Query Editor:

  1. In the File menu, choose Open or press Ctrl-O. Proximity displays the Open dialog.

  2. Navigate the the directory containing the query file. Select the query to be edited and press OK.

Proximity displays the selected query in the Query Editor display area.

To add a constraint:

Because constraints compare the identity or attribute values of two different query elements, constraints are properties of a query as a whole rather than of any individual query element.

  1. In the Constraints area at the bottom of the query properties pane, click Add. The Query Editor adds a temporary, example constraint, shown in the query properties pane.

  2. Edit the temporary, example constraint to show the correct constraint.

  3. Press Tab or Return.

To delete a constraint:

  1. Select the constraint you want to delete by clicking the corresponding entry in the query properties pane’s Value column.

  2. In the Constraints area, click Remove. The Query Editor deletes the selected constraint.

To add query information:

To help you remember the purpose of or other information about a query, you can save meta-information with your query. The XML query format supports saving a name and description for each query.

To add a query name:

  1. In the query properties pane, click the value for Name.

  2. Change the value to the new query name.

  3. Press Tab or Return.

To add a query description:

  1. In the query properties pane, click the value for Description.

  2. Change the value to the correct query description.

  3. Press Tab or Return.

To save a query:

It is frequently useful to save a query for future use. Saved queries are written out to an XML file. The Query Editor understands this XML format and can reload saved queries for future use or editing. Make sure that your query is valid before saving it—invalid queries may not be saved correctly or may not display correctly in the Query Editor when reloaded.

Once a query has been saved to an XML file, you can save any new changes by selecting Save or pressing Ctrl-S.

To validate a query:

The Query Editor checks only that the query is syntactically correct; it cannot verify semantic information. For example, it reports an error if the query is disconnected but cannot check whether attributes listed in conditions or constraints actually exist in the database.

A query must be valid before it can be executed. Additionally, invalid queries may not be correctly displayed in the Query Editor when reloaded after saving. The Query Editor’s status list shows whether the currently displayed query is valid or not. Check the status bar before executing or saving queries.

If the status list shows one or more errors, click the up/down arrows to the right of the status list to display the specific errors for this query. Fix any errors before executing or saving the query.

To execute a query:

You can execute queries from the Proximity Database Browser or from within the Query Editor.

To execute the current query (Query Editor):

  1. In the File menu, choose Run or press Ctrl-R. Proximity asks you to provide a name for the container that will hold the query’s results.

  2. Enter a name for the container and press OK. Proximity prints a trace of the query’s execution in a new window.

  3. Close the trace window after query execution completes and you have finished examining the trace.

To execute a saved query (Proximity Database Browser):

  1. From the Query menu, select Run Query. Proximity asks you to provide a name for the container that will hold the query’s results.

  2. Enter a name for the container and press OK. Proximity prints a trace of the query’s execution in a new window.

  3. Close the trace window after query execution completes and you have finished examining the trace.