d3.sparql - How to query SPARQL endpoints directly from D3js?

d3.js, sparql

Solution

I finally came around to create a d3-sparql plugin which is build according the d3 v4 plugin architecture. (A d3 v3 version is also available.)

Download and add the plugin to your project:

<script src="d3-sparql.min.js"></script>

Specify the endpoint and *query" to get the data prepared for use in a d3 visualization:

d3.sparql(endpoint, query, function (error, data) {
  console.log(data);
}

The plugin also does cast the RDF datatype in the JavaScript equivalents `Date()` and `Number()`.

Problem

I like to get visuals based on RDF data from a SPARQL endpoint. It would be a nice addition to d3 to get an additional external data loader which can pull data by issuing SPARQL queries. Did already someone work on something like this? Any pointers for such an enterprise? Or a completly obvious solution I did overlook?

Original source