YAML-LD: Linked Data for Humans & Agents

Anatoly Scherbakov · Dataworthy · 11 Sep 2026

YAML-LD

Dataworthy · 11 Sep 2026 · Anatoly Scherbakov

JSON-LD

1322 bytes

{
  "@context": {
    "schema": "https://schema.org/",
    "dbo": "http://dbpedia.org/ontology/",
    "dbp": "http://dbpedia.org/property/",
    "dbr": "http://dbpedia.org/resource/",
    "name": "schema:name",
    "description": "schema:description",
    "contains": { "@id": "schema:hasPart", "@type": "@id" },
    "is-orbited-by": { "@reverse": "dbp:star" }
  },
  "@id": "dbr:Alpha_Centauri",
  "name": "Alpha Centauri",
  "description": "The closest star system to the Solar System.",
  "contains": {
    "@id": "dbr:Alpha_Centauri_AB",
    "name": "Alpha Centauri AB",
    "contains": [
      {
        "@id": "dbr:Alpha_Centauri_A",
        "@type": "dbo:Star",
        "name": "Alpha Centauri A"
      },
      {
        "@id": "dbr:Alpha_Centauri_B",
        "@type": "dbo:Star",
        "name": "Alpha Centauri B"
      }
    ],
    "is-orbited-by": [
      {
        "@id": "dbr:Proxima_Centauri",
        "@type": "dbo:Star",
        "name": "Proxima Centauri",
        "is-orbited-by": [
          {
            "@id": "dbr:Proxima_Centauri_b",
            "@type": "dbo:Planet",
            "name": "Proxima Centauri b"
          },
          {
            "@id": "dbr:Proxima_Centauri_d",
            "@type": "dbo:Planet",
            "name": "Proxima Centauri d"
          }
        ]
      }
    ]
  }
}

JSON ⊊ YAML

JSON-LD
(and YAML-LD 😏)

1322 bytes

{
  "@context": {
    "schema": "https://schema.org/",
    "dbo": "http://dbpedia.org/ontology/",
    "dbp": "http://dbpedia.org/property/",
    "dbr": "http://dbpedia.org/resource/",
    "name": "schema:name",
    "description": "schema:description",
    "contains": { "@id": "schema:hasPart", "@type": "@id" },
    "is-orbited-by": { "@reverse": "dbp:star" }
  },
  "@id": "dbr:Alpha_Centauri",
  "name": "Alpha Centauri",
  "description": "The closest star system to the Solar System.",
  "contains": {
    "@id": "dbr:Alpha_Centauri_AB",
    "name": "Alpha Centauri AB",
    "contains": [
      {
        "@id": "dbr:Alpha_Centauri_A",
        "@type": "dbo:Star",
        "name": "Alpha Centauri A"
      },
      {
        "@id": "dbr:Alpha_Centauri_B",
        "@type": "dbo:Star",
        "name": "Alpha Centauri B"
      }
    ],
    "is-orbited-by": [
      {
        "@id": "dbr:Proxima_Centauri",
        "@type": "dbo:Star",
        "name": "Proxima Centauri",
        "is-orbited-by": [
          {
            "@id": "dbr:Proxima_Centauri_b",
            "@type": "dbo:Planet",
            "name": "Proxima Centauri b"
          },
          {
            "@id": "dbr:Proxima_Centauri_d",
            "@type": "dbo:Planet",
            "name": "Proxima Centauri d"
          }
        ]
      }
    ]
  }
}

YAML-LD

996 bytes 24.7% below JSON-LD −326 B

"@context":
  schema: https://schema.org/
  dbo: http://dbpedia.org/ontology/
  dbp: http://dbpedia.org/property/
  dbr: http://dbpedia.org/resource/
  name: schema:name
  description: schema:description
  contains:
    "@id": schema:hasPart
    "@type": "@id"
  is-orbited-by:
    "@reverse": dbp:star
"@id": dbr:Alpha_Centauri
name: Alpha Centauri
description: The closest star system to the Solar System.
contains:
  "@id": dbr:Alpha_Centauri_AB
  name: Alpha Centauri AB
  contains:
    - "@id": dbr:Alpha_Centauri_A
      "@type": dbo:Star
      name: Alpha Centauri A
    - "@id": dbr:Alpha_Centauri_B
      "@type": dbo:Star
      name: Alpha Centauri B
  is-orbited-by:
    - "@id": dbr:Proxima_Centauri
      "@type": dbo:Star
      name: Proxima Centauri
      is-orbited-by:
        - "@id": dbr:Proxima_Centauri_b
          "@type": dbo:Planet
          name: Proxima Centauri b
        - "@id": dbr:Proxima_Centauri_d
          "@type": dbo:Planet
          name: Proxima Centauri d

@ needs to stay quoted, $ does not

1040 bytes 21.3% below JSON-LD +44 B

"@context":
  "@import": https://json-ld.org/contexts/dollar-convenience.jsonld
  schema: https://schema.org/
  dbo: http://dbpedia.org/ontology/
  dbp: http://dbpedia.org/property/
  dbr: http://dbpedia.org/resource/
  name: schema:name
  description: schema:description
  contains:
    "@id": schema:hasPart
    "@type": "@id"
  is-orbited-by:
    "@reverse": dbp:star
