Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function to return schema elements by id_prefixes #36

Merged
merged 13 commits into from
Nov 29, 2021
Merged

Conversation

sierra-moxon
Copy link
Member

@@ -529,6 +531,40 @@ def expand_curie(self, uri: str) -> str:
return ns[pfx] + local_id
return uri

@lru_cache(CACHE_SIZE)
def get_element_by_prefix(
Copy link
Member

Choose a reason for hiding this comment

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

perhaps decompose this:

  • a method that takes an actual prefix as input and returns element names, get_elements_applicable_for_prefix
  • a method that splits CURIEs (or URIs?) and. extracts the prefix
  • a wrapper that composes these get_elements_applicable_for_identifier

Copy link
Member Author

@sierra-moxon sierra-moxon Nov 18, 2021

Choose a reason for hiding this comment

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

I went ahead and broke this up into 3 methods and added support (by utilizing an existing function! - thanks for the pointer :) ) for URIs as well. Also added a test for URI -- which meant adding monarch_context to the kitchen_sink_no_imports.yaml.

@sierra-moxon sierra-moxon reopened this Oct 15, 2021
@sierra-moxon sierra-moxon marked this pull request as draft October 15, 2021 19:06
@sierra-moxon sierra-moxon changed the title new function to return schema elements by curie prefix DRAFT: new function to return schema elements by curie prefix Oct 15, 2021
@sierra-moxon sierra-moxon marked this pull request as ready for review November 18, 2021 17:39
@sierra-moxon sierra-moxon changed the title DRAFT: new function to return schema elements by curie prefix function to return schema elements by id_prefixes Nov 18, 2021
the id_prefixes mapped to that element.

"""
categories = []
Copy link
Member

Choose a reason for hiding this comment

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

minor: categories is a biolinkism - use elements instead? not a big deal as this is not exposed to the caller but still good to use internally consistent variable names

"""
Get a Model element by prefix.

Parameters
Copy link
Member

Choose a reason for hiding this comment

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

minor: can you change to the rst format used for other methods?

@sierra-moxon
Copy link
Member Author

fixed up doc and moved categories -> elements

@sierra-moxon sierra-moxon merged commit d762126 into main Nov 29, 2021
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.

2 participants