Why OWLReady sets data property with "float" range as "decimal"?

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

Why OWLReady sets data property with "float" range as "decimal"?

Babroo
Hi

I am trying to assign an existed data property to an individual,  but OWLReady sets the range of data prop to "decimal", while the original range of data prop is "float" and also in the python, the data type is "float".

I am using the following line of code:

>>  setattr(new_instance, data_prop, value)


Could you please tell me how can I fix this problem?

Thanks

M. Babr

Reply | Threaded
Open this post in threaded view
|

Re: Why OWLReady sets data property with "float" range as "decimal"?

William
decimal is a wrapper of float.
Reply | Threaded
Open this post in threaded view
|

Re: Why OWLReady sets data property with "float" range as "decimal"?

Jiba
Administrator
In reply to this post by Babroo
Hi,

By default, Owlready uses decimal to represent Python float, in order to keep the compatibility between int and float: Python accepts an int as a float, but OWL does not. It does accept a decimal, though.

You can use the following command to make Owlready use float instead of decimal:

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

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Why OWLReady sets data property with "float" range as "decimal"?

Babroo
Hi

It was a big problem for me because "Pellet" reasoner in Protege gave an error that  "decimal value does not belong to datatype float". Anyway, your suggested command line solves this problem for me. Thank you.

Babroo