W3C home > Mailing lists > Public > public-linked-json@w3.org > August 2012

RE: DuckDuckGo data to JSON-LD?

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Fri, 24 Aug 2012 12:08:48 +0200
To: "'Danny Ayers'" <danny.ayers@gmail.com>, <public-linked-json@w3.org>
Message-ID: <00fc01cd81e0$75620d30$60262790$@lanthaler@gmx.net>
Hi Danny,

> The DuckDuckGo search engine has a "Zero-click Info API" [1] which
> provides access to knowledgebase-style info related to a search query.
> It's a straight GET call [2], the results coming back in XML or JSON.
> What I was wondering was - what would be the minimum needed to make
> the JSON results JSON-LD? Is it possible without breaking the existing
> JSON structure?

I think the easiest thing and the least disrupting one would be to simply add a HTTP header which links to a JSON-LD context [1]. Something like:

HTTP/1.0 200 OK
...
Content-Type: application/json
Link: <http://duckduckgo.com/context.jsonld>; rel="describedby"; type="application/ld+json"


The context could then be as simple as

{
  "@context": {
    "@vocab": "http://duckduckgo.com/vocab/"
  }
}


Of course it would also be possible to link certain terms to other vocabularies. The disadvantage of using just an HTTP header is reduced visibility. Perhaps additionally adding an additional representation using the application/ld+json MIME type would be an option as well and be just slightly more complicated:

GET http://api.duckduckgo.com/?q=Linked+Data&format=jsonld&pretty=1

HTTP/1.0 200 OK
Content-Type: application/ld+json

{
  "@context": {
    "@vocab": "http://duckduckgo.com/vocab/"
  },
  "Definition" : "Linked Data describes a method of publishing structured data, so that it can be interlinked and become more useful.",
  "DefinitionSource" : "",
  "Heading" : "Linked Data",
  ...
}


[1] http://json-ld.org/spec/latest/json-ld-syntax/#referencing-contexts-from-json-documents


Hope this helps. Please keep us posted on this.


Cheers,
Markus


--
Markus Lanthaler
@markuslanthaler
Received on Friday, 24 August 2012 10:09:25 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:37 GMT