W3C home > Mailing lists > Public > public-hydra@w3.org > July 2014

Re: 404 Re: Comments on the Triple Patterns Fragments draft

From: Ruben Verborgh <ruben.verborgh@ugent.be>
Date: Wed, 30 Jul 2014 13:34:59 +0200
Cc: public-hydra@w3.org
Message-Id: <7B9CD087-96E4-488F-9013-1DF4C892DC6A@ugent.be>
To: Nandana Mihindukulasooriya <nmihindu@fi.upm.es>
Hi Nandana,

> [[reply with status code 404 Not Found if the fragment (page) with the given URL does not exist or is empty, i.e., no triples match the selector.]]
> 
> If I understand correctly, these two scenarios are bit different and it might be useful differentiate those two, isn't it?

First of all, it's bad phrasing in the spec itself.
I think that, when I wrote it, I meant "does not exist, i.e., is empty".

We should avoid getting philosophical, but in theory,
all triple pattern fragments exist—even if they are empty.
For instance, the fragment corresponding to "things that are publications"
for the DBpedia dataset conceptually exists:
http://data.linkeddatafragments.org/dbpedia?predicate=http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type&object=http%3A%2F%2Fpurl.org%2Fnet%2Fnknouf%2Fns%2Fbibtex%23Conference
but it is empty, i.e., no triples in DBpedia match this triple pattern.
However, the 404 signals that currently, there is nothing in it.

I'd like to compare this to, for instance, Wikipedia:
    http://en.wikipedia.org/wiki/Hydra_Core_Vocabulary
At the moment, this gives a 404.
However, what we get in essence is an empty page.
Maybe somebody will create it later on.
So conceptually, there is a page for the Hydra Core Vocabulary,
there is simply nothing in it at the moment. Hence, 404.

> The former could be because I used a wrong template or mistyped something but in the latter case the fragment is actually valid but it just happen to be empty. So may be for the latter "204 No Content" would be a better response so that the client knows the reason. 

Actually, for the case "fragment is empty", it is very useful to send a body—204 doesn't allow that.
Consider this empty fragment: http://data.linkeddatafragments.org/dbpedia?subject=rdf%3Atype
It results in a 404, but the body is still fully interpretable by humans and machines.

For instance, the Turtle representation will state:

    <http://data.linkeddatafragments.org/dbpedia?subject=rdf%3Atype> a hydra:Collection, hydra:PagedCollection;
        dcterms:source <http://data.linkeddatafragments.org/dbpedia#dataset>;
        hydra:totalItems "0"^^xsd:integer.

Furthermore, it will also contain the hypermedia controls that allow to browse the rest of the collection.
I.e., it is an error response that tells the client how to continue, which a 204 cannot do.

> [[reply with status code 404 Not Found if the selector is invalid i.e., the parameter values are not in the domain of the selector. This is the case if, for instance, a literal is used as subject. ]]
> 
> In this case, isn't it better to send a '400 Bad Request' rather than a '404 Not Found'. I can see why 404 could be technically correct because that fragment URL doesn't exist but may be it is more helpful to the client to know the reason.

Mmm, being helpful to a client is a good argument for 400.
Markus also suggested it.

What would you do in the spec?
Make 400 mandatory for this case, or leave a choice between 400 and 404?

In any case, the body will contain additional information, such as the controls to continue.



Based on everybody's input on this discussion, I have created an issue:
https://github.com/HydraCG/Specifications/issues/64
Thanks for contributing!

Furthermore, this discussion convinces me that we need a test suite for the spec.
I.e., given an example dataset, validate whether a server exhibits the correct behavior
for a set of existing and non-existing patterns (plus paging etc.). Tracking issue:
https://github.com/HydraCG/Specifications/issues/65

Best,

Ruben
Received on Wednesday, 30 July 2014 11:35:33 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:29:42 UTC