How can I assign float values to data types?

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

How can I assign float values to data types?

Patrik_L
Hello  together,

I'm trying to automatically assign values to instances using a datatype property, which actually works, but I can't get the desired datatype to be assigned, namely "float", but it always automatically creates a "decimal". Is there a solution for this.
Thanks in advance

My Code:

OP3 = OP('OP3') #OP3 is an individual of class OP

OP3.has_pressure.append(107000.0) #has_pressure is a Datatype property with Range 'float'

##############################
Output in rdf/xml file:

OP rdf:about="#OP3">
  <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
  <has_pressure rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">107000.0</has_pressure>
</OP>>
Reply | Threaded
Open this post in threaded view
|

Re: How can I assign float values to data types?

Jiba
Administrator
Hi,

You can use the following command for using 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: How can I assign float values to data types?

Patrik_L
It worked,
Thank you very much!

Patrik