How to access the datatype of a property

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

How to access the datatype of a property

jonathanunderwood
When reading in an existing ontology file I am wondering what is the correct way to access the underlying data type of a datatype property. For example, I am reading in an ontology which has a datatype property of type http://www.w3.org/2001/XMLSchema#unsignedLong. Examining the .range attribute for this once owlready2 has parsed the ontology, I see it represented as the python int type. However, writing out the ontology to a new file persists the datatype as XMLSchema#unsignedLong as expected, so somehow the type information is persisted. The question is: how is that underlying data type accessed from Python? I can't find any attribute that seems to reference it.
Reply | Threaded
Open this post in threaded view
|

Re: How to access the datatype of a property

Jiba
Administrator
Hi,

You're right: the exact datatype is stored in the quadstore but was not available in Python.

In the development version of Owlready (on Bitbucket), I've added the Property.range_iri attribute that returns the list of range as IRI.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: How to access the datatype of a property

jonathanunderwood
Great, thank you for adding that feature!I thought I must have been missing something obvious, nice to know I wasn't.