W3C home > Mailing lists > Public > www-archive@w3.org > April 2014

JSON-LD context for schema.org - work in progress

From: Dan Brickley <danbri@google.com>
Date: Thu, 17 Apr 2014 12:36:44 +0100
Message-ID: <CAK-qy=4oepr3bpTufdLW=rZT68EZrkuA7HLDaE-k6vphJiiXyA@mail.gmail.com>
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,

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() )
            self.response.out.write( open("static/index.html", 'r').read() )

... or do we need to be more nuanced?

Received on Thursday, 17 April 2014 11:37:12 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:44:29 UTC