That makes sense. But it doesn’t seem to work. I still get it in RDF XML format.

I’m wondering whether the problem is with how I’m submitting the query.

I’m using curl as follows:

curl -v -H "Content-Type:application/sparql-query" -H “Accept: 
application/ld+json"  -X POST http://host:port/ds/sparql -d …

Should I instead be using a URL parameter?

Thanks,

Mark


> On Sep 9, 2015, at 1:33 PM, Colin Maudry <[email protected]> wrote:
> 
> Hi Mark,
> 
> This is because  CONSTRUCT doesn't return query results (a table
> structure), but a graph.
> 
> Two possibilities :
> 
>  * If you want to stick to your CONSTRUCT query and want JSON out, you
>    should request JSON-LD[1] with "application/ld+json". You can also
>    try "application/json" or "application/rdf+json" to get RDF/JSON (I
>    never tried). According to the spec[2], you're encouraged to use
>    JSON-LD instead.
>  * If you really want JSON SPARQL results, that's a SELECT query that
>    you need to post.
> 
> I hope it helps.
> 
> Colin Maudry
> 
> [1] http://www.w3.org/TR/json-ld/
> [2] http://www.w3.org/TR/rdf-json/
> 
> 
> On 09/09/2015 18:58, Mark Feblowitz wrote:
>> At my wits’ end here - when I invoke a SPARQL using curl to a local Fuseki 
>> server, and the query is a construct query, and I specify
>> 
>>      -H “Accept: application/sparql-results+json”
>> 
>> or 
>>      -H “Accept: application/sparql-results%2Bjson”
>> 
>> I consistently get results back in RDF/XML
>> 
>> <rdfs99:RDF
>>    xmlns:dp="http://dbpedia.org/property/";
>>    xmlns:yago="http://dbpedia.org/class/yago/";
>>    xmlns:nsl="http://purl.org/ontology/storyline/“
>> ...
>> 
>> With no "-H Accept…”, I’m seeing triples format.
>> 
>> In fact, no matter what I set the Accept header to, I see rdf/xml. Without 
>> an Accept: header, I see ntriples.
>> 
>> Any ideas?
> 

Reply via email to