Accessing owl:versionIRI and general storid

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

Accessing owl:versionIRI and general storid

jesper-friis
Hi, I am trying to access the owl:versionIRI of an ontology. The following code prints the storid for all the annotations and imported ontologies of emmo:
    from owlready2 import get_ontology

    emmo = get_ontology('http://emmo.info/emmo/1.0.0-alpha')
    emmo.load()
    for triplet in emmo.get_triples(s=emmo.storid):
        print(triplet)
One of the triplets `(302, 303, 301)` might correspond to the owl:versionIRI I am looking for. But how do I get the corresponding Python objects for the storid's 301 and 303? I have tried `emmo.world._get_by_storid()`, but that only gives me None.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing owl:versionIRI and general storid

Jiba
Administrator
Hi,

_get_by_storid() returns the corresponding Python objects, but here, they are none. You need to to obtain the IRI, which can be done with _unabbreviate() :

>>> default_world._get_obj_triple_sp_o(onto.storid, default_world._abbreviate("http://www.w3.org/2002/07/owl#versionIRI"))
303
>>> default_world._unabbreviate(303)
'http://emmo.info/emmo/1.0.0-alpha'

(the exact number may vary).

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Accessing owl:versionIRI and general storid

jesper-friis
Thank you. Works great.