oda-hub / oda_api

API client to access some of the MMODA resources: INTEGRAL, POLAR, ANTARES, LIGO/Virgo, SDSS
Other
2 stars 2 forks source link

Think of using "duck type compatibility" in `ontology_helper._get_datatype_restriction()` #254

Open dsavchenko opened 6 months ago

dsavchenko commented 6 months ago

Example: Restricting Percentage to integer values.

Maybe return xsd:Integer instead of throwing "Ambiguous datatype" when possible. This will in principle follow PEP https://peps.python.org/pep-0484/#the-numeric-tower

But to check with dispatcher. Do we have a way to restrict Float class?

But: Doesn't we produce inconsistent ontology (xsd:integer is not a subclass of xsd:float)? Maybe there are better ways?