Build Ontologies That Python Can Actually Use 💻
Ontologies describe knowledge in a form machines can reason about. Ontologies with Python connects that idea to practical code: it shows how to create, inspect, modify, reason over, and query OWL 2.0 ontologies using Python and the Owlready2 library. The book is built for readers who want semantic-web concepts to become working tools rather than abstract diagrams.
Across eleven chapters, the material starts with the Python language skills needed for the rest of the book, then moves into OWL ontologies, the Protégé editor, and the Owlready2 API.
From Python Basics to OWL
Early chapters review the Python features that matter for ontology programming: numbers, strings, dictionaries, classes, instances, special methods, modules, and installation of Owlready2. From there, the book introduces OWL ontology structure and demonstrates how to create ontologies manually with Protégé, using a bacteria ontology as a running example.
Working with Owlready2
Readers learn how to access ontologies in Python, list their contents, search for entities, work with huge ontologies and disk caches, modify rendering, manage a local ontology directory, reload ontologies in the quadstore, and create dynamic websites from ontology data. Later chapters cover creating and modifying ontologies programmatically, including classes, properties, individuals, relations, existential restrictions, namespaces, refactoring, forward declarations, and imports.
Reasoning and Rules
Automatic reasoning receives substantial attention. The book examines open-world and closed-world assumptions, inconsistent classes and ontologies, restriction reasoning on numbers and strings, and SWRL rules with both Protégé and Owlready. It closes with an ontology-based decision support example.
Annotations, Search, and Biomedical Terminologies
Annotation chapters show how to annotate entities, constructs, properties, and relations, create new annotation classes, and work with multilingual texts. A DBpedia example leads into full-text search. The medical terminology chapters use PyMedTermino and UMLS, covering terminology import, loading, unified concepts, mappings, concept sets, and a multi-terminology browser.
Mixing Python and OWL; RDF and SPARQL
Advanced chapters add Python methods to OWL classes, associate Python modules with ontologies, support type inference and polymorphism, and read restrictions backward. Examples include Gene Ontology part-of relations and a protein dating site. The final section covers RDF triples with RDFlib and Owlready, SPARQL queries, direct SQLite3 interrogation, custom datatypes, and isolated worlds.
Who Will Find It Useful
This is a technical book for Python developers, data scientists, knowledge engineers, and informatics practitioners who need to build or query ontologies rather than only read about them. It assumes some programming interest but reviews the Python foundations as it goes. Readers working in biomedical informatics may find the UMLS and Gene Ontology material especially relevant.
Why It Matters
Semantic-web standards are powerful, but they become useful when they connect to everyday code. By pairing OWL 2.0 with Python and Owlready2, this book turns ontology work into something readers can test, extend, and reuse in their own projects.
User Reviews
Only logged in customers who have purchased this product may leave a review.
Original price was: $5.00.$2.50Current price is: $2.50.

There are no reviews yet.