JSON-LD and Schema.org

This session will be about exploring and authoring data in JSON-LD and with Schema.org, for embedding structured information in Web pages. Create a text file named <yourfirstname-yourlastname.txt> where you will copy your answers to the questions that you will send to Antoine Zimmermann and Victor Charpenay.

Observing deployed JSON-LD

In this part, you simply observe existing examples on the Web. JSON-LD data can be embedded directly in Web pages inside a <script> element. To recognise JSON-LD code, the <script> element must have the attribute type="application/ld+json". Also, the presence of the key @context in JSON data suggests that it is JSON-LD.

Writing a context for existing JSON files

We will enhance existing JSON data by adding a @context. To test JSON-LD code, you can use the JSON-LD Playground.

Reshaping JSON-LD files

In the last session, you uploaded Turtle files to a Linked Data platform. The platform supports content negotiation: you may now ask to return the uploaded data in JSON-LD, instead of Turtle. Send a GET request with the appropriate header so that the returned RDF graph has content type application/ld+json.

The JSON-LD file you obtained is in an expanded form. No objects are nested inside other objects. Write a JSON-LD context with as many definitions as possible, to turn the expanded JSON-LD file to a more compact variant. Make sure the two files (the expanded JSON-LD file and a compacted variant that includes a @context and one or more objects) are equivalent. Two JSON-LD files are equivalent if they encode the same RDF triples. Re-upload the compact variant to the Linked Data platform under another URI (to compare them).

Writing JSON-LD using Schema.org

Consider the data you wrote in Turtle during the second session. Rewrite it in JSON-LD and try to use Schema.org concepts as much as possible.