Sunday, August 31, 2008

Biomoby Web Service Display Page

WebServiceRetrieval.js requires:
jquery.pack.js - v1.2.3 or later
jquery.form.js -v2.12 or later
jquery.selectboxes.pack.js

With regards to biomoby rifraf: Progress is made on the BioMoby Web Service Annotation Page. Finished making the javascript file (WebServiceRetrieval.js) to display a Web Service's descriptive information. Because the RDF graph for a Web Service can get pretty deep and because we want to pull out a lot of information, it slows down the query I've noticed and causes timeouts when accessing it remotely the way we're doing it. Had to break down the query into steps.

1) Query using a web service uri to get its immediate service description, organization description and operation uid
2) Query using the operation uid to get the operation task
3) Query using the operation uid to get the operation Input parameters
4) Query using the operation uid to get the operation Output parameters

Using ajax calls to submit a form containning the SPARQL queries, the script executes the Query 1 and pulls out the Operation uid. Query 2-4 use the operation uid and are all called at approximately the same time (as in they don't wait for one to complete before executing the other since they're all their own seperate ajax call)

Using the jquery form plugin to do the ajax calls which allows the script to work in all browsers: Firefox3, Safari, Opera and IE7.

Small catch: Need to talk to the guys who handle the Virtuoso server where I'm getting this Web Service description RDF as JSON from. Because ajax doesn't let you do cross domain requests for json (which we're doing) UNLESS you set datatype: jsonp.

When datatype is set to jsonp, jquery ajax sends an extra 'callback' parameter in the request to the server. This 'callback' parameter is usually has a value like eg. jsonp7120986. The server is suppose to take that and wrap it's response JSON in it like so:
jsonp7120986( {responseJSON} ) and set the response to text/plain.

If the server just sends back {responsJSON} without it being wrapped, it will cause an 'invalid label' error.

Our SPARQLEndpoint currently doesn't do this and I've been getting around it (so that I could keep coding) by making an intermediate java class which would wrap the JSON response in the callback. I'm sure the guys managing our SPARQL Endpoint will be able to help.



Now to make it look intuitive and beautiful...

1 comment:

bgood said...

go Lu Paul!

Don't be shy about talking to our endpoint-hosting friends..