Conversation
YaphetKG
commented
Feb 16, 2024
- adds download buttons to UI
balhoff
left a comment
There was a problem hiding this comment.
Thanks! I left a code comment about one change.
src/ldf-client-ui.js
Outdated
| header.forEach(function (h, i) { | ||
| line.push(v[h]); | ||
| }); | ||
| csvContent += [line].map(e => e.join(',')) + '\n'; |
There was a problem hiding this comment.
@YaphetKG how hard would it be to make this a bit more robust? How should CSV handle comments within values, or newlines?
There was a problem hiding this comment.
@YaphetKG Comunica has built-in support, somewhere, for various output formats including text/csv (this is an option in the comunica-sparql CLI tool. Can this be reused?
There was a problem hiding this comment.
Hi Jim, added the csv streaming changes (https://github.com/frink-okn/jQuery-Widget.js/pull/3/files) this are the changes this uses the text/csv format , but i have found that the query needs to be re-executed, to use this. It seems like once another consumer such as for displaying the results on the page, goes over the result set, the result set stream becomes empty to do the csv. Due to this, i have it setup so that the same query is executed again, and a new stream is consumed to generate the csv results.
And i can confirm the file properly quotes comma containing labels
<http://purl.obolibrary.org/obo/CL_4030038>,"CD24-positive, CD-133-positive, vimentin-positive proximal tubular cell",<http://purl.obolibrary.org/obo/UBERON_0002113>,kidney```
This is one result from the ubergraph (Cell types abdominal organs) query.
There was a problem hiding this comment.
@YaphetKG I think we need to find another way to download the results. People will be surprised to have to execute the query twice.
Dynamically choose between SPARQL and TPF datasources under the hood
Csv comunica