Access to the iri range

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

Access to the iri range

Rickshow
Dear forum,
I am making a parser whose goal is to convert OWL text format to another format. I am making the script in Python with the owlready2 library.My problem arises when I try to access the data type inside the range IRI.

How can I access this object? I can't find a way to access the IRI

Example: <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> 

in reference to "integer". I need to be able to access the IRI to be able to receive the integer string so I can convert it, the other option is to transform the IRI into a string and be able to access the #integer by hand but I can't.

Can anyone think of a solution and if not, how to do what I need to do?

Reply | Threaded
Open this post in threaded view
|

Re: Access to the iri range

Jiba
Administrator
Hello,

Owlready uses Python datatype for representing the datatype, but the corresponding IRI is stored in a dictionary, encoded as a store-ID.

You can obtain it as follows:

from owlready2 import *
import owlready2.base

storid = base._universal_datatype_2_abbrev[int]
iri = default_world._unabbreviate(storid)
# => iri = 'http://www.w3.org/2001/XMLSchema#integer'

The same will works for float, str, etc.

Best regards,
Jiba