I'd also suggest to use the power of Linux commands here if you want to
use bash. `sed` is something like the swiss-army knife for those things
On 10.12.2017 10:18, Andy Seaborne wrote:
> You can do with text processing:
>
> 1/ TSV is easier : replace the first two spaces of the NT output with
> real tabs. Otherwise, replace the first 2 spaces with commas and
> worry about the CSV-quoting rules for literals.
>
> 2/ Use SPARQL TSV or CSV output formats on "SELECT * { ?s ?p ?o }"
>
> Andy
>
> On 10/12/17 09:00, Jean-Marc Vanel wrote:
>> Hi Laura
>>
>> It's not exactly what you want, but it can be used.
>> It does in fact more than what you want: it creates a table from a graph
>> coming from any SPARQL query.
>> But the output is HTML, and it's not a command line (could be
>> implemented
>> as such ! ).
>> And from the HTML table , you can obtain CSV in several ways, for
>> example
>> with LibreOffice:
>> https://stackoverflow.com/questions/1403087/how-can-i-convert-an-html-table-to-csv
>>
>>
>> In the tools page, push "Table" button:
>> http://semantic-forms.cc:9112/tools
>> (needs login)
>> And then you obtain the table (no login needed):
>> http://semantic-forms.cc:9112/table?query=PREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APrefix+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0D%0ACONSTRUCT+%7B+%3FS+%3FP+%3FO+.+%7D+WHERE+%7B+GRAPH+%3FG+%7B+%3FS+%3FP+%3FO+.+%7D+%7D+LIMIT+10%0D%0A%0D%0A%23CONSTRUCT+%7B+%3Fsub+geo%3Along+%3FLON+.%3Fsub+geo%3Alat+%3FLAT+.+%3Fsub+rdfs%3Alabel+%3FLAB.%7D%0D%0A%23WHERE+%7BGRAPH+%3FGRAPH+%7B+%3Fsub+geo%3Along+%3FLON+.%3Fsub+geo%3Alat+%3FLAT+.+%3Fsub+rdfs%3Alabel+%3FLAB.++%7D+%7D
>>
>>
>>
>> 2017-12-10 7:37 GMT+01:00 Laura Morales <[email protected]>:
>>
>>> Would it make sense to add an "--output=csv" to RIOT? In particular I'm
>>> looking at the case of reading a file in .nt/.ttl format and outputting
>>> triples in CSV or TSV. This would be really really handy for piping in
>>> Bash. Unfortunately there doesn't seem to be any easy way to convert
>>> NT to
>>> CSV, so it would be really nice if RIOT could spit out CSV. Would
>>> this make
>>> sense?
>>>
>>
>>
>>