opengeospatial / sensorthings

The official web site of the OGC SensorThings API standard specification.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility between OData and STA

hylkevds opened this issue · comments

At the last TC meeting I gave a little demo of using STA/OData in Excel.

Here are the differences I found so far:

STA OData 4.0 OData 4.01
Self Links @iot.selfLink @odata.id @id
NavLinks @iot.navigationLink @odata.navigationLink @navigationLink
ID property @iot.id id (@ and . confuse clients) id (@ and . confuse clients)
Context @odata.context @context
Flexible Properties property type ANY not supported, cast to Edm.String Edm.Untyped
Time Interval/Value phenomenonTime, validTime not supported, use phenomenonTime.start and phenomenonTime.end not supported, use phenomenonTime.start and phenomenonTime.end
Non existing entities 404 Not Found 204 No Content 204 No Content

Things that STA has that can not easily be mapped to OData:

  • Type ANY doesn't exist in OData 4.0. Version 4.01 has Edm.Untyped.
  • No TimeInterval or TimeValue, only Edm.DateTimeOffset. This is an issue for Observation/phenomenonTime, Observation/validTime, Datastream/phenomenonTime and Datastream/resultTime.
    One solution would be to just use Edm.String, but this doesn't help clients. A better solution is to split the interval into intervalProperty.start and intervalProperty.end in the OData interface.

Our test endpoint, for people that would like to try it out:

It's the same server instance, so the database in these three endpoints is the same.

Related to #72
Also in the FROST wiki.

Some more progress:

  • The ANY result type can be forced to Edm.String, since everything can be displayed as a String. This makes Excel content.
  • Times that are a TimeInterval can be mapped to a custom type with start and end (both mandatory):
    "TimeInterval": {
        "$Kind": "ComplexType",
        "@Core.Description": "An ISO time interval.",
        "start": {
            "$Type": "Edm.DateTimeOffset"
        },
        "end": {
            "$Type": "Edm.DateTimeOffset"
        }
    }
    
  • Times that are a TimeObject (Interval or Instant) can be mapped to a custom type with start and optional end:
    "TimeValue": {
        "$Kind": "ComplexType",
        "@Core.Description": "An ISO time instant or time interval.",
        "start": {
            "$Type": "Edm.DateTimeOffset"
        },
        "end": {
            "$Type": "Edm.DateTimeOffset",
            "$Nullable": true
        }
    },