gost / server

GOST - Go implementation of OGC SensorThings API
MIT License
61 stars 19 forks source link

Create Datastream with Thing gives error #128

Closed bertt closed 7 years ago

bertt commented 7 years ago

I'm trying to create a Datastream with Thing in a deep-insert, but it returns an error.

sample:

$ curl -X POST -h "application/json" localhost:8080/v1.0/Datastreams

body:
{
   "name": "DS3",
   "unitOfMeasurement": {
           "name": "Celsius",
           "symbol": "C",
           "definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html#Celsius"
       },
   "description": "Temperature measurement",
   "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement",
   "ObservedProperty": {
       "name": "Temperature",
       "definition": "http://www.qudt.org/qudt/owl/1.0.0/quantity/Instances.html#Temperature",
       "description": "Temperature of the camping site"
   },
   "Sensor": {
       "name": "My Sensor",
       "description": "SensorUp Tempomatic 1000-b",
       "encodingType": "application/pdf",
       "metadata": "Calibration date:  Jan 11, 2015"
   },
   "Thing": {
     "name": "lantern",
     "description": "camping lantern"
   }
}

response:

{
  "error": {
    "status": "Bad Request",
    "code": 400,
    "message": [
      "Thing does not exist"
    ]
  }
}

Questions:

bertt commented 7 years ago

From the spec: "A request to create an entity that includes related entities, represented using the appropriate inline representation, is referred to as a "deep insert". A SensorThings service that supports entity creation SHALL support deep insert.

If the inline representation contains a value for a computed property (i.e., id), the service SHALL ignore that value when creating the related entity.

On success, the service SHALL create all entities and relate them. On failure, the service SHALL NOT create any of the entities.

[Adapted from Data 4.0-Protocol 11.4.2.2]"

bertt commented 7 years ago

At the moment, only some deep insert statements are implemented, see for examples https://github.com/gost/docs/blob/master/gost_deepinsert.md