-
Notifications
You must be signed in to change notification settings - Fork 91
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
find classes by their class_name #478
Comments
Not sure if this bit of code helps, but here is how I can build a import inspect
from nmdc_schema import nmdc
python_name_dict = {}
for name, member in inspect.getmembers(nmdc):
if inspect.isclass(member) and hasattr(member, 'class_name'):
python_name_dict[name] = member.class_name
print(list(python_name_dict.items())[0:5])
>> [('Activity', 'activity'), ('Agent', 'agent'), ('AttributeValue', 'attribute value'), ('Biosample', 'biosample'), ('BiosampleProcessing', 'biosample processing')] |
I think this is fixed by linkml/linkml-runtime#77 can you confirm @wdduncan |
can you also edit the title of the issue to reflect what the ask is? |
@cmungall renamed the title, but this issue looks to be stale. Perhaps best to close. |
we also have the "uncamelcase" method in the runtime too, so we can go back and forth between class name representations in downstream code. was the ask here that these methods be abstracted away and all versions of the names returned as a tuple? If so, we don't have that. I can close for now with the notion that code is available for downstream applications to go back and forth between naming conventions before/after calling the all_classes method? |
@sierra-moxon Thanks for closing. I opened the ticket quite a while ago, and I don't remember the specific use case :( |
It is useful to be able to find the name of the class according to how it named in the code.
For example, in the nmdc-schema python class , there is a class named
BiosampleProcessing
. But, if you runlist(view.all_class())
, you can only get backbiosample processing
.cc @cmungall
The text was updated successfully, but these errors were encountered: