From 5bc4393ab849b219d716abd23d7cbac178cfc184 Mon Sep 17 00:00:00 2001 From: Jose Manuel Cantera Date: Tue, 13 Nov 2018 14:29:45 +0100 Subject: [PATCH] Temporal Values --- schema/Entity_temporalValues.json | 121 ++++++++++++++++++++++++++++++ scripts/validate_schema.sh | 5 +- 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 schema/Entity_temporalValues.json diff --git a/schema/Entity_temporalValues.json b/schema/Entity_temporalValues.json new file mode 100644 index 0000000..190a7ab --- /dev/null +++ b/schema/Entity_temporalValues.json @@ -0,0 +1,121 @@ +{ + "$schema": "http://json-schema.org/schema#", + "id": "https://uri.etsi.org/ngsi-ld/schema/Entity_temporalValues.json", + "title": "NGSI-LD Entity Temporal Values", + "description": "NGSI-LD Simplified Temporal Representation of Entities", + "definitions": { + "TimestampOrEmpty": { + "oneOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "string", + "minLength": 0, + "maxLength": 0 + } + ] + }, + "TemporalValue": { + "type": "array", + "items": [ + { + "type": [ + "string", + "number", + "boolean", + "object", + "array" + ] + }, + { + "$ref": "#/definitions/TimestampOrEmpty" + } + ], + "minTems": 2, + "maxItems": 2 + }, + "TemporalObject": { + "type": "array", + "items": [ + { + "type": "string", + "format": "uri" + }, + { + "$ref": "#/definitions/TimestampOrEmpty" + } + ], + "minTems": 2, + "maxItems": 2 + }, + "PropertyTemporalValues": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "Property" + }, + "values": { + "type": "array", + "items": { + "$ref": "#/definitions/TemporalValue" + } + } + } + }, + "RelationshipTemporalValues": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "Relationship" + }, + "objects": { + "type": "array", + "items": { + "$ref": "#/definitions/TemporalObject" + } + } + } + } + }, + "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" + }, + "@context": { + "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/LdContext" + }, + "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" + } + }, + "required": [ + "type", + "id" + ], + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/definitions/PropertyTemporalValues" + }, + { + "$ref": "#/definitions/RelationshipTemporalValues" + } + ] + }, + "propertyNames": { + "type": "string", + "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$" + } +} diff --git a/scripts/validate_schema.sh b/scripts/validate_schema.sh index 32517e6..fb050d3 100755 --- a/scripts/validate_schema.sh +++ b/scripts/validate_schema.sh @@ -20,4 +20,7 @@ ajv compile -s $SCHEMAS/BatchOperationResult.json -r $SCHEMAS/common.json ajv compile -s $SCHEMAS/UpdateResult.json -ajv compile -s $SCHEMAS/Entity_keyValues.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/Entity.json +ajv compile -s $SCHEMAS/Entity_keyValues.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json + +ajv compile -s $SCHEMAS/Entity_temporalValues.json -r $SCHEMAS/common.json -r $SCHEMAS/geometry-schema.json -r $SCHEMAS/Entity.json + -- GitLab