{ "$schema":                      "https://json-schema.org/draft/2020-12/schema",
  "$id":                          "https://schemas.mpai.community/PTF/V1.0/data/DataExchangeMetadata.json",
  "title":                        "Data Exchange Metadata V1.0","type": "object", "required": [ "DataID", "Source" ],
                                  "additionalProperties": false, "properties": {

    "Header":                     { "type": "string", "pattern": "^PTF-DEM-V[0-9]{1,2}[.][0-9]{1,2}$" },
    "MInstanceID":                { "type": "string" },
    "DataExchangeMetadataID":     { "type": "string" },
    "DataExchangeMetadataTime":   { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Time.json" },
    "DataID":                     { "type": "string" },

    "DataType":                   { "type": "string", "pattern": "^[A-Z]{3}-[A-Z]{3}-V[0-9]{1,2}[.][0-9]{1,2}$" },

    "Source":                     { "$ref": "https://schemas.mpai.community/AIF/V3.0/data/ProcessInstance.json" },

    "Authorisations":             { "type": "array", "items": { "type": "object", "required": [ "AIMOrProcess", "Data" ],
                                    "additionalProperties": false, "properties": {
        "AIMOrProcess":           { "$ref": "https://schemas.mpai.community/AIF/V3.0/data/ProcessInstance.json" },
        "Data":                   { "type": "array", "minItems": 1, "items": { "oneOf": [
                                  { "type": "object", "required": [ "DataType" ], "additionalProperties": false, "properties": {
          "DataType":             { "type": "string", "pattern": "^[A-Z]{3}-[A-Z]{3}-V[0-9]{1,2}[.][0-9]{1,2}$" } } },
                                  { "type": "object", "required": [ "DataID" ], "additionalProperties": false, "properties": {
          "DataID":               { "type": "string" } } } ] } } } } },

    "Legality":                   { "$ref": "https://schemas.mpai.community/TFA/V1.5/data/MLModelQualifier.json#/$defs/Attributes" },

    "Security":                   { "$ref": "https://schemas.mpai.community/PTF/V3.0/data/Security.json" },

    "Confidence":                 { "type": "number", "minimum": 0, "maximum": 1 },

    "Annotations":                { "type": "array", "minItems": 1, "items": { "type": "object", "additionalProperties": false, 
                                    "required": [ "Annotation" ], "properties": {
      "Annotation":               { "oneOf": [
                                    { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/Annotation.json" },
                                    { "type": "string" } ] },
      "AnnotationTimeSpace":      { "$ref": "https://schemas.mpai.community/OSD/V1.5/data/SpaceTime.json" },
      "AnnotationRights":         { "$ref": "#/$defs/Rights" } } } } ,

    "DataXMData":                 { "$ref": "https://schemas.mpai.community/AIF/V3.0/data/DataExchangeMetadata.json" },
    "DescrMetadata":              { "type": "string", "maxLength": 2048 } },

  "$defs":                        { 
    "Rights":                     { "type": "array", "minItems": 1, "items": { "oneOf": [
                                    { "$ref": "https://schemas.mpai.community/MMM4/V2.2/data/Right.json" },
                                    { "type": "string" } ] } } } }