$id: dbr:Alpha_Centauri
name: Alpha Centauri
description: The closest star system to the Solar System.
contains:
  $id: dbr:Alpha_Centauri_AB
  name: Alpha Centauri AB
  contains:
    - $id: dbr:Alpha_Centauri_A
      $type: dbo:Star
      name: Alpha Centauri A
    - $id: dbr:Alpha_Centauri_B
      $type: dbo:Star
      name: Alpha Centauri B
  is-orbited-by:
    - $id: dbr:Proxima_Centauri
      $type: dbo:Star
      name: Proxima Centauri
      is-orbited-by:
        - $id: dbr:Proxima_Centauri_b
          $type: dbo:Planet
          name: Proxima Centauri b
        - $id: dbr:Proxima_Centauri_d
          $type: dbo:Planet
          name: Proxima Centauri d

Comments

"@context":
  # dollar-convenience supplies $id and $type, so they can stay unquoted
  "@import": https://json-ld.org/contexts/dollar-convenience.jsonld
  schema: https://schema.org/
  dbo: http://dbpedia.org/ontology/
  dbp: http://dbpedia.org/property/
  dbr: http://dbpedia.org/resource/
  # name is shorthand for schema:name
  name: schema:name

  # walk dbp:star backwards to the planets that orbit this star
  is-orbited-by:
    "@reverse": dbp:star

# red dwarf; frequent flares
$id: dbr:Proxima_Centauri
$type: dbo:Star
name: Proxima Centauri
is-orbited-by:

  # possibly tidally locked; maybe rocky; mass similar to Earth
  # Located in the star's habitable zone, so might have liquid water on the surface
  - $id: dbr:Proxima_Centauri_b
    $type: dbo:Planet
    name: Proxima Centauri b

  # likely rocky; more like Mercury
  - $id: dbr:Proxima_Centauri_d
    $type: dbo:Planet
    name: Proxima Centauri d

& anchors, *aliases

"@context":
  dbo: http://dbpedia.org/ontology/
  dbp: http://dbpedia.org/property/
  dbr: http://dbpedia.org/resource/

  # &iri labels this complete term definition
  dbp:star:            &iri
    "@type": "@id"

  # *iri reuses it for the other IRI-valued terms
  dbp:discoveryMethod: *iri
  dbp:discoverySite:   *iri

"@id": dbr:Proxima_Centauri_b
dbp:star:            dbr:Proxima_Centauri
dbp:discoveryMethod: dbr:Doppler_spectroscopy
dbp:discoverySite:   dbr:European_Southern_Observatory
Flag of Norway

YAML 1.1

country: NO
country: false

YAML-LD requires YAML 1.2+

YAML 1.2+

country: NO
country: "NO"

Keys are strings

mapping-key-error

"@context":
  dbp: http://dbpedia.org/property/
  dbr: http://dbpedia.org/resource/
  xsd: http://www.w3.org/2001/XMLSchema#
  dbp:discovered: { "@type": xsd:date }
  dbp:star: { "@type": "@id" }
  dbp:discoverer: { "@type": "@id" }

? { "@id": dbr:Proxima_Centauri_b,
    dbp:star: dbr:Proxima_Centauri }
:
  dbp:discovered: 2016-08-24
  dbp:discoverer: dbr:Guillem_Anglada-Escudé

YAML-LD 1.0

W3C Working Draft

Recommendation track

Where implementations stand

PyLD

Python

In progress

In memoriam

Gregg Kellogg

6 September 2025

A central figure in JSON-LD for more than a decade.

Among many other contributions to open standards and open software, Gregg initiated and inspired YAML-LD development.

Portrait of Gregg Kellogg

Acknowledgements

Bonus

Markdown

# Proxima Centauri

A red dwarf with frequent flares.

## Proxima Centauri b

Possibly tidally locked; maybe rocky; mass similar to Earth.

Located in the star's habitable zone, so might have liquid water on the surface.

## Proxima Centauri d

Likely rocky; more like Mercury.

Markdown-LD

---
"@context":
  "@import": https://json-ld.org/contexts/dollar-convenience.jsonld
  schema: https://schema.org/
  dbo: http://dbpedia.org/ontology/
  dbp: http://dbpedia.org/property/
  dbr: http://dbpedia.org/resource/
  name: schema:name

  is-orbited-by:
    "@reverse": dbp:star

$id: dbr:Proxima_Centauri
$type: dbo:Star
name: Proxima Centauri
is-orbited-by:

  - $id: dbr:Proxima_Centauri_b
    $type: dbo:Planet
    name: Proxima Centauri b

  - $id: dbr:Proxima_Centauri_d
    $type: dbo:Planet
    name: Proxima Centauri d
---

# Proxima Centauri

A red dwarf with frequent flares.

## Proxima Centauri b

Possibly tidally locked; maybe rocky; mass similar to Earth.

Located in the star's habitable zone, so might have liquid water on the surface.

## Proxima Centauri d

Likely rocky; more like Mercury.

Questions?

This presentation alpha-centauri-demo.iolanta.tech