You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I sometimes need to check whether a given URI is likely to be in an ontology. Given that there are multiple legal prefixes, there isn't a simple way to check this without just looking up the term, which is costly when the term is not in the ontology.
Example of a current function for this including partial workaround:
def has_SO_uri(uri: str) -> bool:
"""Test if a given URI is in the ontology (effectively an exception-checking wrapper around get_term_by_uri)
:param ontology: Ontology to check for term containment
:param str: URI to look up
:return: true if this is a URI in the
"""
if not (uri.startswith("https://identifiers.org/SO") or uri.startswith("http://identifiers.org/so/SO")):
return False
try:
tyto.SO.get_term_by_uri(uri)
return True
except LookupError:
return False
The text was updated successfully, but these errors were encountered:
I sometimes need to check whether a given URI is likely to be in an ontology. Given that there are multiple legal prefixes, there isn't a simple way to check this without just looking up the term, which is costly when the term is not in the ontology.
Example of a current function for this including partial workaround:
The text was updated successfully, but these errors were encountered: