{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sguzman.github.io/chromalect/ontology/instances.schema.json",
  "title": "Chromalect ontology instance graph v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "version",
    "ontologyRef",
    "profile",
    "status",
    "nodes",
    "edges",
    "sources"
  ],
  "properties": {
    "schema": {
      "const": "chromalect.ontology-instances.v1"
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "ontologyRef": {
      "const": "ontology/ontology-v1.json"
    },
    "profile": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "explanation": {
      "type": "string"
    },
    "nodes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "type",
          "label",
          "status",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 3
          },
          "type": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "status": {
            "enum": [
              "source_aligned",
              "candidate",
              "unresolved",
              "independently_verified",
              "illustrative",
              "not_implemented"
            ]
          },
          "data": {
            "type": "object"
          }
        }
      }
    },
    "edges": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "from",
          "relation",
          "to"
        ],
        "properties": {
          "from": {
            "type": "string"
          },
          "relation": {
            "type": "string"
          },
          "to": {
            "type": "string"
          }
        }
      }
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "path",
          "role"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "lookup": {
            "type": "object"
          },
          "role": {
            "type": "string"
          }
        }
      }
    }
  }
}
