Entity.json 5.55 KB
Newer Older
{
  "$schema": "http://json-schema.org/schema#",
canterafonsj's avatar
canterafonsj committed
  "$id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json",
  "title": "NGSI-LD Entity",
  "description": "NGSI-LD Entity",
  "definitions": {
    "datasetId": {
      "type": "string",
      "format": "uri"
    },
    "instanceId": {
      "type": "string",
      "format": "uri"
    },
    "Property": {
      "type": "object",
      "properties": {
          "type": "string",
canterafonsj's avatar
canterafonsj committed
          "type": [
            "string",
            "number",
            "boolean",
            "array",
            "object"
          ]
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
        },
        "createdAt": {
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
        },
        "modifiedAt": {
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
        "datasetId": {
          "$ref": "#/definitions/datasetId"
        },
        "instanceId": {
          "$ref": "#/definitions/instanceId"
      },
      "required": [
        "type",
        "value"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
          {
            "$ref": "#/definitions/Relationship"
    },
    "Relationship": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "Relationship"
        "object": {
          "type": "string",
          "format": "uri"
        },
        "observedAt": {
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
        },
        "datasetId": {
          "$ref": "#/definitions/datasetId"
        },
        "instanceId": {
          "$ref": "#/definitions/instanceId"
        }
      },
      "required": [
        "type",
        "object"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
          {
            "$ref": "#/definitions/Relationship"
canterafonsj's avatar
canterafonsj committed
    },
    "GeoProperty": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "GeoProperty"
canterafonsj's avatar
canterafonsj committed
        },
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#"
canterafonsj's avatar
canterafonsj committed
        "observedAt": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
        },
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
canterafonsj's avatar
canterafonsj committed
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
        },
        "datasetId": {
          "$ref": "#/definitions/datasetId"
        },
        "instanceId": {
          "$ref": "#/definitions/instanceId"
        }
      },
      "required": [
        "type",
        "value"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
canterafonsj's avatar
canterafonsj committed
          },
          {
            "$ref": "#/definitions/Relationship"
canterafonsj's avatar
canterafonsj committed
          }
canterafonsj's avatar
canterafonsj committed
    "EntityFragment": {
canterafonsj's avatar
canterafonsj committed
      "type": "object",
      "properties": {
        "@context": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext"
        },
        "location": {
          "$ref": "#/definitions/GeoProperty"
        },
        "observationSpace": {
          "$ref": "#/definitions/GeoProperty"
        },
        "operationSpace": {
          "$ref": "#/definitions/GeoProperty"
        "id": {
          "type": "string",
          "format": "uri"
        },
        "type": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
        },
        "createdAt": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
        },
        "modifiedAt": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
canterafonsj's avatar
canterafonsj committed
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
          },
          {
            "$ref": "#/definitions/Relationship"
          },
          {
            "$ref": "#/definitions/GeoProperty"
          }
        ]
canterafonsj's avatar
canterafonsj committed
      },
canterafonsj's avatar
canterafonsj committed
      "propertyNames": {
        "type": "string",
canterafonsj's avatar
canterafonsj committed
        "pattern": "^((\\d|[a-zA-Z]|_)+(:(\\d|[a-zA-Z]|_)+)?(#\\d+)?)$|^(@context)$"
canterafonsj's avatar
canterafonsj committed
    },
    "Entity": {
      "allOf": [
        {
          "required": [
            "id",
            "type"
          ]
canterafonsj's avatar
canterafonsj committed
        },
        {
          "$ref": "#/definitions/EntityFragment"
canterafonsj's avatar
canterafonsj committed
        }
      ]
canterafonsj's avatar
canterafonsj committed
  "allOf": [
    {
      "$ref": "#/definitions/Entity"
    }
  ]
}