Getting turtle instead of json

Set MIME type in request to application/sparql-results+json and I'm getting turtle back. What am I screwing up?

What sort of query are you running? If you’re running a SELECT query, then application/sparql-results+json is a valid Accept type, however if you’re doing a CONSTRUCT, then you can only get back an RDF format such as text/turtle.

Having the */* in your Accept header means the server will give you back anything. If you’re running a CONSTRUCT query and did not have the */*, you would get back a 406 Not Acceptable response.

PREFIX rdf: <>
PREFIX rdfs: <>
PREFIX owl: <> 
PREFIX xsd: <> 

select distinct ?entity ?elabel ?type ?tlabel 
where { 
	?entity a owl:NamedIndividual . 
	OPTIONAL { ?entity rdfs:label ?elabel } . 
	OPTIONAL { ?type rdfs:label ?tlabel } 

I got the above results using d3.xhr. I’m trying to work around using stardog.js.

I think the issue might be the endpoint you’re using. It appears that your request is going to http://localhost:5820/naut#!/query/<URLEncoded query>. Unless you’re using the web console (which it sounds like you aren’t), the #! would have no reason to be in the URL.

Try sending your request to the HTTP query endpoint and pass the query in on a query param like so: http://localhost:5820/naut/query?

That was it. I was using the web console URL and clearly shouldn’t have.

Thank you very much.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.