Skip to content

Commit

Permalink
Corrected test when loading rdfs. It used type for is_a. (#796)
Browse files Browse the repository at this point in the history
# Description
A bugfix in 0wlready2==0.46 corrected what is returned when
using type on dataclasses.
We had used type instead of is_a in the test and this has now been
corrected.
  • Loading branch information
francescalb authored Oct 29, 2024
1 parent d3f8e88 commit ae79ed4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions ontopy/excelparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def create_ontology_from_pandas( # pylint:disable=too-many-locals,too-many-bran
"owlready_ontology.owl#python_name"
)
)

# Add back the triples python name triples that were in the input_ontology.
if input_ontology:
for triple in pyname_triples_to_keep:
Expand Down
2 changes: 2 additions & 0 deletions ontopy/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def get_unabbreviated_triples(
):
# pylint: disable=invalid-name
"""Returns all triples unabbreviated.
Imported ontologies not included.
If any of the `subject`, `predicate` or `obj` arguments are given,
only matching triples will be returned.
Expand Down Expand Up @@ -2157,6 +2158,7 @@ def _get_unabbreviated_triples(
onto, subject=None, predicate=None, obj=None, blank=None
):
"""Help function returning all matching triples unabbreviated.
Does not include imported ontologies.
If `blank` is given, it will be used to represent blank nodes.
"""
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defusedxml>=0.7.1,<1
graphviz>=0.16,<0.21
numpy>=1.19.5,<3
openpyxl>=3.0.9,<3.2
Owlready2>=0.28,!=0.32,!=0.34,<0.46
Owlready2>=0.28,!=0.32,!=0.34,<0.47
packaging>=21.0,<25
pandas>=1.2,<2.3
Pygments>=2.7.4,<3
Expand Down
4 changes: 2 additions & 2 deletions tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def test_load(repo_dir: "Path", testonto: "Ontology") -> None:


def test_load_rdfs() -> None:
"""Test to load non-emmo based ontologies rdf and rdfs"""
from ontopy import get_ontology

# Test loading non-EMMO-based ontologies rdf and rdfs
rdf_onto = get_ontology(
"https://www.w3.org/1999/02/22-rdf-syntax-ns.ttl"
).load(emmo_based=False)
rdfs_onto = get_ontology("https://www.w3.org/2000/01/rdf-schema.ttl").load(
emmo_based=False
)
rdfs_onto.Class # Needed to initialize rdfs_onto
assert type(rdf_onto.HTML).iri == rdfs_onto.Datatype.iri
assert rdf_onto.HTML.is_a[0].iri == rdfs_onto.Datatype.iri

0 comments on commit ae79ed4

Please sign in to comment.