{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raskell.io/map.schema.json",
  "title": "raskell.io site graph (map.json), version 2",
  "description": "Every article, note, talk, dataset, topic, series, category, project, project group, and work from the reading log on raskell.io, and the typed, directed links between them. Built after every deploy by `mise run map-json`.",
  "type": "object",
  "required": ["version", "source", "generated", "counts", "relations", "nodes", "links"],
  "properties": {
    "$schema": { "type": "string" },
    "version": { "const": 2 },
    "source": { "type": "string", "format": "uri", "description": "The map page this graph is drawn on." },
    "generated": { "type": "string", "format": "date-time" },
    "description": { "type": "string" },
    "license": { "type": "string", "format": "uri" },
    "counts": {
      "type": "object",
      "properties": {
        "nodes": { "type": "integer" },
        "links": { "type": "integer" },
        "kinds": { "type": "object", "additionalProperties": { "type": "integer" } },
        "relations": { "type": "object", "additionalProperties": { "type": "integer" } }
      }
    },
    "relations": {
      "type": "object",
      "description": "What each link type means, subject (source) first.",
      "additionalProperties": { "type": "string" }
    },
    "nodes": { "type": "array", "items": { "$ref": "#/$defs/node" } },
    "links": { "type": "array", "items": { "$ref": "#/$defs/link" } }
  },
  "$defs": {
    "node": {
      "type": "object",
      "required": ["id", "kind", "label", "degree"],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[atscpwhu]:",
          "description": "Prefix by kind: a: a page (its path), t: a topic slug, s: a series, c: a category, p: a project slug, w: a work id from the reading log, u: an author, h: a project group."
        },
        "kind": { "enum": ["article", "note", "talk", "dataset", "tag", "series", "category", "project", "work", "author", "hub"] },
        "label": { "type": "string" },
        "url": { "type": "string" },
        "markdown": { "type": "string", "format": "uri", "description": "The page as Markdown (articles, notes, talks, datasets)." },
        "meta": { "type": "string", "description": "A short human-readable line, as shown on the map. Prefer the structured fields." },
        "description": { "type": "string" },
        "degree": { "type": "integer", "description": "How many other nodes this one is linked to." },
        "review": { "type": "boolean", "description": "An article or note that reviews a work." },
        "review_of": { "type": "string", "description": "The id of the reviewed work (w:<id>)." },
        "date": { "type": "string", "format": "date" },
        "updated": { "type": "string", "format": "date" },
        "minutes": { "type": "integer", "description": "Reading time of an article." },
        "event": { "type": "string", "description": "Where a talk was given." },
        "file": { "type": "string", "format": "uri", "description": "A dataset's data file." },
        "topic_kind": { "enum": ["domain", "concept", "technology", "site", ""] },
        "pages": { "type": "integer", "description": "Pages filed under a topic." },
        "slug": { "type": "string", "description": "A project's slug." },
        "status": { "type": "string", "description": "A project's status, or a work's reading status (reading, on-hold, next, backlog, read, set-aside)." },
        "author": { "type": "string" },
        "work_kind": { "enum": ["book", "novel", "paper", "report", "article", "essay", "journal"] },
        "year": { "type": "integer" },
        "finished": { "type": "string", "description": "YYYY-MM or YYYY." },
        "rating": { "type": "number", "minimum": 1, "maximum": 10 },
        "works": { "type": "integer", "description": "An author's works in the reading log." }
      }
    },
    "link": {
      "type": "object",
      "required": ["source", "target", "rel"],
      "properties": {
        "source": { "type": "string", "description": "The subject." },
        "target": { "type": "string", "description": "The object." },
        "rel": { "enum": ["about", "broader", "links_to", "part_of", "in_category", "mentions", "in_group", "related", "reviews", "discusses", "cites", "by"] }
      }
    }
  }
}
