© Lamy Jean-Baptiste 2021
L. Jean-BaptisteOntologies with Pythonhttps://doi.org/10.1007/978-1-4842-6552-9_4

4. Accessing ontologies in Python

Lamy Jean-Baptiste1  
(1)
Université Sorbonne Paris Nord, LIMICS, Sorbonne Université INSERM, UMR 1142, Bobigny, France
 

In this chapter, we’ll see how to access the contents of an ontology in Python using Owlready. We will use the ontology of bacteria that we created in Chapter 3, as well as Gene Ontology, an ontology widely used in bioinformatics.

4.1 Importing Owlready

Owlready (version 2) is imported in Python as follows:
>>> from owlready2 import *

Note that it is better to use the import of the contents of the module with “from owlready2 import *” rather than importing the module with “import owlready2” (see ...

Get Ontologies with Python: Programming OWL 2.0 Ontologies with Python and Owlready2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.