Skip to content

Commit

Permalink
Fixed issue #583
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis committed Apr 13, 2023
1 parent 572b5fb commit 07e09d8
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions ontopy/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,31 +280,13 @@ def get_by_label(
`prefix` argument will take precedence.
A NoSuchLabelError is raised if `label` cannot be found.
Note
----
The current implementation also supports "*" as a wildcard
matching any number of characters. This may change in the future.
"""
# pylint: disable=too-many-arguments,too-many-branches,invalid-name
if not isinstance(label, str):
raise TypeError(
f"Invalid label definition, must be a string: {label!r}"
)

# Comment to reviewer:
# Do we really want to disallow space in label?
# I think we wanted ontopy to work with any ontology, also ontologies
# having space in their labels.
# Rather than enforcing EMMO conventions here, I think the user should
# run emmocheck on the ontology - it will alert about labels with
# spaces
if " " in label:
raise ValueError(
f"Invalid label definition, {label!r} contains spaces."
)

if self._label_annotations is None:
for iri in DEFAULT_LABEL_ANNOTATIONS:
try:
Expand Down Expand Up @@ -382,6 +364,11 @@ def get_by_label_all(self, label, label_annotations=None, prefix=None):
"""Like get_by_label(), but returns a list with all matching labels.
Returns an empty list if no matches could be found.
Note
----
The current implementation also supports "*" as a wildcard
matching any number of characters. This may change in the future.
"""
if not isinstance(label, str):
raise TypeError(
Expand Down

0 comments on commit 07e09d8

Please sign in to comment.