Query a release
Ask your own SPARQL SELECT or ASK questions of one exact release, on its Query page or with erden query.
The examples use https://registry.example as an illustrative test origin. Use https://registry.erden.sh for the hosted service.
Who needs this, and when
Who: anyone who wants answers from an ontology rather than its files: readers, authors checking a release, and
scripts. When: any time after a release is published. Status: optional. The Erden team turns release queries
on; when they are off, a release has no Query link and erden query exits with CLI_QUERY_UNSUPPORTED.
A release query runs over one exact release: its declared statements plus what the reasoner inferred. A plain query
sees the declared statements; the inferred ones sit in their own graph, urn:erden:release-query:v1:graph:inferred,
which the Superclasses with inferred example shows how to read. The answer names the exact release, dataset, and
query by their digests, so anyone can tell precisely what was asked of what.
Best for trying questions out. Open a release, click Query, write a query, and press Run query.
On the Query page
Open the Query page
On a release page, click Query in the row of section links.
Write or pick a query
Click one of the ready-made examples above the text box (Classes, Properties, Superclasses with inferred, Labels, Count by type, Any deprecated term), or type your own. For example, every class and its superclass:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?class ?superclass WHERE {
?class rdfs:subClassOf ?superclass .
}Run it
Press Run query. Download JSON gives the same answer as a file.
What you should see
2 rows · page 1 of 1 and a table with the columns ?class and ?superclass.
With erden query
Save the query in a file
The CLI never takes query text on the command line, so your shell can't mangle it. Save the query above as q.rq:
$ cat q.rq
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?class ?superclass WHERE {
?class rdfs:subClassOf ?superclass .
}Run it
erden query @demo/erden-demo@0.2.0-beta.1 --file q.rq --registry https://registry.exampleWhat you should see:
?class | ?superclass
<https://example.invalid/erden/demo#PublishedArtifact> | <https://example.invalid/erden/demo#Artifact>
<https://example.invalid/erden/demo#ReviewedArtifact> | <https://example.invalid/erden/demo#PublishedArtifact>
2 rows
Release https://example.invalid/erden/demo@0.2.0-beta.1 archive df387e9ce098cc8d57ff1b69f9a8e753e491ae309a7d5ccd917f910a66972740 dataset d9fdbd17fe34860beaeee66441a4e9dc52c2f1dd2fd3f5d22494a7d40f4d16c0 query a56e7978faa1890da7198fdb4792606e3e7b5c47b7ca9bcea00c2ce19b26e985 result 465ae75eaf567cb538c175297802b0e21864843d56e0bcc6a94cbfe333eb9881The last line is the receipt: the digests of the release archive, the dataset queried, your query, and the result.
Get machine-readable output
--jsonprints the full result with its binding: the release, dataset, engine, reasoning profile, and toolchain.--sparql-jsonprints standard SPARQL 1.1 JSON results.--stdinreads the query from standard input instead of a file.
What queries can do
| Allowed | Not supported |
|---|---|
SELECT and ASK | CONSTRUCT, DESCRIBE, and updates |
| The release's declared and inferred statements | SERVICE (other endpoints), FROM, and anything on the network |
| Filters, optional patterns, ordering, and counting | Blank nodes in queries, subqueries, and unbounded property paths |
| Up to 8,192 bytes of query text | More than 1,000 rows, 10 seconds, or 4 MiB of results |
If it looks different
The answer says the dataset is unavailable
Queries use data captured when a release is published. Releases published before the registry started capturing it cannot be queried.
The query is refused
It uses something from the right-hand column of the table above, or it is longer than 8,192 bytes. The message names the reason.
erden query cannot find a private layer
Sign the CLI in with an account that can read the layer: see Connect the CLI.