Skip to content

Commit

Permalink
added test from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
alkidbaci committed Sep 4, 2024
1 parent f38f579 commit 6200ad4
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tests/test_sync_reasoner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import unittest

from jpype import JDouble
from owlapy.class_expression import OWLClass, OWLDataSomeValuesFrom, OWLObjectIntersectionOf, OWLNothing, OWLThing
from owlapy.class_expression import OWLClass, OWLDataSomeValuesFrom, OWLObjectIntersectionOf, OWLNothing, OWLThing, \
OWLClassExpression
from owlapy.iri import IRI
from owlapy.owl_axiom import OWLDisjointClassesAxiom, OWLDeclarationAxiom, OWLClassAssertionAxiom, OWLSubClassOfAxiom, \
OWLEquivalentClassesAxiom, OWLSubDataPropertyOfAxiom, OWLSubObjectPropertyOfAxiom
Expand Down Expand Up @@ -84,6 +85,35 @@ class TestSyncReasoner(unittest.TestCase):
def test_consistency_check(self):
self.assertEqual(self.reasoner.has_consistent_ontology(), True)

def test_named_concepts(self):

ontology_path = "KGs/Family/family-benchmark_rich_background.owl"

# Available OWL Reasoners: 'HermiT', 'Pellet', 'JFact', 'Openllet'
owl_reasoners = dict()
owl_reasoners["HermiT"] = SyncReasoner(ontology=ontology_path, reasoner="HermiT")
owl_reasoners["Pellet"] = SyncReasoner(ontology=ontology_path, reasoner="Pellet")
owl_reasoners["JFact"] = SyncReasoner(ontology=ontology_path, reasoner="JFact")
owl_reasoners["Openllet"] = SyncReasoner(ontology=ontology_path, reasoner="Openllet")

onto = OntologyManager().load_ontology(ontology_path)

def compute_agreements(i: OWLClassExpression, verbose=False):
if verbose:
print(f"Computing agreements between Reasoners on {i}...")
retrieval_result = None
flag = False
for __, reasoner in owl_reasoners.items():
if retrieval_result:
flag = retrieval_result == {_.str for _ in reasoner.instances(i)}
else:
retrieval_result = {_.str for _ in reasoner.instances(i)}
return flag

# Agreement between instances over
for i in onto.classes_in_signature():
assert compute_agreements(i, True)

def test_inconsistency_check(self):
manager = OntologyManager()
onto = manager.load_ontology(IRI.create(self.ontology_path))
Expand Down

0 comments on commit 6200ad4

Please sign in to comment.