opengeospatial / ets-sta10

Repository for the Executable Test Suite for OGC Sensor Things API
Other
6 stars 8 forks source link

Why 'Check priotity of query options' test is expecting a count of 6? #33

Closed albertopq closed 7 years ago

albertopq commented 7 years ago

Hi!

I'm trying to understand the level 3 test at [1]. If I understand it correctly, it creates 12 Observations, with result from 1 to 12. Then it requests with top=1 and skip=2, order by phenomenonTime asc and filtering result > 3.

I'm missing something, because I don't understand how that request can expect a count of 6. Filtering will return 9 Observations (removing result 1,2,3), and then we are skipping 2. Shouldn't it return a count of 7?

I'm sure I'm missing something, but could somebody explain what is it?

Thanks!

[1] https://github.com/opengeospatial/ets-sta10/blob/master/src/main/java/org/opengis/cite/sta10/filteringExtension/Capability3Tests.java#L278

albertopq commented 7 years ago

@bermud @taniakhalafbeigi ?

taniakhalafbeigi commented 7 years ago

The query is applied to /Observations which means all the Observations. In general case Observations can have multiple types. As a result, any $filter query on all Observations on 'result' is considered as String. Also, the filter is result gt '3', which means it compares the results as String. Therefore, the returned results, without considering top and skip, should be 4, 5, 6, 7, 8, 9. $count returns the count without considering top and skip, it only considers $filter. As a result the count should be 6.

albertopq commented 7 years ago

Great, thanks @taniakhalafbeigi! The String part is the thing I was missing. Thanks a lot!

hylkevds commented 7 years ago

It's because the value being compared to is a String. I mentioned the same issue here: https://github.com/opengeospatial/ets-sta10/issues/14

The problem is that result has data type ANY, but the specification does not specify what to do when the type being filtered on does not match the type of the observation.

We've also written some change requests, documented here: https://github.com/opengeospatial/sensorthings/issues/7

taniakhalafbeigi commented 7 years ago

We are waiting for the change request to be processed. But for this specific query, since it is for /Observations and Observations can have multiple types, and also the $filter is "result gt '3'" the comparison is as String.