Querying Containers

In addition to executing queries against the entire database, Proximity lets you execute queries against existing containers. In such cases, Proximity ignores the container subgraph information and merely limits query matches to the objects and links in the container. Executing a query against a container creates a new container of matching subgraphs at the top level, i.e., directly under the root container. This functionality is available through both the Proximity Database Browser and the command line query interface. You cannot execute a query against a container from the Query Editor.

The following exercise executes a query against the research-clusters2 container created in Exercise 5.3. The research-clusters2 container holds the 1d-star clusters of objects linked to research project pages. The new query searches this data to find pages from Cornell and those pages connected to the Cornell page by “out” links (links pointing from the core page to the linked page).

To execute a query against a container instead of against the full database, you can either navigate to the input container and call the query from the Proximity Database Browser as shown in Exercise 5.9, below, or specify the input container name as an optional argument to the query shell script, as shown above in Exercise 5.8. All queries run from the Query Editor are executed against the complete database.

Exercise 5.9. Querying a container from the Proximity Database Browser:

This exercise requires the container created in Exercise 5.3. You must have completed Exercise 5.3 before running the current exercise.

Before beginning, make sure that you are serving the ProxWebKB database using Mserver. Start the Proximity Database Browser if it is not already running.

  1. Click Home to go to the Proximity Database Browser start page.

  2. Click Containers. Proximity displays the current list of containers in the database.

  3. Click research-clusters2. Proximity displays the research-clusters2 container page.

  4. Click query. Proximity displays the Open dialog.

  5. Navigate to the $PROX_HOME/doc/user/tutorial/examples directory and choose the query cornell-out-clusters.qg2.xml.

  6. Click Open. Proximity prompts you for a name for the results container. Enter cornell-out-clusters and click OK.

    [Caution]

    If the database already includes a container with this name, Proximity asks whether you want to delete the existing container. Answering yes lets Proximity overwrite the contents of this container. This also deletes any containers inside the existing container.

    Proximity opens a window to show you a trace of the query execution. The last lines should be similar to the following excerpt (leading information showing elapsed time and execution thread has been omitted from the trace for brevity):

    INFO kdl.prox.qgraph2.QueryGraph2CompOp - -> found 99 subgraphs
    INFO kdl.prox.qgraph2.QueryGraph2CompOp - -> query results saved in
       container: cornell-out-clusters
    INFO kdl.prox.qgraph2.QueryGraph2CompOp - * query: done
    Status: finished running query
    

    Close this window after the query finishes.

  7. Explore the results of the cornell-out-clusters container.

Executing the query creates a new, top-level container of 99 subgraphs using data in the original container of 83 subgraphs. Remember that Proximity uses the input container simply to limit the database items considered in executing the query; it does not use the existing subgraph information as part of this process. Therefore, the subgraphs identified as a result of executing this query are not related to those found by the query that initially created the input container. The new query does not require that its core_page object be a research project page, only that the school attribute have Cornell as a value. Thus the resulting subgraphs may have little resemblance to those in the input container.