project-codenet / tools /json-graph /graph-schema.json
Zharif18's picture
Upload folder using huggingface_hub
eb90a8a verified
Raw History Blame Contribute Delete
2.51 kB
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "JSON Schema for IBM AI4Code GraphJSON Format",
"description": "Prepared by Geert Janssen <geert@us.ibm.com>\nCopyright IBM Corporation 2020.",
"type": "object",
"properties": {
"graph": { "$ref": "#/definitions/graph" }
},
"required": [ "graph" ],
"additionalProperties": true,
"definitions": {
"graph": {
"type": "object",
"properties": {
"version" : { "enum": [ "1.0" ] },
"type": {
"description": "Indication of type, e.g. tree or dag.",
"type": "string"
},
"directed": { "type": "boolean" },
"label": { "type": "string" },
"root": {
"description": "Indication of the root node for a tree.",
"$ref": "#/definitions/unsigned_or_string"
},
"order": { "enum": [ "none", "topological", "reverse-topological",
"dfs", "bfs" ] },
"metadata": { "type": "object" },
"nodes": {
"description": "Mandatory node list.",
"type": "array",
"items": { "$ref": "#/definitions/node" }
},
"edges": {
"description": "Mandatory edge list.",
"type": "array",
"items": { "$ref": "#/definitions/edge" }
}
},
"required": [ "version", "directed", "nodes", "edges" ],
"additionalProperties": true
},
"node": {
"type": "object",
"properties": {
"id": { "$ref": "#/definitions/unsigned_or_string" },
"label": { "type": "string" },
"metadata": { "type": "object" }
},
"required": [ "id" ],
"additionalProperties": true
},
"edge": {
"description": "Edge object in an edge list.",
"type": "object",
"properties": {
"id": { "$ref": "#/definitions/unsigned_or_string" },
"label": { "type": "string" },
"between": {
"description": "An ordered pair of 2 nodes.",
"type": "array",
"items": { "$ref": "#/definitions/unsigned_or_string" },
"minItems": 2,
"maxItems": 2
},
"metadata": { "type": "object" }
},
"required": [ "between" ],
"additionalProperties": true
},
"unsigned_or_string": {
"description" : "A non-negative integer or a string.",
"oneOf": [
{ "type": "integer", "minimum": 0 },
{ "type": "string" }
]
}
}
}