Skip to content

Add get_uri method to term.py class#167

Open
IshaGupta18 wants to merge 1 commit intoalthonos:masterfrom
IshaGupta18:feat-term-property-URI
Open

Add get_uri method to term.py class#167
IshaGupta18 wants to merge 1 commit intoalthonos:masterfrom
IshaGupta18:feat-term-property-URI

Conversation

@IshaGupta18
Copy link

@IshaGupta18 IshaGupta18 commented May 2, 2022

Solving #117, added a method get_uri() to term.py class.

@althonos what's your take on this?

if prefix in ontology.metadata.idspaces:
return "{}{}".format(ontology.metadata.idspaces[prefix][0], local)
else:
return "http://purl.obolibrary.org/obo/{}_{}".format(prefix, local)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not smart to assume OBO URIs for any old ontology. This should raise an exception like a KeyError if there's no idspace defined for the prefix.

Copy link
Owner

@althonos althonos Jun 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cthoyt : Not necessarily, because the prefix could also originate from an import. In that case, you'd have to check the ontology attribute of imported prefixes.

@althonos althonos force-pushed the master branch 2 times, most recently from a690871 to 1e55509 Compare June 18, 2022 14:51
@althonos althonos force-pushed the master branch 2 times, most recently from 481b91f to 7eda5d0 Compare September 14, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants