Data sources
SPARQL endpoints, Turtle and other RDF files, Solid pods with login, and link traversal. The queries run in the browser with Oxigraph (WASM) or Comunica.
Web Components that show linked data.
Query SPARQL endpoints, RDF files and Solid pods. Make charts from the results with a grammar of graphics. Connect tables, charts and process maps. Do all of this in HTML.
SLC is a set of custom elements. One element tells where the data is. One element contains the SPARQL query. Other elements show the result. The library fetches the data, runs the query in the browser and updates each view. If you can write HTML, you can make a linked-data page without a framework.
SPARQL endpoints, Turtle and other RDF files, Solid pods with login, and link traversal. The queries run in the browser with Oxigraph (WASM) or Comunica.
Tables, bar, line, area, scatter, pie, heatmap and box-plot charts, maps, timelines, sankey charts, process maps and KPI cards. Each view is an HTML element with some attributes.
<slc-chart> makes a chart from marks, encodings, scales and
transforms. The same specification is also available as JSON, YAML and RDF. Thus you
can keep charts in a pod.
Named selections connect the elements. Click a bar, select a range or push a filter
button: each view with filter-from shows the same selection. A selection
can also be a query parameter.
Process maps with coverage sliders, variants, performance spectra, conformance to a target model, and case timelines. The input is an event log in RDF.
One set of --slc-* design tokens sets the style of all elements, in
light mode and dark mode. You can operate all controls with the keyboard. On touch
screens, the controls are 44 px high.
The packages are not on npm. Download the tarballs from the GitHub releases. Or clone the repository and run the demos on your computer (Node.js 22).
npm install ./sparql-web-component-2.1.0.tgz
import "sparql-web-component/browser";
<bar-chart data-json='{"vars":["fruit","n"],"bindings":[…]}'
x-axis="fruit" y-axis="n"></bar-chart>
git clone https://github.com/dorschre/06-semantic-linked-components-for-a-solid-dataspace.git
cd 06-semantic-linked-components-for-a-solid-dataspace
npm install
npm run dev # then open http://localhost:5173/
All examples below are live. Read the code. Then select Edit, change the code and select Run (or push Ctrl + Enter). The data is a synthetic purchase-to-pay log in Turtle. The log comes with this page, thus all examples work offline.
Each view uses SPARQL results: a list of variables and one binding for each row. Put
the results in the data-json attribute. Then give the names of the fields
to show.
A query element fetches RDF and runs SPARQL in the browser. In this example,
<wasm-query> loads a Turtle file into Oxigraph. The chart refers to
the query with source-id. The chart draws again when new results come in.
To query a SPARQL endpoint, replace resources with endpoint.
Many views can show the same results. A table can sort, filter and export the rows. A pie chart shows the parts of a total. The views only draw the data, and the query runs one time.
<slc-chart> makes a chart from parts: a mark, encodings, scales and
transforms. An encoding connects a field to a channel. Change type="bar"
to point or line, or add a color encoding.
Controls write a named selection. Views with filter-from use that
selection. The buttons select a vendor. The slider selects a range of throughput times.
The table shows the cases that agree with both selections.
An event log has one row for each event: a case, an activity and a time. A process map shows how the cases move between activities. Use the sliders to hide rare steps. Click an activity to see where its cases come from and where they go.
<slc-document> declares a full pipeline: sources, datasets, queries
and views. A SPARQL CONSTRUCT with parameters can make a dataset. A slider
can set a parameter. When you release the slider, the dataset makes the graph again.
In this example, the graph keeps only the cases that are longer than the number of days
that you select.
Each element is also data. In the gallery and on the demo pages, a switch above each example shows the element in different forms. The forms are its HTML, its IR (JSON) and the IR as RDF (Turtle). You can keep the RDF in a pod and load it again. Try it on this chart:
Elements read --slc-* custom properties. Set them on a parent element. The
data colours have names for their roles (--slc-data-primary,
-positive, -negative, …). If you change the palette, each
colour keeps its meaning.
A dashboard answers some frequent questions on one screen: What is the status? What changed? Where must I look more carefully? An SLC dashboard uses the same HTML as above, in a clear layout. Queries fetch the data, and key figures and charts show it. Filters and parameters let the reader decrease the data, and notes tell where it comes from.
| To… | Use | Step |
|---|---|---|
| show a key number with a target or trend | <slc-kpi-card>, <slc-kpi-meter> | 1 |
| put widgets in tiers, groups and columns | <slc-grid>, <slc-panel> | 2 |
| explain a view, show a reference, give the source | heading, caption, <slc-annotation>, <slc-note>, <slc-source-note> | 3 |
| click a chart to filter the other views | select-name + filter-from, <slc-quick-filter> | 4 |
| show details only after a selection | <slc-selection-detail>, <slc-list> | 5 |
| let the reader run queries again with other values | <slc-param-select>, <slc-query-parameter> | 6 |
| put views in tabs and keep the state in the URL | <slc-tabs>, <slc-url-state> | 7 |
These steps make a purchase-to-pay dashboard. They use the same synthetic log as the tutorial. You can edit and run each example. Step 7 puts all of them together.
An aggregate query gives one row. Each card shows one field of that row. Give each
number a reference. target sets the goal. good-direction="down"
tells that a lower value is better. The thresholds of the meter make it
red, amber or green.
<slc-grid layout="stratified"> puts the widgets in order from
overview to detail. Use tier="top" for small key figures,
"middle" for charts and "bottom" for details at full width.
<slc-panel> puts related items in a group with a heading.
collapsible and max-height limit the height of long
content. On screens narrower than 720 px, the grid has one column.
Readers trust a number when they know its context. heading and
caption give a title and a description to a view.
<slc-annotation> draws a reference line, and info adds
an ⓘ hint to a card. <slc-note> gives the definition of a term.
<slc-source-note> tells where the data comes from and when the page
received it. Its refresh button runs the query again.
Click a bar. The chart writes the vendor into the selection d4-vendor
(select-name, select-field). The table has this selection in
filter-from, thus it shows only the orders of that vendor. The status
buttons write a second selection. filter-combine="intersection" keeps the
rows that agree with both selections. Filters use rows that are already loaded, thus
the result shows immediately.
A dashboard is easier to read when it shows details only on request. Select a row. The
table writes the order into d5-order, and the list shows the events of
that order. <slc-selection-detail> shows the detail panel only
while an order is selected.
A filter hides rows that are loaded, but a parameter changes the query.
<slc-param-select> writes the parameter d6Vendor. Each
query with a related <slc-query-parameter> runs again, with the
value in ?vendor. Thus the key figures show the values of one vendor.
"All" makes the parameter empty, and the query has no limit. Use parameters when the
data is too large to load at one time, or when the aggregates must change.
This is the full dashboard. It has a vendor parameter at the top, key figures, an
overview in tabs, details on request and the source at the bottom.
<slc-tabs> writes the visible tab into the parameter
dashView. <slc-url-state> keeps both parameters in the
address bar. Select a vendor and a tab. Then load the page again or share the link: the
dashboard opens with the same vendor and tab.
Open "All orders" and select a row.
<slc-url-state>.<solid-auth> login. Do not copy it.
The design patterns come from Bach et al., Dashboard Design Patterns (IEEE VIS
2022). In the repository, docs/patterns/ shows the elements for each
pattern.
This section shows each view live, with synthetic data. Select Edit on a card to change the element in one of its three forms: HTML, IR (the element description in JSON) or RDF (Turtle). When you change the form, the editor converts your changes. Run shows the result. Each card also opens the style gallery. It shows the same element in light, dark and a custom theme.