hermitpy
Overview
A HermiT-style OWL reasoner in Python. It checks whether an ontology is consistent and builds a direct class hierarchy. Reasoning uses a hypertableau and does not need a JVM.
The public entry is Reasoner. It reads an rdflib graph, rejects OWL outside a documented fragment, and answers consistency, unsatisfiable classes, and direct subclasses. The calculus follows Motik, Shearer, and Horrocks, “Hypertableau Reasoning for Description Logics,” Journal of Artificial Intelligence Research, 2009. hermitpy is LGPL-3.0-or-later. HermiT, the reasoner that introduced this calculus, is copyright Oxford University Computing Laboratory 2008–2014.
The pieces
Reasoner, consistency, unsatisfiable classes, and the direct hierarchy.
FragmentThe OWL constructs the loader accepts, and the ones it refuses.
ClassificationHow subclass pairs, equivalents, and owl:Nothing are chosen.
TableauThe completion graph: rules, blocking, clashes, and the search bounds.
ErrorsUnsupportedConstruct, InconsistentOntology, and ReasonerLimitExceeded.
One call
from rdflib import Graph
from hermitpy import Reasoner
graph = Graph()
graph.parse("ontology.ttl")
reasoner = Reasoner(graph)
reasoner.is_consistent()
reasoner.direct_subclasses()
direct_subclasses returns pairs of IRIs. Equivalent classes appear in both directions. Every satisfiable class with no stricter named parent is linked to owl:Thing. An inconsistent ontology raises InconsistentOntology instead of classifying every class as owl:Nothing.
Install
git clone https://github.com/lamng3/hermitpy.git
cd hermitpy
pip install -e .
Python 3.8 or newer. The only dependency is rdflib. Short scripts live in examples/. Tests are python -m unittest discover.