Errata

Learning SPARQL

Errata for Learning SPARQL

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page 85
screenshot/the query

Figure 3-2 results are of songs, not of albums. It looks like the query does not define albums in any way. "?albums" can be anything, as far as I can say. At least judging from the results, such as "Back in the Day (Missy Elliot song)".

This album/producer query has been problematic from the start. Quite complex to introduce at the beginning of the book and, as you can see, it's not clear to me whether it is logically sound. I'd suggest "parsing" it--introducing sections of it first, so that it's clear what are the results of "is producer of", and only after that adding complexity. Also, I've been trying to wrap my mind around the metadata used there and how to find what works. For example, "album" is both property and class. The book should perhaps explain what this is and why this is so at this point. At least briefly. Perhaps a simpler example would work here better. Thank you.

Note from the Author or Editor:
Yes, it does list songs instead of albums, so that should be corrected. Other errata have pointed out that the query needs revision anyway because the data model of the queried data has changed, so I will take these suggestions into account when revising it.

Martina Podsklanova  Aug 09, 2023 
Page Page 33
5th paragraph of the page, 3nd paragraph of the "Blank Nodes" section

In the second line of the second paragraph of the "Blank Nodes and Why They're Useful" section, the sentence reads "First, we have of a set of triples with no blank nodes, ...".

Remove "of" after "we have".

Note from the Author or Editor:
Yes, remove the extraneous "of."

Sina Ahmadi  Jun 20, 2023 
Page 285, 286, 288
ex361.py (p.285), ex363.py (p.286), ex364.cgi (p.288)

In the scripts ex361.py (p.285), ex363.py (p.286), ex364.cgi (p.288)
replace:

"www[dot]data[dot]linkedmdb[dot]org/sparql"
with
"www[dot]triplydb[dot]com/Triply/linkedmdb/sparql/linkedmdb"
"<www[dot]data[dot]linkedmdb[dot]org/resource/movie/>"
with
""<www[dot]triplydb[dot]com/Triply/linkedmdb/vocab/>""

Also, for Python 3, add parentheses in the print and except statements.

Note from the Author or Editor:
Will do.

Ariel  Aug 10, 2022 
Page Page 284
top of page -- first paragraph

The script ex358.py (p. 284) (in addition to replacing the old predicate) also can be modified for Python 3 as follows:

replace import urllib2 with: import urllib
replace urllib2.quote(query) with: urllib.parse.quote(query)
replace urllib2.Request(requestURL) with: urllib.request.Request(requestURL)
replace urllib2.urlopen(request) with: urllib.request.urlopen(request)
replace print result.read() with: print (result.read())

Note from the Author or Editor:
Existing script uses python 2 and suggested changes are for python 3. Will do.

Elio Giulianelli  Aug 07, 2022 
Page 331
rows 5 and 7

replace "some subproperty of" with "some subclass of"

Note from the Author or Editor:
Change as described.

Elio Giulianelli  Jul 23, 2022 
Page 164
Bottom

In ex269.rq (and in Figure 5-1) replace :Ducati with :Ducati_Motor_Holding and replace /ontology/locationCity with /property/locationCity

Note from the Author or Editor:
The data in dbpedia about Ducati has changed so the reader's suggestion correctly adjusts the query to get the current appropriate data.

Elio Giulianelli  Jul 13, 2022 
Page 52
Top

In ex049.rq replace musicalArtist with artist

Note from the Author or Editor:
The schema of the data being queried has been changed and the reader correctly pointed out that the query needs to be adjusted to reflect that change.

Elio Giulianelli  Jul 07, 2022 
Page 50
Bottom

In ex048.rq replace musicalArtist with artist

Note from the Author or Editor:
The schema of the data being queried has been changed and the reader correctly pointed out that the query needs to be adjusted to reflect that change.

Elio Giulianelli  Jul 07, 2022 
Page 15
bottom

In ex025.rq replace musicalArtist with artist

Note from the Author or Editor:
The schema of the data being queried has changed, so the query needs to be adjusted as Elio points out.

Elio Giulianelli  Jul 07, 2022 
Page 1
Querying a Public Data Source section

The Timbaland example in Chapter 1 (Figure 1-3; ex025.rq) uses the DBpedia Ontology property type of "musicalArtist". The query does not return results.

Replacing "musicalArtist" with the property type of "artist" returns results:

SELECT ?album ?artist WHERE {
?album d:producer :Timbaland .
?album d:artist ?artist .
}

Note from the Author or Editor:
Update as shown. https://dbpedia.org/ontology/musicalArtist is still in the DBpedia ontology, but I guess they're phasing it out. (Examples like this will probably use Wikipedia instead of DBpedia anyway in any future versions of the book.)

zstumgoren  Mar 04, 2021 
Printed
Page 284
top of page -- first paragraph

The query in ex358.py (p. 284) uses an outdated predicate:

The query predicate in current dbpedia.org semantic web concept organization needs to be:
'dbpedia.org/ontology/birthDate'
instead of the older:
'dbpedia.org/property/dateOfBirth'

Note from the Author or Editor:
Update example as described and retest it. Maybe even revise it to pull data from Wikidata instead of dbpedia.

Gene Gragg  Sep 15, 2020 
PDF
Page 170
examples

Hello,

In ex282.rq and ex281.ttl, the rdfs:type property is used while :type does not belong to RDFS but to the RDF ontology.

Thank you,

Note from the Author or Editor:
Change rdfs:type to rdf:type in the 4 places where it occurs on page 163.

Anonymous  Jul 21, 2020 
Printed
Page 75
Tip

"These example used" should likely be "this example" or "these examples."

