Adding cross-references
Overview
Teaching: 3 min
Exercises: 4 minQuestions
How can I describe an entity further?
How can I cross-reference different entities?
Objectives
Understand cross-references in flattened JSON-LD
Add a data entity reference from the root entity
Add another type to the root entity
About cross-references
In a RO-Crate Metadata Document, entities are cross-referenced using @id
reference objects, rather than using deeply nested JSON objects.
In short, this flattened JSON-LD style (shown below) allows any entity to reference any other entity, and RO-Crate consumers can directly find all the descriptions of a given entity as a single JSON object.
Add cross-reference to data entity
Consider the root Data Entity
./
, and add such a cross-reference to the filedata.csv
using the property calledhasPart
:Solution
{ "@id": "./", "@type": "Dataset", "hasPart": [ {"@id": "data.csv"} ], "…": "…" }
The RO-Crate root is always typed Dataset
, though @type
may in some cases have additional types by using a JSON array instead of a single value. Most entities can have such more specific types, e.g. chosen from schema.org type list.
Add an additional type
- Navigate the schema.org type list to find a subtype of
CreativeWork
that is suitable for a learning resource.- Modify the root entity’s
@type
to be an array.- Add the type name for learning resource at the end of the array.
Solution
{ "@id": "./", "@type": ["Dataset", "LearningResource"], "hasPart": [ {"@id": "data.csv"} ], "…": "…" }
The root has several metadata properties that describe the RO-Crate as a whole, considering it as a Research Object of collected resources. The section on root data entity details further the required and recommended properties of the root ./
.
Key Points
The @id uniquely identifies the entity within the RO-Crate
The @id key is used for cross-referencing
Multiple types can be listed by using an array