Skip to content

Commit

Permalink
Added sconverting Posix to str in get_ontology (#327)
Browse files Browse the repository at this point in the history
* Added converting pathlib.Path to as_uri in get_ontology
  • Loading branch information
francescalb committed Dec 10, 2021
1 parent c76e9a7 commit 516f047
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ontopy/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import uuid
import tempfile
import types
import pathlib
from typing import Union
from collections import defaultdict
from collections.abc import Iterable
Expand Down Expand Up @@ -82,6 +83,12 @@ def get_ontology(self, base_iri="emmo-inferred"):
- "emmo-development": load latest inferred development version
of EMMO
"""
base_iri = (
base_iri.as_uri()
if isinstance(base_iri, pathlib.Path)
else base_iri
)

if base_iri == "emmo":
base_iri = (
"https://raw.githubusercontent.com/emmo-repo/"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_load(repo_dir: "Path") -> None:

# Load a local ontology with catalog
testonto = repo_dir / "tests" / "testonto" / "testonto.ttl"
onto = get_ontology(str(testonto)).load()
onto = get_ontology(testonto).load()
assert onto.TestClass.prefLabel.first() == "TestClass"

# Use catalog file when downloading from web
Expand Down

0 comments on commit 516f047

Please sign in to comment.