HHS / ckanext-datajson

Custom CKAN extension for Healthdata.gov
http://hub.healthdata.gov/data.json
19 stars 72 forks source link

simplify json-ld #11

Open edsu opened 10 years ago

edsu commented 10 years ago

It might be worthwhile to simplify the JSON-LD a bit by using a more verbose context and referencing it from the json-ld. For example:

{
  "@context": "http://project-open-data.github.io/context.json",
  "title": "HealthData.gov Catalog Hub",
  "homepage": "http://hub.healthdata.gov",
  "dataset": [
    {
      "@id": "http://hub.healthdata.gov",
      "@type": "dcat:Catalog",   
      "title": "HealthData.gov Catalog Hub",
      "homepage": "http://hub.healthdata.gov",
      "dataset": [
        {
          "@id": "http://hub.healthdata.gov/dataset/7ab73b9c-238d-4a41-b789-679664810d02",
          "@type": "dcat:Dataset",
          "title": "Nursing Home Profile",
          "keyword": [
            "complaint",
            "enforcement",
            "inspection",
            "nursing homes"
          ],
          ...
        }
      },
    },
    ... 
  ]
}

and then you'd serve up the context at http://project-open-data.github.io/context.json:

{
  "@context": {
    "title": "http://purl.org/dc/terms/title",
    "homepage": "http://xmlns.com/foaf/0.1/homepage",
    "dataset": "http://www.w3.org/ns/dcat#dataset",
    "keyword": "http://www.w3.org/ns/dcat#keyword",
    ...
  }
}

The main advantages are:

JoshData commented 10 years ago

Yeah, if I trusted POD to maintain a good JSON-LD context file. :-P

I'm not opposed to moving the namespaces into the context though, and I'd gladly accept a pull request that does it.