Dave, thanks for the continued follow up. Here is a small victory, I was
able to run the babel service directly:

http://service.simile-widgets.org/babel/translator?reader=rdf-xml&writer=exhibit-json&mimetype=default&url=http://telegraphis.net/data/countries/countries.rdf

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
Failed to access
http://service.simile-widgets.org/babel/translator?reader=rdf-xml%26writer=exhibit-json%26mimetype=default%26url=http://telegraphis.net/data/countries/countries.rdf(HTTP
0) "" exhibit-scripted-bundle.js: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.




On Thu, Dec 19, 2013 at 8:26 PM, David Karger <[email protected]> wrote:

>  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.
>
>
> On 12/19/2013 9:19 PM, Vicente Barreiro wrote:
>
> 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 ***
>
> On Thursday, December 19, 2013 8:36:37 AM UTC-6, David Karger wrote:
>>
>>  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/"<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.
>>
>> On 12/18/2013 11:29 PM, Vicente Barreiro wrote:
>>
>> 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:
>>>
>>>  curl --insecure --show-error --fail -F [email protected] -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" >
>>>  <script src="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/"<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="text/javascript"></
>>> script>
>>>  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.
>>>  --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/simile-widgets.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>   --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/simile-widgets.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>   --
> 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 [email protected].
>
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/simile-widgets.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> 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
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/simile-widgets.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/simile-widgets.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to