FraunhoferIOSB / FROST-Server

A Complete Server implementation of the OGC SensorThings API
https://fraunhoferiosb.github.io/FROST-Server/
GNU Lesser General Public License v3.0
198 stars 74 forks source link

concatenate observations from multiple datastreams in one query #2000

Open borg1310 opened 2 months ago

borg1310 commented 2 months ago

hi,

i have a question about querying data from a frost server: Is it possible to concatenate the observations of several data streams based on an attribute? In our database there are derived time series, that are composed of several data streams. The data stream sources of the combined data stream are assigned by a list of IDs or names in the properties. Here is an example:

{
  "@iot.selfLink": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)",
  "@iot.id": 4,
  "name": "SAK254-Concat",
  "description": "Concatenation of multiple datastreams from different SAK254 sensors at the Rappbode",
  "observationType": "OM_Observation",
  "unitOfMeasurement": {
    "name": "specific absorption coeeficient",
    "symbol": "1/m",
    "definition": "TBD"
  },
  "properties": {
    "sourceRelatedDatastreams": [
      1,
      2,
      3
    ]
  },
  "ObservedProperty@iot.navigationLink": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/ObservedProperty",
  "Sensor@iot.navigationLink": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/Sensor",
  "Thing@iot.navigationLink": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/Thing",
  "Observations@iot.navigationLink": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/Observations"
}

Is it possible to create a single query to concatenate and output all observations from the datastream sources contained in the derived datastream? Only the derived datastream should be known.

thanks in advance

best regards,

juergen

DanielBertocci commented 1 month ago

@borg1310 one option you may use is EntityLinking but it is not available yet for one-to-many relationship. If sourceRelatedDatastreams has always a fixed amount of elements (e.g. always 3 datastreams), a workaround for that would be create one specialized property for each of them.

A more dynamic alternative, that for the time being I would recommend, is to use different HTTP requests: