How to get an output information about loaded ontology with owlready2?

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

How to get an output information about loaded ontology with owlready2?

Tania
I have just started using it, and want to print for example classes or individuals.
I am following the tutorial on loading and managing ontologies.

code:
onto: Ontology = get_ontology("file:///Users/tania/Desktop/pizza.owl").load()
print(onto.classes())
list(onto.individuals())

I was trying both print and list on all kinds of information I was trying to see.

The output is

#if using print, as expected:
<generator object _GraphManager.classes at 0x102e4e1a8>

if using list nothing is printed

the ontology I'm using: https://github.com/owlcs/pizza-ontology/blob/master/pizza.owl
Reply | Threaded
Open this post in threaded view
|

Re: How to get an output information about loaded ontology with owlready2?

Jiba
Administrator
Hello,

You should combine print and list as follows :

print(list(onto.individuals()))

Kind regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13
Reply | Threaded
Open this post in threaded view
|

Re: How to get an output information about loaded ontology with owlready2?

Tania
Thanks a lot!