{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "http://ifc-ld.org/specification/v1/json-schema#",
    "title": "ifc-ld core schema",
    "type": "object",
    "oneOf": [
        {
            "$ref": "/definitions/StdPackage"
        }
    ],
    "definitions": {
        "StdPackage": {
            "$id": "/definitions/StdPackage",
            "allOf": [
                {
                    "$ref": "/definitions/LinkedData"
                },
                {
                    "type": "object",
                    "properties": {
                        "profile": {
                            "const": "http://ifc-ld.org/specification#std"
                        },
                        "entities": {
                            "type": "object",
                            "additionalProperties": {
                                "$ref": "/definitions/Entity"
                            }
                        }
                    },
                    "required": [
                        "entities"
                    ]
                }
            ]
        },
        "Identifiable": {
            "$id": "/definitions/Identifiable",
            "properties": {
                "id": {
                    "type": "string",
                    "format": "uri"
                }
            },
            "required": [
                "id"
            ]
        },
        "Typed": {
            "$id": "/definitions/Typed",
            "properties": {
                "type": {
                    "type": "string"
                }
            },
            "required": [
                "type"
            ]
        },
        "LinkedData": {
            "$id": "/definitions/LinkedData",
            "type": "object",
            "properties": {
                "@context": {
                    "oneOf": [
                        {
                            "type": "array",
                            "items": {
                                "type": "object"
                            }
                        },
                        {
                            "type": "object"
                        },
                        {
                            "type": "string",
                            "format": "uri"
                        }
                    ]
                }
            },
            "required": [
                "@context"
            ]
        },
        "Container": {
            "$id": "/definitions/Container",
            "allOf": [
                {
                    "$ref": "/definitions/Identifiable"
                },
                {
                    "$ref": "/definitions/Typed"
                },
                {
                    "type": "object",
                    "properties": {
                        "key": {
                            "type": "string"
                        }
                    }
                }
            ]
        },
        "Entity": {
            "$id": "/definitions/Entity",
            "allOf": [
                {
                    "$ref": "/definitions/Container"
                },
                {
                    "type": "object",
                    "properties": {
                        "entityof": {
                            "type": "string"
                        },
                        "components": {
                            "type": "object",
                            "additionalProperties": {
                                "$ref": "/definitions/Component"
                            }
                        }
                    },
                    "required": [
                        "entityof"
                    ]
                }
            ]
        },
        "Component": {
            "$id": "/definitions/Component",
            "allOf": [
                {
                    "$ref": "/definitions/Container"
                },
                {
                    "type": "object",
                    "properties": {
                        "componentof": {
                            "type": "string"
                        },
                        "body": {
                            "oneOf": [
                                {
                                    "$ref": "/definitions/Value"
                                },
                                {
                                    "$ref": "/definitions/Identifiable"
                                }
                            ]
                        }
                    },
                    "required": [
                        "body",
                        "componentof"
                    ]
                }
            ]
        },
        "Value": {
            "$id": "/definitions/Value",
            "allOf": [
                {
                    "$ref": "/definitions/Typed"
                },
                {
                    "type": "object",
                    "properties": {
                        "value": {
                            "oneOf": [
                                {
                                    "type": "number"
                                },
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "array"
                                },
                                {
                                    "type": "boolean"
                                }
                            ]
                        }
                    },
                    "required": [
                        "value"
                    ]
                }
            ]
        }
    }
}