opengeospatial / sensorthings

The official web site of the OGC SensorThings API standard specification.
134 stars 29 forks source link

$expand with multiple expandItems #16

Open hylkevds opened 7 years ago

hylkevds commented 7 years ago

I was looking into writing some tests for nested expands when I noticed the following:

SensorThings API paragraph 9.3.2.1 $expand refers to OData 4.0-URL 5.1.2, which states:

A navigation property MUST NOT appear in more than one expandItem.

The conformance test generates urls like: /v1.0/Things?$expand=Datastreams/Thing,Datastreams/Sensor

Doesn't the navigation property Datastreams of the entity type Thing appear in more than one expandItem here? I would think that should be rewritten as /v1.0/Things?$expand=Datastreams($expand=Thing,Sensor)

(The OData ABNF defines navigationProperty as odataIdentifier which means that Datastreams/Thing consists of two navigationProperties)

lieberjosh commented 5 years ago

Not sure this is a problem with OData (OData 4.0-URL 5.1.2):

"An arbitrary number of single- or collection-valued complex properties, optionally followed by a type cast, allow drilling into complex properties. ... Example 92: expand a navigation property of a complex type http://host/service/Customers?$expand=Addresses/Country"

So Addresses/Country is a distinct, if complex, navigation property, and a list of them should be conformant.

hylkevds commented 1 year ago

The navigation property in that example is Country which is a property of the complex type of the Addresses property of the Customer Entity. As such, that navigation property Country is only allowed to appear in one expand item. So if you wanted to expand Addresses/Country/Capital and Addresses/Country/Cities you'd have to write ?$expand=Addresses/Country($expand=Capital,Cities) and not ?$expand=Addresses/Country/Capital,Addresses/Country/Cities

The reasoning behind this is probably that you can add options to the expanding of navigation properties, and if a navigation property can appear multiple times, the options can differ and the result would be undefined.