Assigning a datatype float value is converted in decimal value

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Assigning a datatype float value is converted in decimal value

luca
I have created a domotic ontology. I create these individuals
report: WeatherReport
state: WeatherState
wind: Wind
report -hasState-> state
state -hasPhenomenon-> wind
wind -hasSpeed-> float(30.0) this become an xsd:decimal instead of xsd:float

wind = self.dc.Wind("Wind|{}".format(timestamp))
wind.hasSpeed = float(30.0)
logger.info(self.dc.hasSpeed.range_iri) # --> float

Reply | Threaded
Open this post in threaded view
|

Re: Assigning a datatype float value is converted in decimal value

Jiba
Administrator
Hi,

By default, Owlready uses XSD decimal to represent Python float.

You can change this behaviour to use XSD float by adding the following line at the beginning of your program:

set_datatype_iri(float, "http://www.w3.org/2001/XMLSchema#float")

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Assigning a datatype float value is converted in decimal value

luca
Thanks a lot