Commit 09538f0b authored by canterafonsj's avatar canterafonsj
Browse files

Entity Temporal First Stab

parent 960f7f5a
Loading
Loading
Loading
Loading
+90 −55
Original line number Diff line number Diff line
{
  "$schema": "http://json-schema.org/schema#",
  "id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json",
  "id": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/temporal/EntityTemporal.json",
  "title": "NGSI-LD Entity",
  "description": "NGSI-LD Temporal Representation of an Entity",
  "definitions": {
    "EntityTemporalFragment": {
      "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"
        },
@@ -22,17 +17,21 @@
          },
          "minItems": 1
        },
    "createdAt": {
      "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/createdAt"
        "observationSpace": {
          "type": "array",
          "items": {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty"
          },
    "modifiedAt": {
      "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/modifiedAt"
          "minItems": 1
        },
        "operationSpace": {
          "type": "array",
          "items": {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/GeoProperty"
          },
          "minItems": 1
        }
      },
  "required": [
    "id",
    "type"
  ],
      "additionalProperties": {
        "anyOf": [
          {
@@ -62,4 +61,40 @@
        "type": "string",
        "pattern": "^((\\d|[a-zA-Z]|_)+(#\\d+)?)$|^(@context)$"
      }
    },
    "EntityTemporal": {
      "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"
            }
          },
          "required": [
            "id",
            "type"
          ]
        },
        {
          "$ref": "#/definitions/EntityTemporalFragment"
        }
      ]
    }
  },
  "allOf": [
    {
      "$ref": "#/definitions/EntityTemporal"
    }
  ]
}
+2 −2
Original line number Diff line number Diff line
{
  "$schema": "http://json-schema.org/schema#",
  "id": "https://uri.etsi.org/ngsi-ld/schema/EntityTemporalList.json",
  "id": "https://uri.etsi.org/ngsi-ld/schema/temporal/EntityTemporalList.json",
  "title": "NGSI-LD Entity",
  "description": "NGSI-LD Temporal Representation List",
  "type": "array",
  "items": {
    "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json#"
    "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/temporal/EntityTemporal.json#"
  }
}
+193 −0
Original line number Diff line number Diff line
{
  "openapi": "3.0.1",
  "info": {
    "title": "NGSI-LD Temporal Entities",
    "version": "latest"
  },
  "components": {
    "parameters": {
      "timerel": {
        "name": "timerel",
        "description": "Time relationship",
        "in": "query",
        "required": false,
        "schema": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/timerel"
        }
      },
      "time": {
        "name": "time",
        "description": "start time for temporal query",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "endTime": {
        "name": "endTime",
        "description": "end time for temporal query",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "timeproperty": {
        "name": "timeproperty",
        "description": "The name of the property that contains the temporal data that will be used to resolve the temporal query",
        "in": "query",
        "required": false,
        "schema": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
        }
      },
      "options": {
        "name": "options",
        "description": "Options dictionary",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": ["temporalValues", "sysAttrs"]
        }
      }
    }
  },
  "paths": {
    "/temporal/entities/": {
      "get": {
        "description": "Query temporal evolution of Entities from an NGSI-LD system",
        "operationId": "queryTemporalEntities",
        "parameters": [
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/id"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/idPattern"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/type"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/attrs"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/q"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/georel"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/geometry"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/coordinates"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/geoproperty"
          },
          {
            "$ref": "#/components/parameters/timerel"
          },
          {
            "$ref": "#/components/parameters/temporalproperty"
          },
          {
            "$ref": "#/components/parameters/time"
          },
          {
            "$ref": "#/components/parameters/endTime"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/csf"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entities-spec.json#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/options"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporalList.json#/definitions/EntityTemporalList"
                },
                "examples": {
                  "simple": {
                    "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/EntityTemporalList-example.json"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "Create temporal representation of an Entity within an NGSI-LD system",
        "operationId": "createEntityTemporal",
        "requestBody": {
          "required": true,
          "content": {
            "application/json;application/ld+json": {
              "schema": {
                "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json#/definitions/EntityTemporal"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. Contains the resource URI of the created Entity"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Already exists",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  }
}
+243 −0
Original line number Diff line number Diff line
{
  "openapi": "3.0.1",
  "info": {
    "title": "NGSI-LD Entity Attributes",
    "version": "latest"
  },
  "components": {
    "parameters": {
      "entityId": {
        "name": "entityId",
        "description": "Entity Id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uri"
        }
      },
      "attrId": {
        "name": "attrId",
        "description": "Attribute Id",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/Name"
        }
      },
      "options": {
        "name": "options",
        "description": "Indicates that no attribute overwrite shall be performed",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "noOverwrite"
          ]
        }
      }
    }
  },
  "paths": {
    "/temporal/entities/{entityId}/attrs/": {
      "post": {
        "description": "Append new Entity attributes to an existing Entity within an NGSI-LD system",
        "operationId": "appendEntityAttrs",
        "parameters": [
          {
            "$ref": "#/components/parameters/entityId"
          },
          {
            "$ref": "#/components/parameters/options"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json;application/ld+json": {
              "schema": {
                "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/EntityFragment"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "207": {
            "description": "Partial Success. Only the attributes included in the response payload were successfully appended",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/UpdateResult.json#"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "patch": {
        "description": "Update existing Entity attributes within an NGSI-LD system",
        "operationId": "updateEntityAttrs",
        "parameters": [
          {
            "$ref": "#/components/parameters/entityId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json;application/ld+json": {
              "schema": {
                "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/EntityFragment"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content."
          },
          "207": {
            "description": "Partial Success. Only the attributes included in the response payload were successfully updated",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/UpdateResult.json#"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/temporal/entities/{entityId}/attrs/{attrId}": {
      "patch": {
        "description": "Update existing Entity attributes within an NGSI-LD system",
        "operationId": "partialAttrUpdate",
        "parameters": [
          {
            "$ref": "#/components/parameters/entityId"
          },
          {
            "$ref": "#/components/parameters/attrId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json;application/ld+json": {
              "schema": {
                "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/Entity.json#/definitions/EntityFragment"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content."
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Removes an existing Entity attribute within an NGSI-LD system",
        "operationId": "removeEntityAttr",
        "parameters": [
          {
            "$ref": "#/components/parameters/entityId"
          },
          {
            "$ref": "#/components/parameters/attrId"
          }
        ],
        "responses": {
          "204": {
            "description": "No Content."
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  }
}
+105 −0
Original line number Diff line number Diff line
{
  "openapi": "3.0.1",
  "info": {
    "title": "NGSI-LD Entity Temporal By Id",
    "version": "latest"
  },
  "components": {
  },
  "paths": {
    "/temporal/entities/{entityId}": {
      "get": {
        "description": "Retrieve the temporal representation of an specific Entity from an NGSI-LD system. It's possible to specify the Entity attributes to be retrieved by using query parameters",
        "operationId": "retrieveEntityTemporalById",
        "parameters": [
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entity-by-id-spec.json#/components/parameters/entityId"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entity-by-id-spec.json#/components/parameters/attrs"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/entity-by-id-spec.json#/components/parameters/type"
          },
          {
            "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/spec/updated/temporal/temporal-entities-spec.json#/components/parameters/options"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/EntityTemporal.json#/definitions/EntityTemporal"
                },
                "examples": {
                  "simple": {
                    "externalValue": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/examples/EntityTemporal-example.json"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Removes an specific Entity from an NGSI-LD system",
        "operationId": "removeEntityById",
        "parameters": [
          {
            "$ref": "#/components/parameters/entityId"
          },
          {
            "$ref": "#/components/parameters/type"
          }
        ],
        "responses": {
          "204": {
            "description": "No Content. The entity was removed successfully"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json;application/ld+json": {
                "schema": {
                  "$ref": "https://forge.etsi.org/gitlab/NGSI-LD/NGSI-LD/raw/master/schema/common.json#/definitions/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  }
}
 No newline at end of file