- From: David Booth <david@dbooth.org>
- Date: Thu, 31 Jul 2014 23:51:07 -0400
- To: Ruben Verborgh <ruben.verborgh@ugent.be>
- CC: Erik Wilde <dret@berkeley.edu>, Andreas Kuckartz <a.kuckartz@ping.de>, "public-hydra@w3.org" <public-hydra@w3.org>
On 07/31/2014 05:50 PM, Ruben Verborgh wrote: >> If such a query is treated as an error, then the client code must >> either: (a) special-case the 404 result; > > Note that it doesn't have to; recognizing the 404 would be an > optimization, not a necessity. > > Here you see an example implementation: > https://github.com/LinkedDataFragments/Client.js/blob/v1.0.0/lib/fragments/FragmentsClient.js#L51 I haven't completely understood that program code, so please correct me if I'm wrong, but it looks like line 94 checks the HTTP statusCode and emits an error if the statusCode is not 200, and (on lines 133-135?) an error is treated as an empty fragment page. And I see that you are optimizing by doing a HEAD instead of GET if all components are fixed (on line 56), but it looks like (on line 60) you are ignoring any statusCode that indicates an error, and treating anything other than 200 as merely indicating an empty result set -- effectively ignoring the fact that there was an error. So if I have understood your code correctly, it seems to be either ignoring HTTP statusCodes that indicate errors (and treating them as merely indicating an empty result set), or it is not differentiating between a legitimate empty result set (which would come back as a 404) and a legitimate error condition, such as a I may have misunderstood the code -- and please have patience if I did -- but I do not see how that code avoids the added complexity that I mentioned, except by ignoring errors. If errors are ignored, then the client complexity that I mentioned does indeed go away, but I think we have to assume that many clients will want to treat errors as errors rather than ignoring them. And if they do, then it seems to me that if 404 is treated merely as indicating an empty set of triples, then it would have to be special cased. Also, if 404 is merely treated as indicating an empty set of triples, then wouldn't it be indistinguishable from an actual 404 error condition where, for example, an incorrect base URI is used? BTW, the draft at http://www.hydra-cg.com/spec/latest/triple-pattern-fragments/ is quite nice! One suggestion: include a short use case example, showing URIs, requests and responses. Thanks! David
Received on Friday, 1 August 2014 03:51:35 UTC