This lesson is being piloted (Beta version)

Converting JSON-LD to triples

Overview

Teaching: 1 min
Exercises: 2 min
Questions
  • How can I generate RDF triples from an RO-Crate?

Objectives
  • Understand converting the JSON-LD to RDF triples

  • Learn how to create unique identifiers for items within an RO-Crate

Advanced: Converting JSON-LD to triples

Try modify the graph’s @context within the JSON-LD Playground (don’t modify the ro-crate-metadata.json on disk), and revisit the Table rendering.

{
  "@context": [
    "https://w3id.org/ro/crate/1.1/context",
    { "@base": "arcp://uuid,deffa754-c764-4e04-aabf-e600c6200553/" }
  ],
  "…": "…"
}

Triples table in the JSON-LD Playground

Above arcp://uuid,deffa754-c764-4e04-aabf-e600c6200553/ is a randomly generated identifier to represent the RO-Crate root, and now the JSON-LD Playground can show all the triples from the metadata file. You can likewise use the N-Quads button to convert the metadata file to the RDF N-Quads format. Most RDF libraries and stores have JSON-LD support, but may need to specify a base URI as we did above, making a new UUID for each imported RO-Crate.

Key Points

  • The JSON-LD @context maps JSON keys to schema.org vocabulary

  • A @base URI is needed to make absolute URIs

  • arcp and UUID can be used for RO-Crates that are not exposed on the Web