On 10/09/15 18:20, Mark Feblowitz wrote:
Ok -

I tested all forms that you recommended, and the one that does work is 
application/rdf+json.

Caveat - that's not JSON-LD.
https://jena.apache.org/documentation/io/rdf-json.html

Thanks very much for the suggestion!

Mark

On Sep 10, 2015, at 12:16 PM, Mark Feblowitz <[email protected]> wrote:

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 <http://host:port/ds/sparql> -d …

Works for me (Fuseki1 and Fuseki2, latest).

Which version of Fuseki? (did it have JSON-LD?)

        Andy


Should I instead be using a URL parameter?

Thanks,

Mark


On Sep 9, 2015, at 1:33 PM, Colin Maudry <[email protected] 
<mailto:[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/ <http://www.w3.org/TR/json-ld/>
[2] http://www.w3.org/TR/rdf-json/ <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/ <http://dbpedia.org/property/>"
    xmlns:yago="http://dbpedia.org/class/yago/ <http://dbpedia.org/class/yago/>"
    xmlns:nsl="http://purl.org/ontology/storyline/“ 
<http://purl.org/ontology/storyline/%E2%80%9C>
...

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