Skip to content

Commit

Permalink
Merge pull request #63 from dice-group/develop
Browse files Browse the repository at this point in the history
Regular update
  • Loading branch information
Demirrr authored Aug 30, 2024
2 parents 3f6f75e + 8a0210d commit cd38c60
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pip3 install owlapy
```shell
# To download RDF knowledge graphs
wget https://files.dice-research.org/projects/Ontolearn/KGs.zip -O ./KGs.zip && unzip KGs.zip
pytest -p no:warnings -x # Running 103 tests takes ~ 30 mins
pytest -p no:warnings -x # Running 102 tests takes ~ 1 min
```

## Usage
Expand Down
34 changes: 34 additions & 0 deletions tests/test_owlapi_adaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
from owlapy.owlapi_adaptor import OWLAPIAdaptor
from owlapy.providers import owl_datatype_min_inclusive_restriction

from owlapy.class_expression import OWLClassExpression
from owlapy.owl_ontology_manager import OntologyManager
from owlapy.owlapi_adaptor import OWLAPIAdaptor


class TestOwlapiAdaptor(unittest.TestCase):
ns = "http://dl-learner.org/mutagenesis#"
Expand All @@ -22,6 +26,36 @@ class TestOwlapiAdaptor(unittest.TestCase):
ce = OWLObjectIntersectionOf([nitrogen38, has_charge_more_than_0_85])
adaptor = OWLAPIAdaptor(ontology_path)

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"] = OWLAPIAdaptor(path=ontology_path, name_reasoner="HermiT")
owl_reasoners["Pellet"] = OWLAPIAdaptor(path=ontology_path, name_reasoner="Pellet")
owl_reasoners["JFact"] = OWLAPIAdaptor(path=ontology_path, name_reasoner="JFact")
owl_reasoners["Openllet"] = OWLAPIAdaptor(path=ontology_path, name_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 k, 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)
for k, reasoner in owl_reasoners.items():
reasoner.stopJVM()

def test_consistency_check(self):
self.assertEqual(self.adaptor.has_consistent_ontology(), True)

Expand Down

0 comments on commit cd38c60

Please sign in to comment.