You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Bart van Leeuwen <ba...@netage.nl> on 2024/09/01 10:57:55 UTC

RDFConnection remote fetch behaviour on missing graph

Hi,

When I do a fetch(graph) on a RDFConnection created by RDFConnectionFuseki 
on a fuseki endpoint (4.10.0) and the graph does not exist a 404 exception 
is thrown.
I would expect an empty Model, and not an exception?

Doing a fetch on dataset from e.g. stardog to a none existing graph 
returns an empty model.

Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen


Re: RDFConnection remote fetch behaviour on missing graph

Posted by Andy Seaborne <an...@apache.org>.
On 01/09/2024 11:57, Bart van Leeuwen wrote:
> Hi,
> 
> When I do a fetch(graph) on a RDFConnection created by RDFConnectionFuseki
> on a fuseki endpoint (4.10.0) and the graph does not exist a 404 exception
> is thrown.
> I would expect an empty Model, and not an exception?
> 
> Doing a fetch on dataset from e.g. stardog to a none existing graph
> returns an empty model.
> 
> Met Vriendelijke Groet / With Kind Regards
> Bart van Leeuwen

(GSP = SPARQL Graph Store Protocol)

"Empty graph" vs "graph does not exist" is murky area because triple 
stores using quad indexing don't differentiate between the two cases 
leading to inconsistent behaviour. Jena behaviour is supposed to be 
consistent for all stores (quad based or not).

As to the effect on GSP GET - what does the community want?

Fuseki is making a special test so teh GSP GET behaviour can be changed 
without disturbing anything else.


There are corner cases:

Does "GRAPH ?G {}" include <uri>?
   Presumably "no" for all stores - else there are infinite results.

Does "GRAPH <uri> {}" return a row?
   Jena - yes. Empty patten on empty graph is one row, no columns.

What does
   CREATE GRAPH <uri> ;
   CREATE GRAPH <uri>
do?

 From an plain HTTP point of view, the URL

    http://server/database?graphname=uri

(there is nothing special about query strings when identifying a web 
resource) does not exist so 404 is natural when client accesses are not 
SPARQL aware.


Checking the spec:

GSP says some at-odds things:

"""
If the RDF graph content identified in the request does not exist in the 
server, and the operation requires that it does, a 404 Not Found 
response code MUST be provided in the response.
"""

GSP GET says:
"""
It is equivalent to
   CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <graph_uri> { ?s ?p ?o } }
"""
which would be empty. Whether the equivalence observation

But GSP POST says
"""
If the graph IRI does not identify either a Graph Store or RDF graph 
content, the origin server should respond with a 404 Not Found.
"""

GSP DELETE does say it's 404.