Use the OGSA-DQP command-line client

OGSA-DQP comes with a simple command-line client that allows you to create DQP resources, get the imported schemas and run queries.

This is not a fully-functional application. Rather it is intended purely to be used as an aid to demonstrating what DQP can do.

Build the client

Change into the OGSA-DQP client directory:

$ cd ogsadqp-3.2.1-od30port/client

Build the client:

Create a DQP resource

To ask a coordinator to create a DQP resource, run:

$ cd ogsadqp-3.2.1-od30port/client
$ ant factory -Ddqp.config.file=CONFIG-FILE -Durl=SERVER-URL -Dresource.id=RESOURCE-ID 

Where:

For example, for OGSA-DAI Axis 1.2.1:

$ cd ogsadqp-3.2.1-od30port/client
$ ant factory -Ddqp.config.file=../examples/test-dqpconfig-axis121.xml \
-Durl=http://localhost:8080/dai/services/ \
-Dresource.id=DQPFactoryResource

For example, for OGSA-DAI GT 4.0.5:

$ cd ogsadqp-3.2.1-od30port/client
$ ant factory -Ddqp.config.file=../examples/test-dqpconfig-axis121.xml \
-Durl=http://localhost:8080/wsrf/services/dai/
-Dresource.id=DQPFactoryResource

If all goes well a new DQP resource will be created and the ID of this resource will be printed by the clien.

Get the imported schemas property

Run the following in the client directory of the OGSA-DQP distribution:

$ cd ogsadqp-3.2.1-od30port/client
$ ant getschemas -Durl=SERVER-URL -Dresource.id=RESOURCE-ID

Where:

For example, for OGSA-DAI Axis 1.2.1:

$ cd ogsadqp-3.2.1-od30port/client
$ ant getschemas -Durl=http://localhost:8080/dai/services/ \
-Dresource.id=ogsadai-12345

For example, for OGSA-DAI GT 4.0.5:

$ cd ogsadqp-3.2.1-od30port/client
$ ant getschemas -Durl=http://localhost:8080/wsrf/services/dai/
-Dresource.id=ogsadai-12345

Execute a query

$ cd ogsadqp-3.2.1-od30port/client
$ ant query -Durl=SERVER-URL -Dresource.id=RESOURCE-ID -Dclient.query=QUERY

Where:

For example, for OGSA-DAI Axis 1.2.1:

$ cd ogsadqp-3.2.1-od30port/client
$ ant getschemas -Durl=http://localhost:8080/dai/services/ \
-Dresource.id=ogsadai-12345 \
-Dclient.query="SELECT goterm_goterm.name FROM \
 proteinterm_protein_goterm, goterm_goterm WHERE \
 proteinterm_protein_goterm.GOTermIdentifier=goterm_goterm.id \
 AND proteinterm_protein_goterm.ORF='YBL037W' \
 AND goterm_goterm.name LIKE 'vesicle%';"

For example, for OGSA-DAI GT 4.0.5:

$ cd ogsadqp-3.2.1-od30port/client
$ ant getschemas -Durl=http://localhost:8080/wsrf/services/dai/
-Dresource.id=ogsadai-12345 \
-Dclient.query="SELECT goterm_goterm.name FROM \
 proteinterm_protein_goterm, goterm_goterm WHERE \
 proteinterm_protein_goterm.GOTermIdentifier=goterm_goterm.id \
 AND proteinterm_protein_goterm.ORF='YBL037W' \
 AND goterm_goterm.name LIKE 'vesicle%';"

The query guide provides an overview of the sorts of SQL queries that OGSA-DQP can handle. A final ; at the end of the query is vital.

If all goes well, the client will contact the coordinator, which will execute the query using the specified DQP resource. Note the way that the example table in the query, person, is identified as DataTwo_person. OGSA-DQP prefixes the database name (DataTwo) to the table name as a basic method of schema conflict resolution.

By default, the client will print the results. The client may be used to output results to a file instead by adding an option

-Dclient.output.file=FILE

Where FILE is the name of a file in which the results should be saved.

For example, for OGSA-DAI Axis 1.2.1:

$ cd ogsadqp-3.2.1-od30port/client
$ ant getschemas -Durl=http://localhost:8080/dai/services/ \
-Dresource.id=ogsadai-12345 \
-Dclient.query="SELECT goterm_goterm.name FROM \
 proteinterm_protein_goterm, goterm_goterm WHERE \
 proteinterm_protein_goterm.GOTermIdentifier=goterm_goterm.id \
 AND proteinterm_protein_goterm.ORF='YBL037W' \
 AND goterm_goterm.name LIKE 'vesicle%';" \
-Dclient.output.file=myOutput.txt

For example, for OGSA-DAI GT 4.0.5:

$ cd ogsadqp-3.2.1-od30port/client
$ ant getschemas -Durl=http://localhost:8080/wsrf/services/dai/
-Dresource.id=ogsadai-12345 \
-Dclient.query="SELECT goterm_goterm.name FROM \
 proteinterm_protein_goterm, goterm_goterm WHERE \
 proteinterm_protein_goterm.GOTermIdentifier=goterm_goterm.id \
 AND proteinterm_protein_goterm.ORF='YBL037W' \
 AND goterm_goterm.name LIKE 'vesicle%';" \
-Dclient.output.file=myOutput.txt

Previous: How clients can use OGSA-DQP Next: Use the OGSA-DQP GUI client