Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify json-ld #11

Open
edsu opened this issue Feb 14, 2014 · 1 comment
Open

simplify json-ld #11

edsu opened this issue Feb 14, 2014 · 1 comment

Comments

@edsu
Copy link

edsu commented Feb 14, 2014

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:

  • the JSON-LD looks more like the current JSON, with an eye towards possibly folding them together?
  • implementers wouldn't need to repeat the context (perhaps incorrectly) in their own data.json files
  • the JSON could be used more idiomatically from Javascript: e.g. datasets.title instead of datasets['title'].
@JoshData
Copy link
Contributor

JoshData commented Mar 2, 2014

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.

camfindlay pushed a commit to camfindlay/ckanext-datajson that referenced this issue Mar 7, 2017
Merging for 1.25 release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants