Skip to content

Commit

Permalink
Updated sync_reasoner to check for no relation after reasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
francescalb committed Nov 3, 2023
1 parent 6c60eba commit bb6900a
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions tests/ontopy_tests/test_reasoner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,44 @@
from ontopy.ontology import Ontology


def test_sync_reasoner_hermit() -> None:
def test_sync_reasoner_hermit(repo_dir: "Path") -> None:
"""Test `ontopy:Ontology.sync_reasoner()` with HermiT."""
from ontopy import get_ontology

testonto = get_ontology("../testonto/testonto_for_reasoner.ttl")
print(testonto)
testonto = get_ontology(
repo_dir / "tests" / "testonto" / "testonto_for_reasoner.ttl"
).load()
assert testonto.Avocado
assert not isinstance(testonto.Avocado, testonto.NaturalDye)
testonto.sync_reasoner(reasoner="HermiT")
assert isinstance(testonto.Avocado, testonto.NaturalDye)


def test_sync_reasoner_pellet() -> None:
def test_sync_reasoner_pellet(repo_dir: "Path") -> None:
"""Test `ontopy:Ontology.sync_reasoner()` with Pellet"""
from ontopy import get_ontology

testonto = get_ontology("../testonto/testonto_for_reasoner.ttl")
print(testonto)
testonto = get_ontology(
repo_dir / "tests" / "testonto" / "testonto_for_reasoner.ttl"
).load()

assert testonto.Avocado
assert not isinstance(testonto.Avocado, testonto.NaturalDye)
testonto.sync_reasoner(reasoner="Pellet")
assert isinstance(testonto.Avocado, testonto.NaturalDye)


def test_sync_reasoner_fact() -> None:
def test_sync_reasoner_fact(repo_dir: "Path") -> None:
"""Test `ontopy:Ontology.sync_reasoner()` with FaCT++"""
from ontopy import get_ontology

testonto = get_ontology("../testonto/testonto_for_reasoner.ttl")
print(testonto)

testonto = get_ontology(
repo_dir / "tests" / "testonto" / "testonto_for_reasoner.ttl"
).load()
assert testonto.Avocado
assert not isinstance(testonto.Avocado, testonto.NaturalDye)
testonto.sync_reasoner(reasoner="FaCT++")
assert isinstance(testonto.Avocado, testonto.NaturalDye)


def test_sync_reasoner_wrong(testonto: "Ontology") -> None:
Expand Down

0 comments on commit bb6900a

Please sign in to comment.