monarch-initiative / babelon

A format for language profiles for ontologies
https://monarch-initiative.github.io/babelon/
MIT License
8 stars 0 forks source link

Figure out how we we can use linkml-runtime::csv_loader to parse babel file #5

Closed matentzn closed 2 years ago

matentzn commented 2 years ago

https://github.com/linkml/linkml-runtime/blob/main/linkml_runtime/loaders/csv_loader.py

matentzn commented 2 years ago
victoriasoesanto commented 2 years ago

@cmungall When running linkml-convert -t rdf -s babelon.yaml -C Profile -S translations parsed_data_sample.csv, it gives a ValueError: subject_id must be supplied.

(babelon) ➜ linkml_csv_loader_test git:(linkml_csv_loader_test_issue) ✗ linkml-convert -t rdf -s babelon.yaml -C Profile -S translations parsed_data_sample.csv Loading from parsed_data_sample.csv Traceback (most recent call last): File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/bin/linkml-convert", line 8, in sys.exit(cli()) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/click/core.py", line 760, in invoke return __callback(args, kwargs) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/linkml/utils/converter.py", line 105, in cli obj = loader.load(source=input, target_class=py_target_class, inargs) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/linkml_runtime/loaders/csv_loader.py", line 44, in load return JSONLoader().loads(json.dumps({index_slot: objs}), target_class=target_class) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/linkml_runtime/loaders/loader_root.py", line 126, in loads return self.load(source, target_class, metadata=metadata) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/linkml_runtime/loaders/loader_root.py", line 85, in load results = self.load_any(*args, kwargs) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/linkml_runtime/loaders/json_loader.py", line 29, in load_any accept_header="application/ld+json, application/json, text/json", metadata=metadata) File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/linkml_runtime/loaders/loader_root.py", line 66, in load_source return target_class(data_as_dict) File "", line 4, in init File "test", line 115, in post_init File "test", line 115, in File "", line 9, in init File "test", line 66, in post_init File "/Users/victoria/.local/share/virtualenvs/babelon-4LG39QZp/lib/python3.7/site-packages/linkml_runtime/utils/yamlutils.py", line 246, in MissingRequiredField raise ValueError(f"{field_name} must be supplied") ValueError: subject_id must be supplied

matentzn commented 2 years ago

Can you provide a link to the input csv?

victoriasoesanto commented 2 years ago

I've created a branch #12 that contains the input csv and schema for testing.

matentzn commented 2 years ago

Excellent.

hrshdhgd commented 2 years ago

Hey @victoriasoesanto , I ran this locally and it works if you first convert the csv into tsv. Not sure if this is a bug but that will get you past this error. Hope this helps!

victoriasoesanto commented 2 years ago

@hrshdhgd That works! Thank you so much. @cmungall would this be a bug?

cmungall commented 2 years ago

Yes you can go ahead and make separate issues:

I'll close this one as it looks like you have it working

victoriasoesanto commented 2 years ago

Thank you @cmungall .