Entity.json 5.7 KB
Newer Older
1 2
{
  "$schema": "http://json-schema.org/schema#",
canterafonsj's avatar
canterafonsj committed
3
  "id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json",
4 5 6
  "title": "NGSI-LD Entity",
  "description": "NGSI-LD Entity",
  "definitions": {
7 8 9 10 11 12 13 14 15
    "datasetId": {
      "type": "string",
      "format": "uri"
    },
    "instanceId": {
      "type": "string",
      "format": "uri"
    },
    "Property": {
16 17
      "type": "object",
      "properties": {
18
        "type": {
19
          "type": "string",
20 21 22
          "const": "Property"
        },
        "value": {
23 24 25 26 27 28 29
          "type": [
            "string",
            "number",
            "boolean",
            "array",
            "object"
          ]
30 31
        },
        "observedAt": {
canterafonsj's avatar
canterafonsj committed
32
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
33 34
        },
        "createdAt": {
canterafonsj's avatar
canterafonsj committed
35
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
36 37
        },
        "modifiedAt": {
canterafonsj's avatar
canterafonsj committed
38
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
39
        },
40
        "datasetId": {
41
          "$ref": "#/definitions/datasetId"
42 43
        },
        "instanceId": {
44
          "$ref": "#/definitions/instanceId"
45
        }
46 47 48 49 50 51 52 53 54
      },
      "required": [
        "type",
        "value"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
55
          },
56 57
          {
            "$ref": "#/definitions/Relationship"
58
          }
59 60
        ]
      }
61 62
    },
    "Relationship": {
63 64 65 66 67
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "Relationship"
68
        },
69 70 71 72 73
        "object": {
          "type": "string",
          "format": "uri"
        },
        "observedAt": {
canterafonsj's avatar
canterafonsj committed
74
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
75 76
        },
        "createdAt": {
canterafonsj's avatar
canterafonsj committed
77
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
78 79
        },
        "modifiedAt": {
canterafonsj's avatar
canterafonsj committed
80
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
        },
        "datasetId": {
          "$ref": "#/definitions/datasetId"
        },
        "instanceId": {
          "$ref": "#/definitions/instanceId"
        }
      },
      "required": [
        "type",
        "object"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
97
          },
98 99
          {
            "$ref": "#/definitions/Relationship"
100
          }
101 102
        ]
      }
canterafonsj's avatar
canterafonsj committed
103 104
    },
    "GeoProperty": {
105 106 107 108 109
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "GeoProperty"
canterafonsj's avatar
canterafonsj committed
110
        },
111
        "value": {
112
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/geometry-schema.json#"
113
        },
canterafonsj's avatar
canterafonsj committed
114 115 116
        "observedAt": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/observedAt"
        },
117
        "createdAt": {
canterafonsj's avatar
canterafonsj committed
118
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
119 120
        },
        "modifiedAt": {
canterafonsj's avatar
canterafonsj committed
121
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
        },
        "datasetId": {
          "$ref": "#/definitions/datasetId"
        },
        "instanceId": {
          "$ref": "#/definitions/instanceId"
        }
      },
      "required": [
        "type",
        "value"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
canterafonsj's avatar
canterafonsj committed
138
          },
139 140
          {
            "$ref": "#/definitions/Relationship"
canterafonsj's avatar
canterafonsj committed
141
          }
142 143
        ]
      }
144
    },
canterafonsj's avatar
canterafonsj committed
145
    "EntityFragment": {
146 147 148 149 150 151 152 153 154 155 156 157 158 159
      "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"
        }
160
      },
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": {
        "anyOf": [
          {
            "$ref": "#/definitions/Property"
          },
          {
            "$ref": "#/definitions/Relationship"
          },
          {
            "$ref": "#/definitions/GeoProperty"
          }
        ]
canterafonsj's avatar
canterafonsj committed
177
      },
178 179 180 181
      "propertyNames": {
        "type": "string",
        "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$"
      }
canterafonsj's avatar
canterafonsj committed
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
    },
    "Entity": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "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"
            }
          }
        },
        {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/EntityFragment"
        }
      ]
207 208
    }
  },
canterafonsj's avatar
canterafonsj committed
209 210 211 212 213 214
  "allOf": [
    {
      "$ref": "#/definitions/Entity"
    }
  ]
}