building-envelope-data / api

API specification to exchange data about building envelopes
MIT License
3 stars 1 forks source link

Clarification for how client databases handle queries with filters for information they do not have #239

Closed StephenCzarnecki closed 3 years ago

StephenCzarnecki commented 3 years ago

I just want to clarify how client databases handle metadata queries containing filters for information they do not have. My reading of the database.graphql file suggests that the parts of the queries dealing with non-existent data evaluate to false but I want to make sure that is correct.

An example to clarify the question:

The IGSDB does not have U-values. So it seems to me that the query to the IGSDB that has this for a where clause

where: {
  gValue: { greaterThanOrEqualTo: 0.5 } 
  nearnormalHemisphericalVisibleTransmittance: {greaterThanOrEqualTo: 0.0, lessThanOrEqualTo: 1.0 }}
}

would return no results.

This is because the gValue filter and nearnormalHemisphericalVisibleTransmittance filter are ANDed together and since no record in the IGSDB has a gValue >= 0.5 the gValue filter will always be false. Therefore it does not matter what the rest of the query asks since anything ANDed with false is false.

Is that correct?

christoph-maurer commented 3 years ago

I think yes. @simon-wacker Do you agree?

simon-wacker commented 3 years ago

Yes, that's how it is meant to be. Note though that a proposition restricting gValue and uValue can only be passed to the queries allData and allCalorimetricData because the propositions are of types DataPropositionInput and CalorimetricDataPropositionInput. The proposition OpticalDataPropositionInput does not have gValue or uValue sub-propositions.