{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://logicsrc.com/schemas/openontology/relationship-type.schema.json",
  "title": "LogicSRC OpenOntology Relationship Type",
  "description": "A typed connection whose object is another entity. Symmetry, transitivity, and inverses are never inferred unless declared here and explicitly permitted by a query.",
  "type": "object",
  "required": ["openontology", "kind", "id", "label", "description", "from", "to"],
  "additionalProperties": false,
  "properties": {
    "openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
    "kind": { "const": "RelationshipType" },
    "id": { "type": "string", "minLength": 1 },
    "label": { "type": "string", "minLength": 1 },
    "labels": { "$ref": "#/$defs/languageMap" },
    "description": { "type": "string", "minLength": 1 },
    "descriptions": { "$ref": "#/$defs/languageMap" },
    "from": {
      "description": "Allowed subject entity types (domain).",
      "type": "array",
      "minItems": 1,
      "items": { "type": "string" },
      "uniqueItems": true
    },
    "to": {
      "description": "Allowed object entity types (range).",
      "type": "array",
      "minItems": 1,
      "items": { "type": "string" },
      "uniqueItems": true
    },
    "cardinality": {
      "type": "string",
      "enum": ["one-to-one", "one-to-many", "many-to-one", "many-to-many"],
      "default": "many-to-many"
    },
    "temporal": {
      "type": "boolean",
      "default": false,
      "description": "Whether claims using this predicate are expected to carry valid time."
    },
    "inverse": { "type": "string", "description": "Relationship type id of the declared inverse." },
    "symmetric": { "type": "boolean", "default": false },
    "transitive": { "type": "boolean", "default": false },
    "deprecated": { "type": "boolean", "default": false },
    "deprecationNote": { "type": "string" },
    "extensions": { "type": "object" }
  },
  "$defs": {
    "languageMap": {
      "type": "object",
      "patternProperties": {
        "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$": { "type": "string" }
      },
      "additionalProperties": false
    }
  }
}
