openRDF.org Welcome Guest   | Login   
  Search  
  Index  | Recent Threads  | Who's Online  | User List  | Search  | Help  | RSS feeds

Forum closing down
This forum will be closing down due to extensive spamming activities. As a first step, registration of new members has been disabled. Existing members will be able to use the forum for now, but please consider using the sesame-general mailing list instead.


Quick Go »
Thread Status: Normal
Total posts in this thread: 4
[Add To My Favorites] [Watch this Thread] [Post new Thread]
Author
Previous Thread This topic has been viewed 884 times and has 3 replies Next Thread
Mar 20, 2008 3:32:11 AM

hendlerman
Regular
Member's Avatar


Joined: Sep 14, 2004
Posts: 36
Status: Offline
Controlling return types of HTTP REST queries Reply to this Post
Reply with Quote

Making a REST POST query one system I get

[Content-disposition] => attachment; filename=query-result.brt
[Content-type] => application/x-binary-rdf-results-table; charset=ISO-8859-1

and another I get

[Content-disposition] => attachment; filename=query-result.srj
[Content-type] => application/sparql-results+json; charset=UTF-8

which parses nicely. Only Binary results is documented, and the I only want the JSON results. The above system is a windows system, and the second is MAC OSX. Can I force windows system to return UTF-8/JSON?

Changing the "accept" and "accept-charset" headers didn't seem to help on my client.... PHP 5. This may be a windows PHP issue, but I'm assuming there's some autodetection taking place on the Sesame side.
----------------------------------------
[Edit 3 times, last edit by hendlerman at Mar 20, 2008 4:07:47 AM]
Show Printable Version of Post        Hidden to Guest    http://semanticsearch.org [Link] Report threatening or abusive post: please login first  Go to top 
Mar 20, 2008 8:16:16 AM

arjohn
OpenRDF project lead
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1289
Status: Offline
Re: Controlling return types of HTTP REST queries Reply to this Post
Reply with Quote

Sesame's HTTP server uses HTTP content negotiation to determine the most appropriate result format. Normally, this is done by using Accept headers in a client's request, but apparently this doesn't work for you.

Fortunately, Sesame also has an override mechanism to enforce a particular result format. Instead of specifying an Accept header, you can also specify an Accept query parameter with the same kind of (MIME type) values. Please note that this value should be url-form-encoded, like any other query parameter.

Another option is to skip the content negotiation altogether and to remove the jar-files for the other result formats from the server's WEB-INF/lib directory. That way, the server has only one option to choose from.

Thanks for pointing out the the documentation doesn't mention the json format, I'll fix that right away. More information about the supported query result formats can be found in the resultio packages in the javadoc.
----------------------------------------
Arjohn Kampman, OpenRDF project lead, Aduna
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Mar 20, 2008 5:35:35 PM

hendlerman
Regular
Member's Avatar


Joined: Sep 14, 2004
Posts: 36
Status: Offline
Re: Controlling return types of HTTP REST queries Reply to this Post
Reply with Quote

Thanks for the prompt reply!

So, adding the "accept" as a param didn't work for me. (Perhaps this is because I still have */* in the accept header). But, removing the lib for binary result returns did the trick. Removing only the binary result lib also did not affect the workbench, it seems.

I still have some unrelated issues, but I'll follow up here if they seem to come back.
----------------------------------------
[Edit 1 times, last edit by hendlerman at Mar 20, 2008 5:36:17 PM]
Show Printable Version of Post        Hidden to Guest    http://semanticsearch.org [Link] Report threatening or abusive post: please login first  Go to top 
Mar 21, 2008 2:13:11 PM

arjohn
OpenRDF project lead
Member's Avatar

The Netherlands
Joined: Jan 23, 2004
Posts: 1289
Status: Offline
Re: Controlling return types of HTTP REST queries Reply to this Post
Reply with Quote

 
So, adding the "accept" as a param didn't work for me. (Perhaps this is because I still have */* in the accept header).

The parameter takes presendence over the header. Maybe the parameter name is case-sensitive. Can you try "Accept" with upper case "A" as the parameter name and let me know if that helps?
 
But, removing the lib for binary result returns did the trick. Removing only the binary result lib also did not affect the workbench, it seems.

Workbench prefers the binary formats as that has the least overhead, but it falls back to other formats if that is not available. Content negotiation rules! smile
----------------------------------------
Arjohn Kampman, OpenRDF project lead, Aduna
Show Printable Version of Post        Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
[Show Printable Version of Thread] [Post new Thread]