Note from the Author or Editor:
How embarrassing! I will change it to "these examples" in the next edition because it comes after two examples that use the UNION keyword.

Jeff Tyzzer  Jun 08, 2020 
Printed
Page 11
Last paragraph

The paragraph makes reference to 'ab:firstName' and 'ab:lastName', but both the listing and the download example file ex019.rq use 'a:' as the prefix.

Note from the Author or Editor:
Good eye! I will change the prefix used in example ex019.rq to be ab: for consistency with the text describing it and the examples leading up to it.

Anonymous  May 12, 2020 
PDF
Page 6
1st paragraph

The paragraph states that one can run ex007.rq without specifying the ex002.ttl file. However, with Apache Jena 3.13.1-1 on Archlinux, I get the following error:

[heumos@wave LearningSPARQLExamples]$ arq --query ex007.rq
Exception
java.lang.NullPointerException
at org.apache.jena.query.QueryExecutionFactory.make(QueryExecutionFactory.java:615)
at org.apache.jena.query.QueryExecutionFactory.create(QueryExecutionFactory.java:94)
at arq.query.lambda$queryExec$0(query.java:224)
at org.apache.jena.system.Txn.exec(Txn.java:77)
at org.apache.jena.system.Txn.executeRead(Txn.java:115)
at arq.query.queryExec(query.java:222)
at arq.query.exec(query.java:153)
at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
at arq.arq.main(arq.java:28)

I suspect this might not be the book's fault, but the one of arq. But I don't know for sure.

Note from the Author or Editor:
I reproduced the error with Jena 3.13.1 after getting it to run fine with 3.10.0 and will report the problem to the Jena mailing list.

The example does need revision. In https://lists.apache.org/list.html?users@jena.apache.org see Andy Seaborne's 2019/11/30 22:20:58 response in the thread with a subject of "arq bug?"

Simon Heumos  Nov 28, 2019 
Printed
Page 75
Last paragraph

The statement "let's say we say we have some data" is redundant, probably the author meant to write "let's say we have some data".

Note from the Author or Editor:
remove "we say"

Carlos Bustamante  Aug 16, 2017 
Printed
Page 103
Remote queries not working on arq

Queries ex 166.rq (pg 103), ex167.rq, ex539.rq, ex170.rq, ex178.rq, ex180.rq and others do not work on arq. Error has "ImplException: 4/UNWISE_CHARACTER in PATH etc..

Please could you suggest what the problem could be, thanks!

Note from the Author or Editor:
(Basically, all queries that reference remote data need to be retested with the latest version of arq. Here is what I will send:)

ex166.rq and ex539.rq: I think there's been a change to Jena (the library behind arq) so that it doesn't do remote retrieval like that any more.

this worked; note that it doesn't actually use ex536.ttl, but like the warning notice on page 103 says, arq expects you to list some data file on the command line. See that warning message for more details.

arq --query ex167.rq --data ex536.ttl

ex170: the following command just now shows that that server happens to be down, which may have been the case when you tried it:

curl http://wifo5-04.informatik.uni-mannheim.de/gutendata/sparql

ex178 looks for data from the same server.

ex180: arq seems to treat named graphs differently now, offering a new command line option for identifying them. This worked for me:

arq --query ex180.rq --namedGraph=ex122.ttl

For the "ImplException: 4/UNWISE_CHARACTER in PATH etc..<p>" error message, could you email me at bob@snee.com with the files you used, the command line you used, and tell me the version of arq that you used?


Anonymous  Jun 17, 2016 
Printed
Page 130
13th line from the bottom

ex209.rq does not provide the same results for the third problem as ex207.rq. The variable used for items was changed in the code from "?item" to "?prob44item", but in the OPTIONAL clause, the ?item variable was not changed. The result is that d:item432 is returned as an instance of dm:prob44, as displayed on p. 131, even though this item had in fact been approved by a Supervisor at Job Grade 5. Change "?item" to "?prob44item" in the third UNION, and the correct results are returned.

Note from the Author or Editor:
Mark is correct about the problem and the proposed solution.

Anonymous  Apr 24, 2016 
Printed
Page 259
example ex417

The two files that have photographer values should have extensions of jpg, not mp3.

Bob DuCharme  Feb 19, 2015 
PDF
Page 9
3rd line

instead of "ab:i8301" it should be "d:i8301" and also same thing is used in subsequent lines.

Note from the Author or Editor:
This is in the three paragraphs of descriptive text following example ex013.rq. The report is correct.

Saagar Takhi  Jan 31, 2015 
Printed
Page 81
United States

FROM does not quite say "add the triples from the following graph to the default dataset" because when you use FROM, the query engine does not look at the default dataset. http://www.w3.org/TR/sparql11-query/#specifyingDataset shows that it's a " merge of the graphs referred to in the FROM clauses."

Bob DuCharme  Aug 24, 2014 
Printed
Page 137
United States

In the RDF/XML example, the rdf:about value should say ns/data#item342 instead of ns/demo#item342.

Note from the Author or Editor:
Submitted myself, will fix.

Bob DuCharme  Jul 22, 2014 
Printed
Page 50 & 264
United States

There are two different ex047.rq examples, so one of them should be renamed along with references to it.

Bob DuCharme
Bob DuCharme
 
Jun 11, 2014 
Printed
Page 70
bottom of page 70

rdfs:label should not be in the result of running ex092.rq with ex069.ttl.

Note from the Author or Editor:
Run it again and substitute the correct output.

Bob DuCharme  Apr 27, 2014 
Printed
Page 181
bottom

Because Python has been updated with some backward-incompatible parts, the example at the bottom of this page does not work with the latest release of Python and should be updated.

Note from the Author or Editor:
update script

Bob DuCharme  Apr 19, 2014