Skip to content

sq

sq accepts an endpoint URL for a one-off command:

Command

sq -e http://127.0.0.1:7737/ graphs

Configure a project

Place .sq.toml in the project directory. sq also finds it in parent directories, so the configuration applies throughout a repository.

.sq.toml sq.toml

default = "sparqld"

[endpoints.sparqld]
url = "http://127.0.0.1:7737/"

[prefixes]
data = "sparqld:"
schema = "https://schema.org/"

The default value selects the endpoint when -e is omitted. data abbreviates the sparqld: graph names generated from source paths. The project-specific schema value matches the HTTPS IRIs in the example data.

These commands now use the configured endpoint:

sq graphs
sq any
sq -f docs/queries/names.rq

Use configured prefixes

sq injects configured prefixes together with its built-in prefix set before sending a query. This query uses both project-specific prefixes:

Source sq-named-graph.rq

SELECT ?name
WHERE {
  GRAPH data:index.md {
    ?subject schema:name ?name .
  }
}

Command

sq -f docs/queries/sq-named-graph.rq

Add -v to a command, as in sq -v graphs, to see the selected endpoint and expanded query. Use sq endpoints to list configured endpoints.