The Java web service client library makes it easy to run queries in GrapeMine directly from Java programs.
You can use this libray to construct any query you could run from web interface and fetch the results
in as either tables of values, or JSON data structures (see json.org).
Like all our code, these client libraries are open-source, licensed under the LGPL. For information
on the API visit our wiki pages.
Prerequisites
All you need to is java 1.5+ and our package
(download)
which contains the client library and all dependencies.
Getting Started
You can get example Java web service API code either from a Template Query or the QueryBuilder:
From the QueryBuilder - after creating or editing a query, click the "Java" link in
the Actions section below the query details.
From a Template Query form - click the "Java" link below the template form.
Run the program
You can run the program either from the command line or within an IDE (e.g. Eclipse).
To run the program in your favorite IDE, make sure to import all the libs from the distribution package. To run from command line:
Unzip the distribution package (see above):
> unzip java-intermine-webservice-client.zip
In the intermine-client-x.x directory that has been created make a new directory called
grapemine (this is the package name in the generated Java).
> cd java-intermine-webservice-client
> mkdir grapemine
Save the source code in a Java source file (*.java) in the grapemine
directory. The file name and the class name
have to be the same. The generated class names might be duplicated (if you have generated
code for a query before) - feel free to change them if necessary. For example, the
default query class name is QueryClient, so:
> cp [downloaded-file] grapemine/QueryClient.java
Run the script from the command line under the package directory:
The transPLANT project is funded by the European Commission within its 7th Framework Programme, under the thematic area "Infrastructures", contract number 283496.