Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility between OData and STA #136

Open
hylkevds opened this issue Dec 2, 2021 · 1 comment
Open

Compatibility between OData and STA #136

hylkevds opened this issue Dec 2, 2021 · 1 comment
Labels
API sensing v2.0 This change should be discussed for v2.0 of the sensing document.

Comments

@hylkevds
Copy link
Contributor

hylkevds commented Dec 2, 2021

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.

@hylkevds hylkevds added the sensing v2.0 This change should be discussed for v2.0 of the sensing document. label Dec 2, 2021
@hylkevds
Copy link
Contributor Author

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
        }
    },
    

@hylkevds hylkevds added the API label May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API sensing v2.0 This change should be discussed for v2.0 of the sensing document.
Projects
None yet
Development

No branches or pull requests

1 participant