{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vocab.danielberanek.cz/semantic-change-feed/schema.json",
  "title": "DIO/ODI Semantic Change Feed",
  "type": "object",
  "required": [
    "feed_version",
    "schema_version",
    "feed_uri",
    "generated_on",
    "title",
    "description",
    "author",
    "policy",
    "event_count",
    "events"
  ],
  "properties": {
    "feed_version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "schema_version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "feed_uri": {
      "type": "string",
      "format": "uri"
    },
    "generated_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string",
      "minLength": 1
    },
    "author": {
      "type": "object",
      "required": [
        "name",
        "person_uri",
        "orcid"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "person_uri": {
          "type": "string",
          "format": "uri"
        },
        "orcid": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "policy": {
      "type": "object",
      "required": [
        "append_only",
        "manual_semantic_curation",
        "git_diffs_are_not_authoritative",
        "correction_rule"
      ],
      "properties": {
        "append_only": {
          "const": true
        },
        "manual_semantic_curation": {
          "const": true
        },
        "git_diffs_are_not_authoritative": {
          "const": true
        },
        "correction_rule": {
          "type": "string"
        }
      }
    },
    "event_count": {
      "type": "integer",
      "minimum": 0
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/event"
      }
    }
  },
  "$defs": {
    "source": {
      "type": "object",
      "required": [
        "label",
        "url",
        "role"
      ],
      "properties": {
        "label": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "role": {
          "type": "string"
        }
      }
    },
    "scope": {
      "type": "object",
      "required": [
        "component",
        "component_type",
        "uri",
        "role"
      ],
      "properties": {
        "component": {
          "type": "string"
        },
        "component_type": {
          "type": "string"
        },
        "uri": {
          "type": "string",
          "format": "uri"
        },
        "role": {
          "type": "string"
        }
      }
    },
    "event": {
      "type": "object",
      "required": [
        "id",
        "date",
        "date_basis",
        "event_class",
        "change_type",
        "title",
        "summary",
        "scope",
        "before",
        "after",
        "preserved_invariants",
        "impact",
        "evidence",
        "lineage"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^SCF-\\d{4}-\\d{3}$"
        },
        "date": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "date_basis": {
          "enum": [
            "publication_date",
            "first_archival_inclusion",
            "version_publication_date",
            "archive_publication_date",
            "hub_changelog_date",
            "activity_period"
          ]
        },
        "event_class": {
          "enum": [
            "Conceptual",
            "Relational",
            "Theoretical",
            "Structural",
            "Provenance",
            "Mapping",
            "Artifact",
            "Distribution",
            "ResearchProcess"
          ]
        },
        "change_type": {
          "enum": [
            "introduced",
            "refined",
            "reclassified",
            "extended",
            "synchronized",
            "archived",
            "corrected",
            "deprecated",
            "published",
            "documented",
            "distributed"
          ]
        },
        "title": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        },
        "scope": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/scope"
          }
        },
        "before": {
          "type": "string"
        },
        "after": {
          "type": "string"
        },
        "preserved_invariants": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "impact": {
          "type": "object",
          "required": [
            "level",
            "compatibility",
            "affected_components",
            "notes"
          ],
          "properties": {
            "level": {
              "enum": [
                "conceptual-model",
                "taxonomy",
                "vocabulary",
                "mapping",
                "metadata",
                "archive",
                "cross-layer",
                "distribution",
                "provenance"
              ]
            },
            "compatibility": {
              "enum": [
                "model-level",
                "non-normative-derived-layer",
                "metadata-only",
                "provenance-only",
                "archive-only",
                "not-assessed",
                "distribution-only"
              ]
            },
            "affected_components": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "notes": {
              "type": "string"
            }
          }
        },
        "evidence": {
          "type": "object",
          "required": [
            "status",
            "basis",
            "temporal_note",
            "sources"
          ],
          "properties": {
            "status": {
              "enum": [
                "documented",
                "reconstructed",
                "partially-documented"
              ]
            },
            "basis": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "primary-publication",
                  "source-map",
                  "release-notes",
                  "registry",
                  "archival-record",
                  "hub-changelog",
                  "linked-publication-or-artifact",
                  "public-version-history"
                ]
              }
            },
            "temporal_note": {
              "type": "string"
            },
            "sources": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/source"
              }
            }
          }
        },
        "lineage": {
          "type": "object",
          "required": [
            "related_to",
            "supersedes",
            "corrects"
          ],
          "properties": {
            "related_to": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "supersedes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "corrects": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "date_range_start": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "date_range_end": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        }
      }
    }
  }
}
