BioModels Database logo

BioModels Database

spacer

BioModels Web Services

With BioModels Web Services, users can programmatically access up-to-date information from BioModels Database without installing a local copy of the database. They provide a wide range of features for searching and retrieving models. Furthermore, some features can help users to extract interesting parts from a large model and assemble them into a fully valid submodel. For any comments or new feature enquiries, please feel free to contact us.

Available features

The list of available features's page describes all the available services in a nice human readable way, included a detailed description of all methods. The WSDL (Web Services Description Language) defines the provided services in an XML format file. This enables third-party software to automatically generate clients for accessing the services.

Java library

The Java library provides a very convenient way to use the web services. It gives access to improved methods (for example giving access to 'SimpleModel' objects rather than raw XML) in order to make the use of the web services easier.

Documentation

The library documentation gives information for developers wishing to use the API:

Get the library via Maven

The library is available from the EBI Maven repository.

You just need to add the following to your pom.xml to get it and all its dependencies:

  <dependencies>
    <dependency>
      <groupId>uk.ac.ebi.biomodels</groupId>
      <artifactId>biomodels-wslib</artifactId>
      <version>1.21</version>
    </dependency>
  </dependencies>
  
  <repositories>
  <repository>
    <id>ebi-repo</id>
    <name>The EBI internal repository</name>
    <url>http://www.ebi.ac.uk/~maven/m2repo</url>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </repository>
  </repositories>

Download the library via SourceForge

Two versions of the Java library for querying BioModels Database Web Services are available for download from the SourceForge project download page (latest release: 1.21):

These are the dependencies which are required by the light-weight library:

Note: you can find the latest version of each of these packages on their official web site.

Java 1.5 (or newer) is required in order to use the library.

How to use the library

First, download the provided library.

Assuming that you downloaded the biomodels-wslib_standalone.jar, let's write a simple HelloBioModels.java to test if it works in your environment.

import uk.ac.ebi.biomodels.*;

public class HelloBioModels
{
  public static void main(String args[]) throws Exception
  {
    BioModelsWSClient client = new BioModelsWSClient();
    
    /* uncomment when a proxy is needed
    client.setProperty("http.proxyHost", "your.http.proxy.host");
    client.setProperty("http.proxyPort", "yourHttpProxyPort");
    client.setProperty("socks.proxyHost", "your.socks.proxy.host");
    client.setProperty("socks.proxyPort", "yourSocksProxyPort");
    */
    
    System.out.println(client.helloBioModels());
  }
}

Then, compile HelloBioModels.java

javac -classpath path/to/biomodelswslib-standalone.jar HelloBioModels.java

Run it.

java -classpath .:path/to/biomodelswslib-standalone.jar HelloBioModels

If you get the result as following...

Hello BioModels

...this means the BioModels Database Web Services library was properly loaded.

How to deal with the returned java.util.TreeMap?

The methods which returns java.util.TreeMap are usually used to fetch related models by given reference. For instance:

java.util.TreeMap getSimpleModelsByChEBIIds(java.lang.String[] ChEBIIds)

In the TreeMap, the reference identifier is used as the key value. And the object stored in TreeMap is an java.util.List object with all related models in the uk.ac.ebi.biomodels.SimpleModel object. The following example GetSimpleModelsByChEBIIds.java can illustrate this.

import uk.ac.ebi.biomodels.*;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class GetSimpleModelsByChEBIIds
{
  public static void main(String args[]) throws Exception
  {
    BioModelsWSClient client = new BioModelsWSClient();
    
    /* uncomment when a proxy is needed
    client.setProperty("http.proxyHost", "your.http.proxy.host");
    client.setProperty("http.proxyPort", "yourHttpProxyPort");
    client.setProperty("socks.proxyHost", "your.socks.proxy.host");
    client.setProperty("socks.proxyPort", "yourSocksProxyPort");
    */
    
    Map<String, List<SimpleModel>> resultSet = client.getSimpleModelsByChEBIIds(new String[]{"CHEBI:15355", "CHEBI:27897"});
    Iterator iter = resultSet.keySet().iterator();
    while (iter.hasNext())
    {
      String ChEBIId = (String) iter.next();
      System.out.println(ChEBIId + "\t\t");
      ArrayList modelList = (ArrayList) resultSet.get(ChEBIId);
      Iterator modelsIter = modelList.iterator();
      while (modelsIter.hasNext())
      {
        SimpleModel model = (SimpleModel) modelsIter.next();
        System.out.println("\t" + model.getId()
              + "\t\t" + model.getName()
              + "\t\t" + model.getPublicationId()
              + "\t\t" + model.getLastModificationDate());
      }
    }
  }
}

Compile it, as did for HelloBioModels.java. The result should be:

CHEBI:15355   
  BIOMD0000000002   Edelstein1996_EPSP_AChSpecies   8983160   Tue May 15 16:45:08 BST 2012
CHEBI:27897   
  BIOMD0000000062   Bhartiya2003_Tryptophan_operon    12787031    Wed May 16 11:21:54 BST 2012

spacer
spacer