Skip to content

Querying

While some of the property definition in the example may have felt a bit verbose (we’ll get into more patterns later to help manage the redundancy), but it starts to pay off by the expressiveness from being able to query all the information in your workspace.

First, let’s update the workspace config file to tell Knowboard we want to enable the SPARQL server:

.knowboard.toml
# ...
exclude = [".git/**"]
[sparql_server]
listen = "auto" # or specific port like "17878"

Knowboard provides a simple web-based SPARQL UI.

In VSCode the UI can be opened using the Command Pallete:

Cmd+Shift+P (Mac)
Ctrl+Shift+P (Windows)
> Knowboard: Open SPARQL UI

Knowboard also provides a Code Lens in the .knowboard.toml config to open a browser to the UI:

Screenshot of knowboard config file with "Open SPARQL UI"

Or if you have a specific port defined, you can navigate directly to it in the browser, such as http://localhost:17878.

Knowboard can also be used with a variety of standard SPARQL clients

In SPARQL the basic “show me everything” query looks like this:

SELECT * WHERE { ?subject ?predicate ?object } LIMIT 3

This should return a selection of the information we’ve defined in the workspace like:

subjectpredicateobject
tag:me@example.com,2026:my-workspace/authors/jane-austenhttp://schema.org/nameJane Austen
tag:me@example.com,2026:my-workspace/authors/jane-austenhttp://www.w3.org/1999/02/22-rdf-syntax-ns#typehttp://schema.org/Person
tag:me@example.com,2026:my-workspace/authors/f-scott-fitzgeraldhttp://schema.org/nameF. Scott Fitzgerald

To get something more insightful, SPARQL enables us to query the structure and connections between different items, such as associating book titles with the author’s name:

query.rq
PREFIX schema: <http://schema.org/>
SELECT ?bookName ?authorName WHERE {
?book a schema:Book ;
schema:name ?bookName ;
schema:author ?author .
?author schema:name ?authorName .
}
bookNameauthorName
The Great GatsbyF. Scott Fitzgerald
Pride and PrejudiceJane Austen

See the references for additional SPARQL resources.