Problem statement summary:
Currently core classes like Ontology (in owl_ontology.py) and StructuralReasoner (in owl_reasoner.py) are tightly coupled to owlready2 as their internal store and query engine. This coupling creates a range of correctness, maintainability, and architectural problems that increasingly limit us from building reliable OWL tooling. We should replace this dependency with a direct implementation (e.g backed by more lightweight libraries like rdflib).
Detailed problems
Known correctness bugs with no upstream fix path
Multiple workaround comments are scattered across StructuralReasoner and Ontology acknowledging known bugs in owlready2 that we cannot fix ourselves:
equivalent_classes (owl_reasoner.py:134–136): INDIRECT_equivalent_to does not reliably recognize equivalent complex class expressions. A manual workaround is in place.
equivalent_classes for complex expressions (owl_reasoner.py:144–146): owlready2 does not support EquivalentClasses general class axioms, forcing a slow O(n) scan over all classes in the signature.
disjoint_classes for complex expressions (owl_reasoner.py:176–178): Same issue — owlready2 lacks general class axiom support for DisjointClasses.
object_property_values (owl_reasoner.py:232–234): _get_values_for_individual gives inconsistent results for equivalent object properties; direct=False is recommended as a workaround.
general_class_axioms (owl_ontology.py:943): Only SubClassOf GCAs are supported by owlready2; EquivalentClasses GCAs are silently skipped.
Unimplemented methods due to owlready2 limitations
Several AbstractOWLOntology methods are stubbed with raise NotImplementedError precisely because owlready2 does not support the needed semantics:
def get_abox_axioms(self) -> Iterable:
raise NotImplementedError("will be implemented in future")
def get_tbox_axioms(self) -> Iterable:
raise NotImplementedError("will be implemented in future")
def get_abox_axioms_between_individuals(self) -> Iterable:
raise NotImplementedError("will be implemented in future")
def get_abox_axioms_between_individuals_and_classes(self) -> Iterable:
raise NotImplementedError("will be implemented in future")
Potential Improvements & Authenticity
Owlapy has established itself as a prominent library in the semantic web ecosystem. However, its strong reliance on external dependencies can constrain its long-term flexibility and obscure its core identity. Developing and maintaining our own implementation would give us full control over the library’s internal behavior, enabling more efficient design decisions, easier debugging, and alignment assurance for the theoretical aspect. This autonomy also creates a solid foundation for continuous optimization and future enhancements.
Problem statement summary:
Currently core classes like
Ontology(inowl_ontology.py) andStructuralReasoner(inowl_reasoner.py) are tightly coupled toowlready2as their internal store and query engine. This coupling creates a range of correctness, maintainability, and architectural problems that increasingly limit us from building reliable OWL tooling. We should replace this dependency with a direct implementation (e.g backed by more lightweight libraries likerdflib).Detailed problems
Known correctness bugs with no upstream fix path
Multiple workaround comments are scattered across StructuralReasoner and Ontology acknowledging known bugs in owlready2 that we cannot fix ourselves:
equivalent_classes(owl_reasoner.py:134–136):INDIRECT_equivalent_todoes not reliably recognize equivalent complex class expressions. A manual workaround is in place.equivalent_classesfor complex expressions (owl_reasoner.py:144–146):owlready2does not support EquivalentClasses general class axioms, forcing a slow O(n) scan over all classes in the signature.disjoint_classes for complex expressions (
owl_reasoner.py:176–178): Same issue —owlready2lacks general class axiom support for DisjointClasses.object_property_values(owl_reasoner.py:232–234):_get_values_for_individualgives inconsistent results for equivalent object properties;direct=Falseis recommended as a workaround.general_class_axioms (
owl_ontology.py:943): Only SubClassOf GCAs are supported byowlready2; EquivalentClasses GCAs are silently skipped.Unimplemented methods due to
owlready2limitationsSeveral
AbstractOWLOntologymethods are stubbed with raiseNotImplementedErrorprecisely becauseowlready2does not support the needed semantics:Potential Improvements & Authenticity
Owlapy has established itself as a prominent library in the semantic web ecosystem. However, its strong reliance on external dependencies can constrain its long-term flexibility and obscure its core identity. Developing and maintaining our own implementation would give us full control over the library’s internal behavior, enabling more efficient design decisions, easier debugging, and alignment assurance for the theoretical aspect. This autonomy also creates a solid foundation for continuous optimization and future enhancements.