Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

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...

Friday, August 15, 2008

Finished the basics for the ED Widget.
It's in two JS files:
-EDwidget (which needs to be included in the html page and handles the adding of all necessary css and javascripts on the fly)
-EDlet (this creates the actual EDlet inside the div with id="EDlet")

To use it: (Haven't deployed it yet, so don't expect to use it right away)

include the:
a script tag in the html head with
type = "text/javascript"
src = "http://arch.uwindsor.ca:8080/ED/JS/EDwidget.js"

include a div somewhere with id="EDlet"

I'm leaving up the stylizing of the EDlet div to the web developer using it in their page, but I have include some basic EDlet API functions to make it easier.

Note: You need to be logged into ED for this to work since it requires a cookie

Sunday, July 13, 2008

Why there was an unexpected limit on the number of tags you could add to ED

I didn't realize this until I started making a progress bar to ED as per Ben's suggestion. Originally, I suspected ED was slower with the submiting of Tags because I added in that extra step of adding tags to the Virtuoso Server with SPARQL. As it turns out, some of the tags were being repeated, so the SPARQLTagManager was adding a tag 2 or 3 times!

I traced this problem back to the xml the ed_connotea javascript was feeding it. What's worse, if you have too many tags with too many types associated with them, then the xml would get to be too big and it can't be passed as a parameter when we call the SPARQLTaggingServlet.

Firefox doesn't state that there is a limit on the size of the parameter.
But there is one for IE.

The trouble with the xml was that every time I called save_tag_action() to make it (I didn't realize it was appending the tags on to the existing one so I'd end up with duplicate tags. It's called once for the TagManagerSaveTaggingServlet and again for the SPARQLTaggingServlet. To alleviate this problem, I call the save_tag_action() once, save the xml and re use it for both servlets.

I wonder if it would be prudent to keep the xml in a cookie and destroy it once we're done.


Thursday, June 12, 2008

copiedFromConnotea.js

Note to self: ED 2 Connotea uses existing javascript from Connotea. ie. the addtag(tag ,clear) function

For EDnoConnotea (ED seperated from Connotea) I've created a javascript 'copiedFromConnotea.js' with... as you might guess, javascript copied from Connotea.

Will remove superfluous functions later.