Turn SPARQL queries into charts and views

With the graph populated, analysis is a query away — and in LinkedDataHub, queries, charts and views are resources like everything else. A chart is three resources chained together: an sp:Select query holding the SPARQL text, an ldh:ResultSetChart describing how to plot its results, and an ldh:Object block placing it on a document.

A revenue chart

The Categories container carries a revenue-per-category chart. Its query joins order items to products to categories across their documents. Note that ?orderItem schema:price is already the discounted line total (the demo's order details mapping computed it per line), so the query sums it directly.

Run a query in the SPARQL editor; the chart pane below the results lets you pick the chart type, the category and one or more series. Click Save underneath the chart pane: two creation forms store the query and the chart as documents. Place the chart anywhere by adding an Object block whose value is the saved chart's URI.

A view

Views render query results as document listings instead of plots — the container's own children listing is one.

A view is placed the same way a chart is: an Object block whose value is the view's URI. The Object block form walks through it.

What you now see

The Categories container is a small dashboard: a revenue bar chart and a grid of the categories themselves — all live views over the graph, recomputed on each request.

The Categories container with charts and grid view

How this works

  • Charts — the query–chart–block chain and the chart vocabulary
  • Views — layout modes, projected variables and faceted search

Next: Composition