Can't access Ontology classes.

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

Can't access Ontology classes.

CardiffMatt
Hi,

I've been struggling for a while trying to access classes through owlready in python. I have successfully imported the ontology using onto = get_ontology("file://ontologies/AnnotDoc.owl").load(), however I can't access the classes.

Calling onto.Document or onto.sciDeo returns a noneType, however the command "list(onto.classes())" displays all of the classes, and one of the classes is sciDeo.Document.

Any idea what is wrong, either with the ontology or what I am doing wrong? Help would be greatly appreciated.

Matt
Reply | Threaded
Open this post in threaded view
|

Re: Can't access Ontology classes.

Jiba
Administrator
Hello,

I think you need namespace, since you classes seem to be defined in a different namespace that the ontology: ontology IRI is file://ontologies/AnnotDoc.owl but your classes are prefixed with sciDeo?

See http://owlready2.readthedocs.io/en/latest/namespace.html for namespace.

You can also use IRIS["http://full_iri"] to access your classes.

Best regards,
Jean-Baptiste Lamy
MCF HDR, Laboratoire LIMICS, Université Paris 13