blazegraph / database

Blazegraph High Performance Graph Database
GNU General Public License v2.0
895 stars 173 forks source link

Unknown value for QUERY PARAMETER: format #87

Open relu91 opened 6 years ago

relu91 commented 6 years ago

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.

gengchenmai commented 4 years ago

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?