JSON-LD (JavaScript Object Notation for Linked Data) is standard to serialize RDF graphs using JSON. This serialization format is convenient to the project because JSON is widely used, and many tools and programming languages already include functions to create files in JSON format. In this guide we show how to define JSON-LD documents.
JSON-LD (JavaScript Object Notation for Linked Data) is a standard to serialize RDF graphs using JSON. This serialisation format is convenient to the project because JSON is widely used, and many tools and programming languages already include functions to create files in JSON format. In this guide, we show how to define JSON-LD documents.
## Basic extructure of JSON-LD
## Basic structure of JSON-LD
The next example describes how an RDF graph representing a property definition in an ontology can be serialised using JSON-LD. Specifically, it shows the `:contains` property which defines a relationship between Assemblies (domain) and Components (range).
**Example**: Ontology **`:contains`** property:
...
...
@@ -23,21 +25,23 @@ JSON-LD (JavaScript Object Notation for Linked Data) is standard to serialize RD
}
```
The context maps "contains" to its full IRI.
The `@context` section maps the shorthand term "contains" to its full IRI. This context is essential in JSON-LD because it provides meaning to JSON keys by linking them to globally unique identifiers (IRIs), enabling compatibility between systems.
#### **1.2 How to define Context?**
In JSON-LD, the `@context` defines how JSON terms map to IRIs in the ontology. It serves the same purpose as Turtle's `@prefix` declarations, allowing compact representation of IRIs and preserving relationships.
##### **Rule 1: IRI Resolution**
Turtle uses _`@prefix`_\* . JSON-LD's **`@context`** maps these to full IRIs.
Turtle uses `@prefix`\* . JSON-LD's **`@context`** maps these to full IRIs.