Executing a Query from the Proximity Database Browser

In addition to executing queries from the Query Editor, you can execute previously saved queries directly from the Proximity Database Browser. The following exercise executes the query shown below to find, for every object (web page) in the database, the 1d-cluster of objects directly connected to that core object.

This is another example of the common 1d-star query. The query places no restrictions on the core object or on any related objects—that is, there are no conditions or constraints. Additionally, the use of the [0..] annotation on the linked_from_page and linked_to_page vertices makes these matches optional. By having no conditions or constraints and making the linked objects optional, we ensure that the query will return a subgraph for every object in the database.

Note that this query distinguishes links pointing to the core object from links leaving the core object, and thus defines two types of related objects: linked_from_page, those objects that link to the core object, and linked_to_page, those objects that are linked to by the core object. The matching subgraphs retain these vertex labels, allowing you to identify and use each type of linked object independently when learning and applying models. If this distinction were not important, we could have instead used a simpler query of two vertices connected by an undirected edge.

Exercise 5.7. Executing a saved query from the Proximity Database Browser:

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. If you have not already done so, copy graph-query.dtd from $PROX_HOME/resources to the directory containing the example queries.

    > cp $PROX_HOME/resources/graph-query.dtd $PROX_HOME/doc/user/tutorial/examples/
    

  2. From the Query menu, choose Run Query. Proximity displays the Open dialog.

  3. Navigate to the $PROX_HOME/doc/user/tutorial/examples directory and choose the query 1d-clusters.qg2.xml.

    You can create shortcuts to commonly used directories for easier access to query files. Shortcuts appear in the Shortcuts pane of the Open dialog. See Creating a file or directory shortcut for information on creating shortcuts.

  4. Click Open. Proximity prompts you for a name for the results container. Enter 1d-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 4135 subgraphs
    INFO kdl.prox.qgraph2.QueryGraph2CompOp - -> query results saved in
       container: 1d-clusters
    INFO kdl.prox.qgraph2.QueryGraph2CompOp - * query: done
    Status: finished running query
    

    Close this window after the query finishes.

  5. Explore the 1d-clusters container. Note that because we used the [0..] annotation on the linked objects making them optional for the match, some subgraphs contain only a single object.