json-graph-schema_v2.json 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema#",
  3. "$id": "http://jsongraphformat.info/v2.1/json-graph-schema.json",
  4. "title": "JSON Graph Schema",
  5. "oneOf": [
  6. {
  7. "type": "object",
  8. "properties": {
  9. "graph": { "$ref": "#/definitions/graph" }
  10. },
  11. "additionalProperties": false,
  12. "required": [
  13. "graph"
  14. ]
  15. },
  16. {
  17. "type": "object",
  18. "properties": {
  19. "graphs": {
  20. "type": "array",
  21. "items": { "$ref": "#/definitions/graph" }
  22. }
  23. },
  24. "additionalProperties": false
  25. }
  26. ],
  27. "definitions": {
  28. "graph": {
  29. "oneOf": [
  30. {
  31. "type": "object",
  32. "additionalProperties": false,
  33. "properties": {
  34. "id": { "type": "string" },
  35. "label": { "type": "string" },
  36. "directed": { "type": [ "boolean" ], "default": true },
  37. "type": { "type": "string" },
  38. "metadata": { "type": [ "object" ] },
  39. "nodes": {
  40. "type": "object",
  41. "additionalProperties": { "$ref": "#/definitions/node" }
  42. },
  43. "edges": {
  44. "type": [ "array" ],
  45. "items": { "$ref": "#/definitions/edge" }
  46. }
  47. }
  48. },
  49. {
  50. "type": "object",
  51. "additionalProperties": false,
  52. "properties": {
  53. "id": { "type": "string" },
  54. "label": { "type": "string" },
  55. "directed": { "type": [ "boolean" ], "default": true },
  56. "type": { "type": "string" },
  57. "metadata": { "type": [ "object" ] },
  58. "nodes": {
  59. "type": "object",
  60. "additionalProperties": { "$ref": "#/definitions/node" }
  61. },
  62. "hyperedges": {
  63. "type": [ "array" ],
  64. "items": { "$ref": "#/definitions/directedhyperedge" }
  65. }
  66. }
  67. },
  68. {
  69. "type": "object",
  70. "additionalProperties": false,
  71. "properties": {
  72. "id": { "type": "string" },
  73. "label": { "type": "string" },
  74. "directed": { "type": [ "boolean" ], "enum": [false] },
  75. "type": { "type": "string" },
  76. "metadata": { "type": [ "object" ] },
  77. "nodes": {
  78. "type": "object",
  79. "additionalProperties": { "$ref": "#/definitions/node" }
  80. },
  81. "hyperedges": {
  82. "type": [ "array" ],
  83. "items": { "$ref": "#/definitions/undirectedhyperedge" }
  84. }
  85. },
  86. "required": [ "directed" ]
  87. }
  88. ]
  89. },
  90. "node": {
  91. "type": "object",
  92. "properties": {
  93. "label": { "type": "string" },
  94. "metadata": { "type": "object" },
  95. "additionalProperties": false
  96. }
  97. },
  98. "edge": {
  99. "type": "object",
  100. "additionalProperties": false,
  101. "properties": {
  102. "id": { "type": "string" },
  103. "source": { "type": "string" },
  104. "target": { "type": "string" },
  105. "relation": { "type": "string" },
  106. "directed": { "type": [ "boolean" ], "default": true },
  107. "label": { "type": "string" },
  108. "metadata": { "type": [ "object" ] }
  109. },
  110. "required": [ "source", "target" ]
  111. },
  112. "directedhyperedge": {
  113. "type": "object",
  114. "additionalProperties": false,
  115. "properties": {
  116. "id": { "type": "string" },
  117. "source": { "type": "array", "items": { "type": "string" } },
  118. "target": { "type": "array", "items": { "type": "string" } },
  119. "relation": { "type": "string" },
  120. "label": { "type": "string" },
  121. "metadata": { "type": [ "object" ] }
  122. },
  123. "required": [ "source", "target" ]
  124. },
  125. "undirectedhyperedge": {
  126. "type": "object",
  127. "additionalProperties": false,
  128. "properties": {
  129. "id": { "type": "string" },
  130. "nodes": { "type": "array", "items": { "type": "string" } },
  131. "relation": { "type": "string" },
  132. "label": { "type": "string" },
  133. "metadata": { "type": [ "object" ] }
  134. },
  135. "required": [ "nodes" ]
  136. }
  137. }
  138. }