I did some code in owl ready and now I need to import an Ontology to use it. The problem is owlready doesn't do it correctly, no classes found. Like if I try to import go.owl (
http://geneontology.org/docs/download-ontology/) and then add a class (for simplicity) named A with code:
with onto:
class A(GO_0046852):
pass
I get the error:
NameError: name 'GO_0000030' is not defined
This is because owlready takes into consideration thats the class IRI should be #GO_0000030 not
http://purl.obolibrary.org/obo/GO_0046852 or even
http://purl.obolibrary.org/obo#GO_0046852 which doesn't make sense. So no class gets detected. How can I fix this, or go around it?
I can't swap to another API now because I already did so much code. This is the code that yields an error:
from owlready2 import *
onto = get_ontology("go.owl").load()
with onto:
class A(GO_0000030):
pass
onto.save(file = "test.owl", format = "rdfxml")