Hi,

Is it possible to get DESCRIBE results as quads? I tried requesting
text/trig but simply got the data in the default graph:

$ curl http://localhost:3031/ds/ -d 'query=DESCRIBE
<https://example.org/Denis>' -i -H "Accept: text/trig"
HTTP/1.1 200 OK
Date: Wed, 15 Jan 2025 23:36:46 GMT
Fuseki-Request-Id: 552
Content-Type: text/trig
Transfer-Encoding: chunked

<https://example.org/Denis>
        a                         <http://schema.org/Person> ;
        <http://schema.org/name>  "Denis Villeneuve" ;
        <http://schema.org/url>   <https://www.imdb.com/name/nm0898288/> .

The result I'm looking for can be obtained using CONSTRUCT ... GRAPH
... WHERE [1] syntax:

$ curl http://localhost:3031/ds/ -d 'query=CONSTRUCT { GRAPH ?g {
<https://example.org/Denis> ?p ?o . } } WHERE { GRAPH ?g {
<https://example.org/Denis> ?p  ?o } }' -i -H "Accept: text/trig"
HTTP/1.1 200 OK
Date: Wed, 15 Jan 2025 23:36:10 GMT
Fuseki-Request-Id: 550
Content-Type: text/trig
Transfer-Encoding: chunked

<https://localhost:4443/8a440293-253e-42f0-bdd6-3e7fc8acb337/> {
    <https://example.org/Denis>
            a                         <http://schema.org/Person> ;
            <http://schema.org/name>  "Denis Villeneuve" ;
            <http://schema.org/url>   <https://www.imdb.com/name/nm0898288/> .
}

Just for curiosity's sake I also tried requesting Turtle with
CONSTRUCT ... GRAPH ... WHERE and got an empty result:

$ curl http://localhost:3031/ds/ -d 'query=CONSTRUCT { GRAPH ?g {
<https://example.org/Denis> ?p ?o . } } WHERE { GRAPH ?g {
<https://example.org/Denis> ?p  ?o } }' -i -H "Accept: text/turtle"
HTTP/1.1 200 OK
Date: Wed, 15 Jan 2025 23:43:04 GMT
Fuseki-Request-Id: 554
Content-Type: text/turtle
Transfer-Encoding: chunked

Looking at the above, the DESCRIBE behavior with quads feels inconsistent to me.
I get that the result triples can simply be placed into the default
graph when quads are requested. But does that really make sense?
IMO DESCRIBE should behave like CONSTRUCT ... GRAPH ... WHERE when
quads are requested (i.e. return quads), and return triples when
triples are requested (as it always has done).

Martynas

[1] https://jena.apache.org/documentation/query/construct-quad.html

Reply via email to