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