JavaScript natually fits for querying a SPARQL endpoint which provides a REST service returning the result in the JSON format. The d3sparql.js library provides functions executing a SPARQL query by Ajax call (XMLHttpRequest) and visulaizing results by the D3 library. Basically, this library transforms the SPARQL Query Results JSON Format (aka. application/sparql-results+json) into several JSON formats which major D3 layouts can accept. Many of the examples are borrowed from bl.ocks.org and bost.ocks.org. The d3sparql.js library is distributed under the same license as D3.js's (BSD license).

You can try out some examples from the menu on the top of this page.