Skip to content

Commit

Permalink
Added structural reasoner
Browse files Browse the repository at this point in the history
  • Loading branch information
alkidbaci committed Sep 9, 2024
1 parent 4e30719 commit 8ecb9eb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions owlapy/owl_reasoner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,11 +1153,13 @@ def __init__(self, ontology: Union[SyncOntology, str], reasoner="HermiT"):
Args:
ontology(SyncOntology): Ontology that will be used by this reasoner.
reasoner: Name of the reasoner. Possible values (case-sensitive): ["HermiT", "Pellet", "JFact", "Openllet"].
reasoner: Name of the reasoner. Possible values (case-sensitive): ["HermiT", "Pellet", "JFact", "Openllet",
"Structural"].
Default: "HermiT".
"""
assert reasoner in ["HermiT", "Pellet", "JFact", "Openllet"], \
(f"'{reasoner}' is not implemented. Available reasoners: ['HermiT', 'Pellet', 'JFact', 'Openllet']. "
assert reasoner in ["HermiT", "Pellet", "JFact", "Openllet", "Structural"], \
(f"'{reasoner}' is not implemented. Available reasoners: ['HermiT', 'Pellet', 'JFact', 'Openllet', "
f"'Structural']. "
f"This field is case sensitive.")
if isinstance(ontology, SyncOntology):
self.manager = ontology.manager
Expand Down Expand Up @@ -1194,7 +1196,7 @@ def __init__(self, ontology: Union[SyncOntology, str], reasoner="HermiT"):
"InferredObjectPropertyCharacteristicAxiomGenerator": InferredObjectPropertyCharacteristicAxiomGenerator(),
}

# () Create a reasoner for the loaded ontology
# () Create a reasoner using the ontology
if reasoner == "HermiT":
from org.semanticweb.HermiT import ReasonerFactory
self._owlapi_reasoner = ReasonerFactory().createReasoner(self._owlapi_ontology)
Expand All @@ -1208,6 +1210,9 @@ def __init__(self, ontology: Union[SyncOntology, str], reasoner="HermiT"):
elif reasoner == "Openllet":
from openllet.owlapi import OpenlletReasonerFactory
self._owlapi_reasoner = OpenlletReasonerFactory().getInstance().createReasoner(self._owlapi_ontology)
elif reasoner == "Structural":
from org.semanticweb.owlapi.reasoner.structural import StructuralReasonerFactory
self._owlapi_reasoner = StructuralReasonerFactory().createReasoner(self._owlapi_ontology)
else:
raise NotImplementedError("Not implemented")

Expand Down

0 comments on commit 8ecb9eb

Please sign in to comment.