- From: Dan Brickley <danbri@google.com>
- Date: Thu, 17 Apr 2014 12:36:44 +0100
- To: Stéphane Corlosquet <scorlosquet@gmail.com>, Gregg Kellogg <gregg@greggkellogg.net>, Manu Sporny <msporny@digitalbazaar.com>, www-archive@w3.org, Niklas Lindström <lindstream@gmail.com>, Markus Lanthaler <markus.lanthaler@gmx.net>
Hi folks curl -v -H "Accept: application/ld+json" http://sdo-context-test.appspot.com/ ... is a start at JSON-LD context file serving. For now it just emits a static file that I built with a script from Niklas, https://gist.github.com/niklasl/7873635 https://github.com/json-ld/json-ld.org/pull/297 My main concern is that this should not impact human users, so the content negotiation settings are a bit conservative: if the client asks for JSON-LD and does not mention HTML or XHTML in its request, I send JSON-LD. Otherwise (and regardless of ;q=0.6 -style HTTP subtleties, I send the normal HTML. Once we're happy with the HTTP mechanism, let's talk about what actually goes into the file. Would something like this work with JSON-LD tools that fetch context files? accept_header = self.request.headers.get('Accept').split(',') mimereq = {} for ah in accept_header: ah = re.sub( r";q=\d?\.\d+", '', ah).rstrip() mimereq[ah] = 1 html_score = mimereq.get('text/html', 5) xhtml_score = mimereq.get('application/xhtml+xml', 5) jsonld_score = mimereq.get('application/ld+json', 10) if (jsonld_score < html_score and jsonld_score < xhtml_score): self.response.out.write( open("data/jsonldcontext.json", 'r').read() ) return else: self.response.out.write( open("static/index.html", 'r').read() ) return ... or do we need to be more nuanced? Dan
Received on Thursday, 17 April 2014 11:37:12 UTC