database icon indicating copy to clipboard operation
database copied to clipboard

Unknown value for QUERY PARAMETER: format

Open relu91 opened this issue 6 years ago • 1 comments

Blazegraph can't recognize query format parameter value: application/sparql-results+json. Even if the REST API documentation clearly states:

Available in versions after 1.4.0. This is an optional query parameter that allows you to set the result type other than via the Accept Headers. Valid values are json, xml, application/sparql-results+json, and application/sparql-results+xml. json and xml are simple short cuts for the full mime type specification. Setting this parameter will override any Accept Header that is present

Console output: WARN : ConnegUtil.java:139: Unknown value for QUERY PARAMETER: format passed application/sparql-results+json. Defaulting to XML

Looking at ConnegUtil the application/sparql-results-json is not in the switch case list, but sparql-result+json is present instead.

relu91 avatar Apr 23 '18 11:04 relu91

Hi, I have the same issue when I setted up the blazegraph and used it as a RESTful API. It cannot recognize application/sparql-results+json as format. When I change to "format=json", it can work when testing it in the browser. However, it still cannot work when you use it as an Ajax query in Javascript. See below:

query += "Select * where {?s ?p ?o.} limit 10";
// this does not work
// var url = _SPARQL_ENDPOINT + "?query=" + encodeURIComponent(query) + "&format=" + encodeURIComponent("application/sparql-results+json") + "&timeout=5000&debug=on";  
// this URL can work on brower but not in ajax.
var url = _SPARQL_ENDPOINT + "?query=" + encodeURIComponent(query) + "&format=" + encodeURIComponent("json") + "&timeout=5000&debug=on"; 
			
$.ajax({
	url: url,
	type: 'GET',
	dataType: 'json',
	success: function(data, textStatus, xhr) {
              console.log(data);
	}
}); 

Any idea about this?

gengchenmai avatar Oct 02 '20 19:10 gengchenmai