-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into owlapi_mapper_tests
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from owlapy.class_expression import ( | ||
OWLClass, | ||
OWLObjectComplementOf, | ||
) | ||
from owlapy.iri import IRI | ||
from owlapy.owl_reasoner import SyncReasoner | ||
from owlapy.owl_ontology_manager import SyncOntologyManager | ||
|
||
def test_complement_of_owl_thing_is_owl_nothing(): | ||
owl_thing = OWLClass(IRI.create('http://www.w3.org/2002/07/owl#Thing')) | ||
owl_nothing = OWLClass(IRI.create('http://www.w3.org/2002/07/owl#Nothing')) | ||
complement_of_thing = OWLObjectComplementOf(owl_thing) | ||
complement_of_nothing = OWLObjectComplementOf(owl_nothing) | ||
mgr = SyncOntologyManager() | ||
onto = mgr.load_ontology("KGs/Mutagenesis/mutagenesis.owl") | ||
reasoner = SyncReasoner(onto, "HermiT") | ||
equivalent_classes = reasoner.equivalent_classes(complement_of_thing) | ||
assert owl_nothing in equivalent_classes | ||
individuals_thing = reasoner.instances(owl_thing) | ||
individuals_complement_of_nothing = reasoner.instances(complement_of_nothing) | ||
assert individuals_thing == individuals_complement_of_nothing | ||
|
||
def test_complement_of_owl_nothing_is_owl_thing(): | ||
owl_thing = OWLClass(IRI.create('http://www.w3.org/2002/07/owl#Thing')) | ||
owl_nothing = OWLClass(IRI.create('http://www.w3.org/2002/07/owl#Nothing')) | ||
complement_of_nothing = OWLObjectComplementOf(owl_nothing) | ||
mgr = SyncOntologyManager() | ||
onto = mgr.load_ontology("KGs/Mutagenesis/mutagenesis.owl") | ||
reasoner = SyncReasoner(onto, "HermiT") | ||
individuals_thing = reasoner.instances(owl_thing) | ||
individuals_complement_of_nothing = reasoner.instances(complement_of_nothing) | ||
assert individuals_thing == individuals_complement_of_nothing | ||
|
||
def test_double_complement_is_identity(): | ||
class_iri = IRI.create('http://example.org/MyClass') | ||
my_class = OWLClass(class_iri) | ||
complement = OWLObjectComplementOf(my_class) | ||
double_complement = OWLObjectComplementOf(complement) | ||
assert my_class == double_complement | ||
|