Comparison Request

To initiate a comparison request create an object of the type BivesComparisonRequest (JDOC), passing the link to the two versions of a model or the XML representations of these models:

BivesComparisonRequest request = new BivesComparisonRequest ("http://.../path/to/model2.xml", "http://.../path/to/model2.xml");
// alternatively
request = new BivesComparisonRequest ("<sbml> .. </sbml>", "<sbml> .. </sbml>");

afterwards you need to define the operations to be executed on the web server by adding commands (commands are available as static fields in BivesComparisonRequest). For example, to force SBML comparison (skip detection of document type) and compute the highlighted reaction network encoded in GraphML (see Reaction Network and GraphML) and the report of the differences encoded in HTML (see also report and HTML) you would do the following:

request.addCommand(BivesComparisonRequest.COMMAND_FORCE_SBML);
request.addCommand(BivesComparisonRequest.COMMAND_REACTIONS_GRAPHML);
request.addCommand(BivesComparisonRequest.COMMAND_REPORT_HTML);

(see also all constant values)

To perform the request you need to instantiate a BivesWs object by passing the URL to the BiVeS web service you want to use (here we're using the web service of the SEMS project, available at http://bives.sems.uni-rostock.de/). This object is able to communicate to the web service, just pass the request to the performRequest method. The result will be a BivesComparisonResponse:

BivesWs bives = new HttpBivesClient("http://bives.sems.uni-rostock.de/");
BivesComparisonResponse result = bives.performRequest(request);

The returned BivesComparisonResponse object provides methods to get the result of that response. Here for example we get the requested HTML report by passing the HTML report command to the getResult method:

String htmlReport = result.getResult (BivesComparisonResponse.COMMAND_REPORT_HTML);

That's the usual work flow, but the client also has some more methods which give you access to some other information.

Special Methods

Besides the getResult method of the BivesComparisonResponse object there are some other methods, see #SpecialMethods.

Errors

To check if an error occurred during the computations on the server you can as the response whether it hasErrors. If that's the case, you'll get them by calling getErrors:

if (result.hasError ())
{
   for (String err : result.getErrors ())
      System.err.println ("ERROR: " + err);
   System.exit (1);
}
Last modified 3 years ago Last modified on May 11, 2014, 9:51:05 PM
authorship