Skip to content

Commit c10fc76

Browse files
committed
source commit: 74a464e
0 parents  commit c10fc76

34 files changed

Lines changed: 3770 additions & 0 deletions

01-introduction.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: Introduction
3+
teaching: 17
4+
exercises: 0
5+
#requirements:
6+
#- type: none
7+
# title: "Files and folder organization"
8+
#- type: none
9+
# title: "Familiarity with JSON file format and editor/IDE"
10+
#- type: external
11+
# title: "An overview of the RO-Crate concept and its implementations"
12+
# link: "https://gallantries.github.io/video-library/videos/ro-crates/intro/slides/"
13+
#- type: "internal"
14+
# topic_name: data-science
15+
# tutorials:
16+
# - cli-basics
17+
#
18+
#license: Apache-2.0
19+
#
20+
#copyright: © Copyright 2021-2023 University of Technology Sydney, The University of Manchester UK and RO-Crate contributors
21+
#
22+
---
23+
24+
::::::::::::::::::::::::::::::::::::::: questions
25+
- How do I package data in a FAIR way?
26+
- How can I list the authors of individual files?
27+
- Can I use multiple licenses in the same data package?
28+
- How can I visualize JSON-LD metadata?
29+
::::::::::::::::::::::::::::::::::::::::::::::::::
30+
31+
::::::::::::::::::::::::::::::::::::::: objectives
32+
- Construct an RO-Crate by hand using JSON
33+
- Describe each part of the Research Object
34+
- Learn basic JSON-LD to create FAIR metadata
35+
- Connect different parts of the Research Object using identifiers
36+
::::::::::::::::::::::::::::::::::::::::::::::::::
37+
38+
39+
## Introduction
40+
41+
This tutorial assumes you have already completed
42+
[An overview of the RO-Crate concept and its implementations](https://gallantries.github.io/video-library/videos/ro-crates/intro/slides/):
43+
44+
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/5GYdN5B1tc8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
45+
<a href="https://www.youtube.com/watch?v=5GYdN5B1tc8"><img src="https://i.ytimg.com/vi/5GYdN5B1tc8/maxresdefault.jpg" alt="An overview of the RO-Crate concept and its implementations" />
46+
</iframe>
47+
48+
_Video: An overview of the RO-Crate concept and its implementations_ (see also [slides and transcript](https://doi.org/10.5281/zenodo.7828632))
49+
50+
51+
## Tutorial walk-through
52+
53+
In this tutorial, meant to be read along with the [RO-Crate specification](https://www.researchobject.org/ro-crate/1.1/),
54+
we'll walk through the initial steps for creating a basic RO-Crate.
55+
You are invited to replicate the below steps on your local computer.
56+
57+
::::::::::::::::::::::::::::::::::::::: callout
58+
## Abbreviations
59+
- FAIR: Findable, Accessible, Interoperable, Reusable; a set of principles for publishing research data and metadata
60+
- JSON: JavaScript Object Notation, a generic structured text-based data format
61+
- JSON-LD: JSON Linked Data, a way to express Linked Data (RDF) using regular JSON
62+
- RO-Crate: Research Object Crate; a way to package research data with structured FAIR metadata
63+
::::::::::::::::::::::::::::::::::::::::::::::::::
64+
65+
::::::::::::::::::::::::::::::::::::::: keypoints
66+
- RO-Crate provides a structure to make FAIR data packages
67+
- schema.org in JSON-LD provides a controlled vocabulary for FAIR metadata
68+
- Each entity of the crate is described separately
69+
- Cross-references between entities create a graph
70+
- The RO-Crate specification recommends which types and keys to use
71+
::::::::::::::::::::::::::::::::::::::::::::::::::

02-folder-as-crate-root.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: Turning a folder into an RO-Crate
3+
teaching: 4
4+
exercises: 3
5+
---
6+
7+
::::::::::::::::::::::::::::::::::::::: objectives
8+
- Creating a skeleton RO-Crate Metadata File
9+
- Use the JSON-LD pre-amble to enable Linked Data
10+
::::::::::::::::::::::::::::::::::::::::::::::::::
11+
12+
:::::::::::::::::::::::::::::::::::::::: questions
13+
- How can I start a new RO-Crate?
14+
::::::::::::::::::::::::::::::::::::::::::::::::::
15+
16+
17+
18+
## Turning a folder into an RO-Crate
19+
20+
In the simplest form, to describe some data on disk,
21+
an _RO-Crate Metadata File_ is placed in a folder
22+
alongside a set of files or folders.
23+
24+
First create a new folder `crate1/`
25+
and add a single file `data.csv` to represent our dataset:
26+
27+
```
28+
"Date","Minimum temperature (°C)","Maximum temperature (°C)","Rainfall (mm)"
29+
2022-02-01,16.0,28.4,0.6
30+
2022-02-02,16.3,17.2,12.4
31+
```
32+
33+
34+
Next, to turn this folder into an RO-Crate,
35+
we need to add the _RO-Crate Metadata File_, which has a fixed filename.
36+
Create the file `ro-crate-metadata.json`
37+
using [Visual Studio Code](https://code.visualstudio.com/) or your favourite editor,
38+
then add the following JSON:
39+
40+
```json
41+
{
42+
"@context": "https://w3id.org/ro/crate/1.1/context",
43+
"@graph": [
44+
45+
]
46+
}
47+
```
48+
49+
Your folder should now look like this:
50+
51+
![Folder listing of crate1, including data.csv and ro-crate-metadata.json](fig/crate1-folders.svg){alt='Any folder can be made into an RO-Crate by adding `ro-crate-metadata.json`'}
52+
53+
The presence of the reserved `ro-crate-metadata.json` filename
54+
means that `crate1` (and its children) can now be considered to be an **RO-Crate**.
55+
We call the top-level folder of the crate for the **RO-Crate Root**
56+
and can now refer to its content with relative file paths.
57+
58+
We also need to make some declaration within the JSON file to turn it into a valid _RO-Crate Metadata Document_,
59+
explained in the next session.
60+
61+
62+
## JSON-LD preamble
63+
64+
The preamble of `@context` and `@graph` are JSON-LD structures
65+
that help provide global identifiers to the JSON keys and types
66+
used in the rest of the RO-Crate document.
67+
These will largely map to definitions in the [schema.org](http://schema.org/) vocabulary,
68+
which can be used by RO-Crate extensions to provide additional metadata beyond the RO-Crate specifications.
69+
It is this feature of JSON-LD that helps make RO-Crate extensible for many different purposes
70+
-- this is explored further in the specification's [appendix on JSON-LD](https://www.researchobject.org/ro-crate/1.1/appendix/jsonld.html).
71+
In short, only JSON keys (_properties_) and types defined this way can be used within the RO-Crate Metadata Document.
72+
73+
However, in the general case it should be sufficient to follow the RO-Crate JSON examples directly without deeper JSON-LD understanding.
74+
The RO-Crate Metadata Document contains a flat list of _entities_ as JSON objects in the `@graph` array.
75+
These entities are cross-referenced using `@id` identifiers, rather than being deeply nested.
76+
This is one major difference from JSON structures you may have experienced before.
77+
The `@type` keyword associates an object with a predefined type from the JSON-LD context.
78+
Almost any property can alternatively be used with an `[]` array to provide multiple values.
79+
80+
The rest of this tutorial,
81+
and indeed most of the [RO-Crate specification](https://www.researchobject.org/ro-crate/1.1/),
82+
specify which entities can be added to the `@graph` array.
83+
84+
85+
:::::::::::::::::::::::::::::::::::::::: keypoints
86+
- Adding a RO-Crate Metadata file to a folder turns it into an RO-Crate
87+
- The RO-Crate Root is the top-level folder of the crate
88+
- RO-Crate uses schema.org as base vocabulary
89+
- The JSON-LD context enables optional Linked Data processing
90+
- Descriptions are listed flatly as entities in the @graph array
91+
::::::::::::::::::::::::::::::::::::::::::::::::::
92+

03-metadata-descriptor.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Making a metadata descriptor
3+
teaching: 2
4+
exercises: 2
5+
6+
---
7+
8+
::::::::::::::::::::::::::::::::::::::: questions
9+
- Which RO-Crate version is used?
10+
- How can the crate self-identify as an RO-Crate?
11+
::::::::::::::::::::::::::::::::::::::::::::::::::
12+
13+
::::::::::::::::::::::::::::::::::::::: objectives
14+
- Add the first entity to the JSON-LD @graph
15+
- Indicate the version of RO-Crate
16+
::::::::::::::::::::::::::::::::::::::::::::::::::
17+
18+
## RO-Crate Metadata descriptor
19+
20+
The first JSON-LD _entity_ to add in the `@graph` array has the `@id` value of `ro-crate-metadata.json` to describe the JSON file itself:
21+
22+
23+
```json
24+
{
25+
"@id": "ro-crate-metadata.json",
26+
"@type": "CreativeWork",
27+
"conformsTo": {"@id": "https://w3id.org/ro/crate/1.1"},
28+
"about": {"@id": "./"}
29+
}
30+
```
31+
32+
This required entity, known as the [RO-Crate Metadata Descriptor](https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#ro-crate-metadata-file-descriptor),
33+
helps this file self-identify as an RO-Crate Metadata Document,
34+
which is conforming to (`conformsTo`) the RO-Crate specification version 1.1.
35+
Notice that the `conformsTo` URL corresponds to the `@context` URL version-wise,
36+
but they have two different functions.
37+
The context brings the defined terms into the metadata document,
38+
while the conformance declares which RO-Crate conventions of using those terms are being followed.
39+
40+
::::::::::::::::::::::::::::::::::::::: callout
41+
## RO-Crate versions
42+
This tutorial is written for RO-Crate 1.1,
43+
the RO-Crate website will list the [current specification version](https://www.researchobject.org/ro-crate/specification.html)
44+
-- RO-Crates can generally be upgraded to newer versions following [semantic versioning](https://semver.org/) conventions,
45+
but check the [change log](https://www.researchobject.org/ro-crate/1.1/appendix/changelog.html) for any important changes.
46+
The next development version of the specification, indicated with a `-DRAFT` status,
47+
may still be subject to changes and should only be used with caution.
48+
::::::::::::::::::::::::::::::::::::::::::::::::::
49+
50+
::::::::::::::::::::::::::::::::::::::: keypoints
51+
- The RO-Crate Metadata Descriptor describes the JSON-LD file itself
52+
- RO-Crate specifications are versioned
53+
- The version of RO-Crate is indicated using the conformsTo property
54+
::::::::::::::::::::::::::::::::::::::::::::::::::
55+
56+

04-root.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Declaring the root folder
3+
teaching: 2
4+
exercises: 1
5+
---
6+
7+
:::::::::::::::::::::::::::::::::::::::: questions
8+
- What is the root folder?
9+
::::::::::::::::::::::::::::::::::::::::::::::::::
10+
11+
:::::::::::::::::::::::::::::::::::::::: objectives
12+
- Create a top-level entity that can list the parts of the crate
13+
::::::::::::::::::::::::::::::::::::::::::::::::::
14+
15+
## RO-Crate Root
16+
17+
Next we'll add another entity to the `@graph` array,
18+
to describe the [RO-Crate Root](https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#direct-properties-of-the-root-data-entity):
19+
20+
```json
21+
{
22+
"@id": "./",
23+
"@type": "Dataset",
24+
"hasPart": [
25+
26+
]
27+
}
28+
```
29+
30+
:::::::::::::::::::::::::::::::::::::::: callout
31+
## Adding entities to the JSON array
32+
33+
Because we're adding incrementally to the `@graph` array.
34+
It is important to remember the comma `,` between each entity,
35+
**except** for the final entity in the JSON array;
36+
and likewise for the properties within the JSON object for each entity.
37+
This is an artefact of the strict [JSON](https://www.json.org/) file format rules to simplify parsing.
38+
The order of the entities within the `@graph` JSON-LD array
39+
and the order of the keys within a JSON object is _not significant_.
40+
The _graph_ content is given by the `@id` cross-references.
41+
42+
You will add a comma here between the `ro-crate-metadata.json` entity, and the root data entity.
43+
::::::::::::::::::::::::::::::::::::::::::::::::::
44+
45+
By convention, in RO-Crate the `@id` value of `./` means that this entity describes the folder in which the RO-Crate metadata file is located.
46+
This reference from `ro-crate-metadata.json` is therefore semantically marking the `crate1` folder as being the RO-Crate Root.
47+
48+
49+
:::::::::::::::::::::::::::::::::::::::: discussion
50+
## RO-Crates can be published on the Web
51+
52+
This example is a folder-based RO-Crate stored on disk,
53+
and therefore absolute paths are avoided,
54+
e.g. in case the root folder is moved or archived as a ZIP file.
55+
56+
If the crate is being served from a Web service,
57+
such as a data repository or database where files are not organized in folders,
58+
then the `@id` might be an absolute URI instead of `./`
59+
-- this is one reason why we point to the root entity from the metadata descriptor,
60+
see section [Root Data Entity](https://www.researchobject.org/ro-crate/1.1/root-data-entity.html) for details.
61+
::::::::::::::::::::::::::::::::::::::::::::::::::
62+
63+
:::::::::::::::::::::::::::::::::::::::: keypoints
64+
- The RO-Crate Root is the top-level object of the RO-Crate
65+
- The root identifier may be a URL, but commonly just ./ for the current folder
66+
::::::::::::::::::::::::::::::::::::::::::::::::::
67+

05-root-metadata.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Describing the root entity
3+
teaching: 4
4+
exercises: 4
5+
---
6+
:::::::::::::::::::::::::::::::::::::::: questions
7+
- How can I describe the crate?
8+
- How do I specify the license of the RO-Crate?
9+
::::::::::::::::::::::::::::::::::::::::::::::::::
10+
11+
:::::::::::::::::::::::::::::::::::::::: objectives
12+
- Learn about required metadata for the RO-Crate Root
13+
- Understand license identifiers using SPDX
14+
::::::::::::::::::::::::::::::::::::::::::::::::::
15+
16+
## Describing the root entity
17+
18+
When describing the [root entity](https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#direct-properties-of-the-root-data-entity),
19+
the properties generally apply to the whole of the crate.
20+
For instance it is a good idea to give a description of why these resources are gathered in a crate,
21+
as well as giving the crate a name and license for FAIR reuse and citation.
22+
23+
:::::::::::::::::::::::::::::::::::::::: challenge
24+
## Add metadata to root entity
25+
26+
Try to add the `name`, `description` and `datePublished` properties,
27+
and for `license` as a cross-reference,
28+
use [SPDX](https://spdx.org/licenses/) license list to find the identifier for Creative Commons Zero
29+
or another license of your choice:
30+
31+
::::::::::::::: solution
32+
```json
33+
{
34+
"@id": "./",
35+
"@type": "Dataset",
36+
"hasPart": [ ],
37+
"name": "Example crate",
38+
"description": "I created this example by following the tutorial",
39+
"datePublished": "2023-05-22T12:03:00+0100",
40+
"license": { "@id": "http://spdx.org/licenses/CC0-1.0"}
41+
}
42+
```
43+
:::::::::::::::::::::::::
44+
45+
::::::::::::::::::::::::::::::::::::::::::::::::::
46+
47+
48+
:::::::::::::::::::::::::::::::::::::::: callout
49+
## License identifiers
50+
51+
In the above solution,
52+
the identifier for CC0-1.0 <http://spdx.org/licenses/CC0-1.0> is slightly
53+
different from their listed web page URI <https://spdx.org/licenses/CC0-1.0.html>
54+
-- the former is chosen to align with [SPDX JSON-LD identifiers](https://github.com/spdx/license-list-data/tree/main/jsonld),
55+
which unfortunately are not shown directly on their website as _permalinks_.
56+
It is not a requirement in RO-Crate to use permalinks for `@id` of entities like licenses,
57+
it is nevertheless best practice to propagate permalinks where known.
58+
::::::::::::::::::::::::::::::::::::::::::::::::::
59+
60+
:::::::::::::::::::::::::::::::::::::::: discussion
61+
## Choosing a license
62+
63+
Choosing a license appropriate for your dataset can be non-trivial,
64+
particularly if third-party data/software and multiple organizations are involved.
65+
See [FAIR Cookbook on licensing](https://faircookbook.elixir-europe.org/content/recipes/reusability/ATI-licensing.html).
66+
It is worth noting that an RO-Crate permits data entities to have a `license` different from the overall Crate license.
67+
It is still recommended to choose an overall Crate license that can legally apply across all the content in the RO-Crate Root.
68+
::::::::::::::::::::::::::::::::::::::::::::::::::
69+
70+
:::::::::::::::::::::::::::::::::::::::: keypoints
71+
- Name, description, date published and license are required for the RO-Crate Root"
72+
- RO-Crate allows multiple licenses for different parts
73+
::::::::::::::::::::::::::::::::::::::::::::::::::
74+
75+
76+

0 commit comments

Comments
 (0)