Correcting some outdated "Learning SPARQL" examples
Revising some queries to accommodate revised data.
O’Reilly books such as Learning SPARQL have an errata page where anyone can submit corrections for the book, and I appreciate all entries. Some are just basic typo misspellings, which is embarrassing. Some are examples that no longer work because a certain SPARQL endpoint is no longer up or, in several cases, because DBpedia entries got revised to describe resources using different properties than they did when the book was published.
For example, page 50 of the book’s second edition showed this example, which no long works at DBpedia’s SNORQL interface to the site’s SPARQL endpoint.
# filename: ex048.rq
# See update in ex048a.rq.
PREFIX d: <http://dbpedia.org/ontology/>
SELECT ?artistName ?albumName
WHERE
{
?album d:producer :Timbaland .
?album d:musicalArtist ?artist .
?album rdfs:label ?albumName .
?artist rdfs:label ?artistName .
}
The http://dbpedia.org/ontology/musicalArtist property still exists, but DBpedia no longer uses it to describe Timbaland. Also, I shouldn’t have assumed that everything he produced was an album; some are singles, so I adjusted a variable name as well. The following now works in SNORQL:
# filename: ex048a.rq - 2025-07-23 update of ex048.rq
PREFIX d: <http://dbpedia.org/ontology/>
SELECT ?artistName ?musicalWork
WHERE
{
?album d:producer :Timbaland .
?album d:artist ?artist .
?album rdfs:label ?musicalWork .
?artist rdfs:label ?artistName .
}
The comments at the top of the two queries above describe the relationship of the original and revised versions. As the readme.txt file that I included with the examples says, “A file whose name has the form exNNNa.rq is a 2025 update of the file exNNN.rq from the book’s second edition examples.”
I have done this for five examples so far and and will be going through my notes and the submitted errata to create more corrected versions to make available on the learningsparql.com examples page. You should see more exNNNa.rq files showing up on that page over the next few months.
Comments? Reply to my Mastodon or Bluesky posts announcing this blog entry.

Share this post