-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check first versionIRI then versionInfo in ontology.get_version() (#301)
* Removed redundant infer_version in tools/ontoversion * Added versionINFO in ontology.get_version * VersionIRI has precendence over versionInfo and added test * Added test for get_version
- Loading branch information
1 parent
b6c8924
commit 63ead2e
Showing
6 changed files
with
96 additions
and
26 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
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,29 @@ | ||
from typing import TYPE_CHECKING | ||
import pytest | ||
|
||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
|
||
|
||
def test_get_version(repo_dir: "Path") -> None: | ||
"""Test get_version function in ontology""" | ||
from ontopy import get_ontology | ||
|
||
ontopath = repo_dir / "tests" / "testonto" | ||
testonto = get_ontology(str(ontopath) + "/testonto.ttl").load() | ||
assert ( | ||
testonto.get_version(as_iri=True) == "http://emmo.info/testonto/0.1.0" | ||
) | ||
assert testonto.get_version() == "0.1.0" | ||
|
||
testonto_noVersionIRI = get_ontology( | ||
str(ontopath) + "/testonto_noVersionIRI.ttl" | ||
).load() | ||
assert testonto_noVersionIRI.get_version() == "0.1.0" | ||
with pytest.raises(TypeError): | ||
testonto_noVersionIRI.get_version(as_iri=True) | ||
testonto_noVersionIRI_noVersionInfo = get_ontology( | ||
str(ontopath) + "/testonto_noVersionIRI_noVersionInfo.ttl" | ||
).load() | ||
with pytest.raises(TypeError): | ||
testonto_noVersionIRI_noVersionInfo.get_version() |
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
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,12 @@ | ||
@prefix : <http://emmo.info/testonto#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix xml: <http://www.w3.org/XML/1998/namespace> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix skos: <http://www.w3.org/2004/02/skos/core#> . | ||
@base <http://emmo.info/testonto> . | ||
|
||
<http://emmo.info/testonto> rdf:type owl:Ontology ; | ||
owl:imports <http://emmo.info/testonto/0.1.0/models> ; | ||
owl:versionInfo "0.1.0" . |
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,11 @@ | ||
@prefix : <http://emmo.info/testonto#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix xml: <http://www.w3.org/XML/1998/namespace> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix skos: <http://www.w3.org/2004/02/skos/core#> . | ||
@base <http://emmo.info/testonto> . | ||
|
||
<http://emmo.info/testonto> rdf:type owl:Ontology ; | ||
owl:imports <http://emmo.info/testonto/0.1.0/models> . |
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