{
    "$schema": "http://json-schema.org/draft-04/schema",
    "description": "Graph data description. Please note that all field keys are to be lowercase and use snake-case (e.g. words are separated by underscores like ncbi_tax_id). Some of the metadata fields are not required but are included as exemplars for generating interoperable BEL JGF files.  You may need to provide additional validation programmatically to confirm that the metadata you need for your application exists.",
    "oneOf": [
        {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "graph": {
                    "$ref": "#/definitions/graph"
                }
            },
            "required": [
                "graph"
            ]
        },
        {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "label": {
                    "type": "string",
                    "title": "Graph Set Label",
                    "description": "Graph Set label"
                },
                "type": {
                    "type": "string",
                    "title": "Type of Graphs in Set",
                    "description": "Graph types in graph set"
                },
                "metadata": {
                    "type": [
                        "object",
                        "null"
                    ],
                    "title": "Graph Set Metadata",
                    "description": "Graph set metadata"
                },
                "graphs": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/graph"
                    }
                }
            }
        }
    ],
    "definitions": {
        "graph": {
            "type": "object",
            "additionalProperties": false,
            "title": "Graph or Network data",
            "properties": {
                "label": {
                    "type": "string",
                    "title": "Graph Label",
                    "description": "Graph label"
                },
                "directed": {
                    "type": [
                        "boolean",
                        "null"
                    ],
                    "description": "Directed or undirected graph",
                    "default": true
                },
                "type": {
                    "type": "string",
                    "title": "Type of Graph",
                    "description": "BEL Versioned Graph type"
                },
                "metadata": {
                    "type": [
                        "object",
                        "null"
                    ],
                    "additionalProperties": true,
                    "properties": {
                        "ncbi_tax_id": {
                            "type": "integer",
                            "title": "NCBI Taxonomy ID",
                            "description": "NCBI Taxonomy ID - http://www.ncbi.nlm.nih.gov/taxonomy"
                        },
                        "species_common_name": {
                            "type": "string",
                            "title": "Species Common Name",
                            "description": "Species common name, e.g. human, mouse, rat"
                        },
                        "description": {
                            "type": "string",
                            "title": "Graph description",
                            "description": "Graph description"
                        },
                        "version": {
                            "type": "string",
                            "description": "Version of the graph"
                        },
                        "bel_version": {
                            "type": "string",
                            "title": "BEL Version",
                            "description": "The version of BEL (Biological Expression Language) represented in this graph. This version string conforms to the language version as defined by OpenBEL (i.e. 1.0, 2.0, ...)."
                        }
                    }
                },
                "nodes": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "label": {
                                "type": "string"
                            },
                            "metadata": {
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "additionalProperties": true,
                                "properties": {
                                    "coordinate": {
                                        "type": "array",
                                        "items": {
                                            "type": "number"
                                        },
                                        "minItems": 2,
                                        "title": "Node coordinates",
                                        "description": "Node coordinates as either an (x, y) or (x, y, z) tuple, the tuple is unbounded to allow additional dimensions to be used in addition to x, y and z coordinates"
                                    },
                                    "bel_function_type": {
                                        "type": "string",
                                        "description": "BEL function types such as proteinAbundance, trancriptionalActivity, etc"
                                    }
                                }
                            }
                        }
                    },
                    "required": [
                        "id"
                    ]
                },
                "edges": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                            "source": {
                                "type": "string",
                                "title": "Source Node",
                                "description": "First node in edge triple"
                            },
                            "target": {
                                "type": "string",
                                "title": "Target Node",
                                "description": "Second node in edge triple"
                            },
                            "relation": {
                                "type": "string",
                                "title": "Edge relationship",
                                "description": "Relationship between nodes in edge - may be directed or undirected"
                            },
                            "directed": {
                                "type": [
                                    "boolean",
                                    "null"
                                ],
                                "default": true
                            },
                            "label": {
                                "type": "string"
                            },
                            "metadata": {
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "additionalProperties": true,
                                "properties": {
                                    "causal": {
                                        "type": "boolean",
                                        "description": "True if a BEL causal edge type"
                                    },
                                    "evidences": {
                                        "type": "array",
                                        "items": {
                                            "$ref": "#/definitions/evidence"
                                        }
                                    }
                                }
                            }
                        },
                        "required": [
                            "source",
                            "target"
                        ]
                    }
                }
            }
        },
        "evidence": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "bel_statement",
                "citation"
            ],
            "properties": {
                "bel_statement": {
                    "type": "string",
                    "title": "BEL Statement",
                    "description": "OpenBEL.org BEL Statement"
                },
                "citation": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "type": {
                            "type": "string",
                            "enum": [
                                "PubMed",
                                "Book",
                                "Journal",
                                "Online Resource",
                                "Other"
                            ],
                            "title": "Citation Type",
                            "description": "The citation type"
                        },
                        "id": {
                            "type": "string",
                            "title": "Citation ID",
                            "description": "Identifier of the citation, e.g. PubMed ID"
                        },
                        "name": {
                            "type": "string",
                            "title": "Citation Name",
                            "description": "Name or citation string for the reference."
                        }
                    },
                    "title": "Citation for Edge Evidence",
                    "description": "Citation to support the evidence presented for the Edge"
                },
                "summary_text": {
                    "type": "string",
                    "title": "Summary Text",
                    "description": "Abstract from source text to provide support for this evidence"
                },
                "experiment_context": {
                    "type": "object",
                    "title": "Experiment Context",
                    "description": "An experiment context specifies the experiment's parameters where this interaction was observed.",
                    "additionalProperties": true,
                    "properties": {
                        "ncbi_tax_id": {
                            "type": "integer",
                            "title": "NCBI Taxonomy ID",
                            "description": "NCBI taxonomy id - e.g. 9606 is the id for Homo sapien"
                        },
                        "species_common_name": {
                            "type": "string",
                            "title": "Species common name",
                            "description": "Common name for species like human, mouse or rat"
                        }
                    }
                },
                "metadata": {
                    "type": [
                        "object",
                        "null"
                    ],
                    "title": "Metadata",
                    "description": "Metadata for this evidence object. For example this could include application data like reviewer, status, or primary key. If the data is observed within the experiment then it belongs in experiment_context instead.",
                    "additionalProperties": true
                }
            }
        }
    }
}
