Publishing dataset descriptions with a SPARQL CONSTRUCT query
If you already publish linked data, you don’t need a separate file for your dataset description: the NDE Dataset Register can read it straight from your triplestore with a SPARQL CONSTRUCT query.
The NDE Dataset Register requires you to register the location of your dataset description(s) via a so-called registration URL. Looking at the registrations we have today, they take one of three routes:
- A simple RDF file. Write the description as a JSON-LD or Turtle file, put it online and register its URL. A file in a GitHub repository is enough; about a hundred registrations work this way.
- Output from your collection management system. About 2,200 registrations, the large majority, are generated by the platform that holds the collection and served through content negotiation, as our requirements for Dataset Register implementations ask. Nothing to maintain by hand.
- Your own SPARQL endpoint. If you already publish linked data in a SPARQL endpoint, store the description there too and register a
SPARQL CONSTRUCTURL. This is still rare, and the rest of this post shows how it works.
Suppose you have stored all triples for your dataset descriptions, distributions, and possibly a data catalog in the graph <http://data.bibliotheken.nl/datasetbeschrijvingen>, which is available in your linked data publishing environment with the SPARQL endpoint http://api.bibliotheken.nl/datasets/KB/Production/sparql. The query to retrieve all dataset description triples from your triplestore in this example is:
CONSTRUCT {
?s ?p ?o .
} WHERE {
GRAPH <http://data.bibliotheken.nl/datasetbeschrijvingen> {
?s ?p ?o .
}
}
After URL-encoding this SPARQL CONSTRUCT query, you can include it as a query parameter to the SPARQL endpoint. This results in the following URL:
http://api.bibliotheken.nl/datasets/KB/Production/sparql?query=CONSTRUCT%20%7B%20?s%20?p%20?o%20.%20%7D%20WHERE%20%7B%20GRAPH%20%3Chttp://data.bibliotheken.nl/datasetbeschrijvingen%3E%20%7B%20?s%20?p%20?o%20.%20%7D%20%7D
This is a registration URL that can be submitted to the NDE Dataset Register!
Register the URL of the SPARQL protocol endpoint, i.e. the one that answers ?query=… requests with RDF, not the URL of a SPARQL query editor or web interface.
A query web UI (such as a YASGUI page) returns an HTML page instead of RDF, so the Register cannot read any dataset descriptions from it. A common mistake is to copy the URL straight from your browser’s address bar while you are looking at the query editor.
The Register re-reads every registration URL about once a day. With a SPARQL CONSTRUCT URL that means it picks up whatever is in your triplestore at that moment: there is no second copy of the description to keep in sync.
If you already run a public SPARQL endpoint, this is the route we recommend. The description lives next to the data it describes, you edit it with the same tools, and the Register sees the change the next day. Do serve the endpoint from a domain your organisation controls, as KB does with api.bibliotheken.nl, rather than from your supplier’s domain. Then a move to another supplier changes nothing for the Register, and the domain can go on the Register’s allow list for your organisation alone.
In the NDE Dataset Register, at the bottom of a dataset description page, you will find the so-called registration information, including the registration URL. For example, on the Thesaurus of Dutch Author Names (NTA) page in the dataset register, you can see exactly this SPARQL CONSTRUCT registration URL.