Callidon / sparql-engine

🚂 A framework for building SPARQL query engines in Javascript/Typescript
https://callidon.github.io/sparql-engine
MIT License
99 stars 14 forks source link

Add support for formatting query results to CSV and TSV #56

Closed Callidon closed 4 years ago

Callidon commented 4 years ago

This PR adds the functionality to format query results to the official W3C CSV and TSV formats. The new functions CSVFormat and TSVFormat can be piped to an existing pipeline of bindings and used as follows

import { CSVFormat } from 'sparql-engine'

// configure your datasets, graphs and the plan builder as usual

let pipeline = builder.execute(/* some SPARQL query */)

// plug-in the csv formatter
pipeline = pipeline.pipe(CSVFormat)

// output results
pipeline.subscribe(console.log, console.error, () => console.log('done'))