In addition to executing queries from the Proximity Database Browser and Query Editor, you can execute saved queries from the command line using the query.sh shell script (Linux/Mac OS X) or query.bat (Windows) batch file.
Exercise 5.8. Executing a query from the command line:
This exercise re-runs the research-clusters2 query.
You can use either the rc2.qg2.xml query you
created in Exercise 5.3 or the
research-clusters2.qg2.xml query included with
the distribution in $PROX_HOME/doc/user/tutorial/examples.
The query results will overwrite the existing research-clusters2
container. Specify a different container name
if you want to keep your original
research-clusters2 container.
![]() |
|
|
When executing queries from the Proximity Database Browser or Query Editor, Proximity prompts you to confirm overwriting an existing container. Proximity does not provide a similar prompt when executing queries from the command line and instead silently overwrites the existing container. |
Before beginning, make sure that you are serving the ProxWebKB database using Mserver.
Execute the query.sh shell script or query.bat batch file, specifying
host:portthe Monet server’s
host and port (localhost:30000 if you are
running the Monet server on your local machine and did not
explicitly set the port to a different value on the command line)
queryXMLFilethe file containing the saved query; use either your
rc2.gq2.xml query or the query listed
below
collectionNamethe name of the results container
inputContainer[optional] the name of the input container— the container to search when finding matches for the query
The optional inputContainer defaults to the
root container (the entire database) if it is
omitted. To explicitly
specify the input container, Proximity uses a path-like syntax that
reflects the container hierarchy for the specified
container. Container names are separated by forward slashes with the
initial / representing the root container. For
example, /c1/c2 signifies container
“c2”, which is under
container “c1”, which in
turn is under the root container. All
container paths are absolute in this sense—they all must include
an initial slash indicating the root container. Do not include a
trailing “/”.
See the “Querying Containers” section, below, for
more information on querying containers.
In the command lines below, substitute the appropriate host and port information if you are running the Monet server on a different machine or are using a different port.
>cd $PROX_HOME>bin/query.sh localhost:30000 \ $PROX_HOME/doc/user/tutorial/examples/research-clusters2.qg2.xml \ research-clusters2
Proximity writes the execution trace to the window in which you executed the above command. The last lines should be similar to the following excerpt (leading information showing elapsed time has been omitted from the trace for brevity):
INFO qgraph2.QueryGraph2CompOp: -> found 83 subgraphs INFO kdl.prox.qgraph2.QueryGraph2CompOp - -> query results saved in container: research-clusters2 INFO qgraph2.QueryGraph2CompOp: * query: done INFO app.Query: * done executing query