I am attempting to truncate the results of an $expand
parameter from SensorThingsAPI eg
http://example.org/v1.0/Things?$expand=Datastreams
However, $top
only restricts the trunk of the query (eg Things). Is there a way to truncate the results of the 'leaves' of an $expand
?
In this case, the server-side pagination should be controlling the 'leaves' of an $expand
.
For example, if the service limit 100 entities for each response and the expanded entities (or the collection) have more than 100, the service will return the top 100 entities following a service-defined order. A @iot.nextLink
will also be returned, so that the client know how to fetch the next 100 entities (ie, next page). Using the above query as an example, an example nextLink to retrieve the Datastreams
will be
Datastreams@iot.nextLink:"http://URL_to_retrieve_the_next_page/"
You can use this OGC SensorThings sandbox to see an example return of $expand: http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Datastreams?$expand=Observations
The following JSON shows an example response of the following query with $expand
: http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Datastreams?$expand=Observations :
{ "@iot.count": 1, "value": [{ "@iot.id": 8, "@iot.selfLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Datastreams(8)", "description": "Daily Water level", "observationType": "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Observation", "unitOfMeasurement": { "symbol": "m", "name": "meter", "definition": "https://en.wikipedia.org/wiki/Metre" }, "Observations@iot.nextLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Datastreams(8)/Observations?$top=3&$skip=3", "Observations@iot.count": 1826, "Observations": [{ "@iot.id": 1835, "@iot.selfLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Observations(1835)", "phenomenonTime": "2015-12-30T16:00:00.000Z", "result": "1375.44", "resultTime": null, "Datastream@iot.navigationLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Observations(1835)/Datastream", "FeatureOfInterest@iot.navigationLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Observations(1835)/FeatureOfInterest" }], "ObservedProperty@iot.navigationLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Datastreams(8)/ObservedProperty", "Sensor@iot.navigationLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Datastreams(8)/Sensor", "Thing@iot.navigationLink": "http://scratchpad.sensorup.com/OGCSensorThings/v1.0/Datastreams(8)/Thing" },{},{}] }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.