Skip to content
Markus Lanthaler edited this page Jun 17, 2014 · 5 revisions

Notes on the use of JSON-LD with schema.org

JSON-LD context file

As of 2014-06-16, schema.org provides a basic "context file" for use by JSON-LD processors. The most important thing this file does is classify schema.org properties as ID-valued vs literal-valued. It is served by content negotiation from schema.org homepage URL, but also available at /docs/jsonldcontext.json.txt for debugging.

Q/A

How do I over-ride the classification of a property? e.g. if 'publisher' was not marked as taking IDs, you could use: "publisher": { "@id": "http://example.com" }

e.g. if 'publisher' was marked as taking ID, how to override and give it a literal? Use: "property": { "@value": "Just a string" }

Improvements

This initial release is fairly basic. Suggestions here:

  • only mark as taking ID if a property has rangeIncludes of URL
  • add more schema hierarchy and data into the file, e.g. see this D3 demo which uses a format that is simultaneously a JSON-LD context file, D3-understandable JSON, and a minimal RDF schema.
  • use of XSD datatypes or Schema.org datatypes, i.e., xsd:date or schema.org/Date
  • discuss whether url should be an alias of JSON-LD's @id keyword
  • mark properties whose values ordered lists as "@container": "@list"