Exhibit 3.0, RDF and Babel

109 views
Skip to first unread message

Vicente Barreiro

unread,
Dec 18, 2013, 10:02:30 PM12/18/13
to simile-...@googlegroups.com
I'm trying to create a basic example using Babel to translate RDF into Json, but I can't make it work. This is what I've tried:

1. I was able to successfully reach Babel via a Web Service call. I used this command:

curl --insecure --show-error --fail -F file=@celebTrunc.rdf -o mycelebs.js 'http://service.simile-widgets.org/babel/translator?reader=rdf-xml&writer=exhibit-json&mimetype=default'

I was able to successfully get all my rdf tuples from the celebTrunc file converted to Json and stored in the js file.

2. I was able to successfully reach Babel via a Web Service from the exhibit java script call in my HTML page. Here is the code snippet:

    <link rel="exhibit-data" href="celebTrunc.rdf" type="application/json" > 
I get an error message about celebTrunc.rdf file not being in json format (I expected as much), and then I get redirected to the Babel web service which returns an emty json item. So far, so good as I'm at least reaching Babel.

3. I changed the type of the link file from "application/json" to "application/rdf+xml"

This time, I get the "Working"  pop-up that would indicate that exhibit is loading data, but if I look into the javascript console, I see the error:

Uncaught TypeError: Object [object global] has no method '_loadJSONP'

And the page get stuck there, without showing the data is supposed to.

And I'm stuck here trying to troubleshoot. Don't know enough javascript to attempt to debug. Any suggestions or tips?

Thanks.

David Karger

unread,
Dec 18, 2013, 10:20:35 PM12/18/13
to simile-...@googlegroups.com
Not sure it will work, but try setting type to "application/jsonp"
--
You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simile-widget...@googlegroups.com.
To post to this group, send email to simile-...@googlegroups.com.
Visit this group at http://groups.google.com/group/simile-widgets.
For more options, visit https://groups.google.com/groups/opt_out.

Vicente Barreiro

unread,
Dec 18, 2013, 11:29:12 PM12/18/13
to simile-...@googlegroups.com
No luck, it goes back to complaining about the formatting of the .rdf file (similar to number 2 below).


On Wednesday, December 18, 2013 9:20:35 PM UTC-6, David Karger wrote:
Not sure it will work, but try setting type to "application/jsonp"
On 12/18/2013 10:02 PM, Vicente Barreiro wrote:
I'm trying to create a basic example using Babel to translate RDF into Json, but I can't make it work. This is what I've tried:

1. I was able to successfully reach Babel via a Web Service call. I used this command:


I was able to successfully get all my rdf tuples from the celebTrunc file converted to Json and stored in the js file.

2. I was able to successfully reach Babel via a Web Service from the exhibit java script call in my HTML page. Here is the code snippet:

    <link rel="exhibit-data" href="celebTrunc.rdf" type="application/json" > 
I get an error message about celebTrunc.rdf file not being in json format (I expected as much), and then I get redirected to the Babel web service which returns an emty json item. So far, so good as I'm at least reaching Babel.

3. I changed the type of the link file from "application/json" to "application/rdf+xml"

This time, I get the "Working"  pop-up that would indicate that exhibit is loading data, but if I look into the javascript console, I see the error:

Uncaught TypeError: Object [object global] has no method '_loadJSONP'

And the page get stuck there, without showing the data is supposed to.

And I'm stuck here trying to troubleshoot. Don't know enough javascript to attempt to debug. Any suggestions or tips?

Thanks.

David Karger

unread,
Dec 19, 2013, 9:36:37 AM12/19/13
to simile-...@googlegroups.com
I didn't read carefully enough.  In your number 2, you want to get rid of the script tag entirely, but take the src attribute of that tag and make it the href attribute of your link tag:

    <link rel="exhibit-data" href="http://api.simile-widgets.org/exhibit/3.0.0rc1/exhibit-api.js?babel=http://service.simile-widgets.org/babel/translator?reader=rdf-xml%26writer=exhibit-jsonp%26mimetype=default/" type="application/jsonp" >
you also need to add an argument to babel telling it which (rdf) file to translate---the url of your celebTrunk.rdf file.

explanation: the link tag is supposed to href something that returns exhibit json.  the babel url is one link that does so.  putting a follow-on script tag doesn't change the fact that your href was returning a blob of rdf that exhibit doesn't understand.

Vicente Barreiro

unread,
Dec 19, 2013, 9:19:39 PM12/19/13
to simile-...@googlegroups.com
It makes sense. I've been looking into Babel, and I can't find a way to pass the URL of my file. In the Babel home page the file is past as part of a Post and multipart request. I don't know how to do that with a single URL expression.  *** sigh ***

David Karger

unread,
Dec 19, 2013, 9:26:08 PM12/19/13
to simile-...@googlegroups.com
A skim of the babel source code at
http://code.google.com/p/simile-widgets/source/browse/babel/trunk/engine/src/main/java/org/simileWidgets/babel/TranslatorServlet.java
Suggests that babel is able to take a "url" argument (http://babel?writer=jsonp&url=http://foo.com/my.rdf) that specifies the url of the data you want to convert.

Vicente Barreiro

unread,
Dec 19, 2013, 11:34:57 PM12/19/13
to simile-...@googlegroups.com
Dave, thanks for the continued follow up. Here is a small victory, I was able to run the babel service directly:


I could not send a local file, because the reference to localhost would've not been valid, but I found a file out there to play with.

However, I haven't been able to incorporate this with exhibit. I tried several things:
1. If I do not include the script tag, then nothing happens (no errors, but do data display), I imagine is because the javascript library is not included.

2. If I include the script tag (without the babel reference, as that's taken care in the rel tag), then I see two types of errors:

2.1 If I specify the jsonp format, I get an error that seems related to jquery:
GET http://service.simile-widgets.org/babel/translator?reader=rdf-xml%26writer=…ries.rdf&callback=jQuery17108281834260560572_1387513829119&_=1387513829853 400 (Bad Request)

2.2 If I specify the json format instead, I get a bit more meaningful errors:

XMLHttpRequest cannot load http://service.simile-widgets.org/babel/translator?reader=rdf-xml%26writer=…mimetype=default%26url=http://telegraphis.net/data/countries/countries.rdf. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. celebs_basic_exhibit3.html:1

I know the question about calling babel as a web service has been asked a few times, so I'm glad that I least I could post that example.
  



--
You received this message because you are subscribed to a topic in the Google Groups "SIMILE Widgets" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/simile-widgets/gVY70GnsTVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to simile-widget...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages