Owlready
Search
everywhere
only in this topic
Advanced Search
Access to classes
Classic
List
Threaded
♦
♦
Locked
4 messages
Lusi
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Access to classes
Hello,
first thanks for keeping this forum
I've read the previous post about classes but I can't understand how to access classes in owl :
I load my ontology:
(1) onto = get_ontology("root-ontology.owl").load()
When I try to visualize what is in it it works well :
(2) print(list(onto.classes())[:10])
but I don't understand if the names returned by (2) are the labels of the classes or their name
it looks like this : root-ontology.__class_name__
I read about Namespaces so I tried to load the iris base :
(3) obo = onto.get_namespace(onto.base_iri)
But I can't access classes by obo either.
My goal is pretty simple, I want to access parents or children of a given class.
Thanks a lot, have a good week,
Lucas
Jiba
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Access to classes
Administrator
Hello,
If your classes are in the OBO namespace, you need to create the namespace with the OBO IRI, e.g.:
obo = get_namespace("
http://purl.obolibrary.org/obo/
")
then you can do obo.classname.
Jiba
Lyle
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Access to classes
I also lost a bit of time on this as well. Considering how common it will be to load obo ontologies, I think it would be helpful to have an example of this in the "Introduction" section of the documentation.
Jiba
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Access to classes
Administrator
Added!
Jiba
Free forum by Nabble
Edit this page