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
PDF
Page 5
4th paragraph

On either a Widows or Linux-based system Should be 'Windows'.

Note from the Author or Editor:
This has already been identified fixed for the second edition.

James Graves  Jun 28, 2013 
Other Digital Version
96
Example #170

The example for federated query (Example ex170.rq) no longer works because the endpoint has changed! The correct query now appears to be "# filename: ex170.rq PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX gp: <http://wifo5-04.informatik.uni-mannheim.de/gutendata/resource/people/> SELECT ?p ?o WHERE { SERVICE <http://wifo5-04.informatik.uni-mannheim.de/gutendata/sparql> { SELECT ?p ?o WHERE { gp:Hocking_Joseph ?p ?o . } } } " (only the prefix has changed).

Note from the Author or Editor:
Make change as noted (just tested). fixed 2013-04-06

Gary King  Mar 04, 2013 
ePub
Page 63
middle - this is example 78

SPARQL 1.1's property path semantics has changed. The answer to example 78 was correct but is no longer. The correct answer has duplicates removed and should be ----------- | s | =========== | :paperE | | :paperG | | :paperI | | :paperF | | :paperD | | :paperH | | :paperC | | :paperB | ----------- HTH

Note from the Author or Editor:
I have verified that the latest version of ARQ reflects this change to the spec and will adjust the example output accordingly in the expanded edition. fixed 2013-04-06

Gary King  Dec 10, 2012 
Printed
Page 24
Top

RDF = Resource Description Framework NOT Resource Description Format as referred to on page 24 and several other places in this book. See: http://www.w3.org/RDF/

Note from the Author or Editor:
I have fixed this in the my source for the book's next edition. fixed 2013-04-06

Anonymous  Jul 04, 2012 
Printed
Page 133

The book states that "a quoted value is a string whether you specifically designate it xsd:string or not" and therefore asserts that select ?s where {?s ?p "two" .} returns the same results as select ?s where {?s ?p "two"^^xsd:string .} However, this does not appear to be true in the current version of Jena/Fuseki that I tried it on - these two queries actually return different results: the first query above returns: d:item2a and the second query returns: d:item2b (According to a posting on the Jena users forum, the RDF spec may change in the future to consider both forms of the string to be the same, however, this is not currently the case.) Within a FILTER(), however, both forms of the string (with or without the ^^xsd:string) are the same, so: SELECT ?s WHERE { ?s ?p ?foo FILTER (?foo = "two"^^xsd:string) . } will return two results, regardless of whether ^^xsd:string is present: d:item2a d:item2b

Note from the Author or Editor:
The Fuseki software that she used and the ARQ software that the book uses come from the same Jena code base, but they are inconsistent in how they handle these examples, so I will follow up with the Jena mailing list to see what the story is.

Elli Schwarz  Apr 26, 2012 
Printed
Page 5
United Kingdom

The book suggests installing ARQ in order to try out the SPARQL examples from a command line. Unfortunately it seems that ARQ is no longer enough to provide this functionality at it is now necessary to install the full version of Jena which includes ARQ. This is described in more detail on the Jena users forum here http://mail-archives.apache.org/mod_mbox/incubator-jena-users/201204.mbox/%3C001201cd16b7$31bae2d0$9530a870$@on.net%3E

Note from the Author or Editor:
In ARQ's transition to an Apache project, its packaging changed, and I am revising the instructions to take this into account for the expanded edition of the book.

Rob Walpole  Apr 15, 2012 
Printed
Page 131
Example ex034.ttl

The triple: d:item342 dm:invoiced: true . should instead be d:item342 dm:invoiced: false . if ex034.ttl (as stated in the line preceding example ex034.ttl) it is to have the same meaning as ex033.ttl or ex035.rdf, where the value of the object for the dm:invoiced predicate is false.

Note from the Author or Editor:
Correction of error that mgh128 noted on page 31 will also fix this, because it's the same sample file being reused elsewhere in the book. fixed 2013-04-07

mgh128  Feb 15, 2012 
Printed
Page p39
last line of text before example ex046.ttl

the last two words of the question should say Cindy Marshall - not Cndy Marshall (typo)

Note from the Author or Editor:
I will make the change. fixed 2013-04-07

mgh128  Feb 14, 2012 
Printed
Page 31
2nd line

The 2nd line should read: d:item342 dm:invoiced false . if ex033.ttl, ex034.ttl amnd ox035.rdf all store the same triples (as is claimed in the last sentence of this section about 'Data Typing', before the next section on 'Making RDF More Readable with Language Tags and Labels') The other two examples ex033.ttl and ex035.rdf both show the object to be false (not true) for the predicate dm:invoiced

Note from the Author or Editor:
I will change ex034.ttl example to have the second line say false instead of true. fixed 2013-04-07

mgh128  Feb 14, 2012 
Other Digital Version
58
query 067.rq

The query reads PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?first ?last WHERE { ?s ab:firstName ?first . ?s ab:lastName ?last . NOT EXISTS { ?s ab:workTel ?workNum } } but (unlike MINUS) NOT EXISTS should only be in a FILTER expression. I.e., the correct query is PREFIX ab: <http://learningsparql.com/ns/addressbook#> SELECT ?first ?last WHERE { ?s ab:firstName ?first . ?s ab:lastName ?last . FILTER NOT EXISTS { ?s ab:workTel ?workNum } } (FWIW, the first version does not pass the SPARQL validator at http://www.sparql.org/query-validator.html). thanks, HTH

Note from the Author or Editor:
I see that 17.4.1.4 refers to EXISTS as a FILTER operator, so I will change the example to use the FILTER keyword. fixed 2013-04-07

Gary King  Feb 07, 2012 
Other Digital Version
167
answer table

The encode_for_uri function should actually leave the full-stops (the periods) alone so that the answer should be ---------------------------------------------------------------------- | encodeTest | ====================================================================== | "http%3A%2F%2Fwww.learnsparql.com%2Fcgi%2Ffunc1%26color%3Dred" | | "My%20String" | ----------------------------------------------------------------------

Note from the Author or Editor:
What the book shows is the ARQ output, and it looks like ARQ has been changed since then to leave the full stops alone. I will replace the sample output with a new version. fixed 2013-04-07

Gary King  Feb 03, 2012 
Other Digital Version
134
middle

The book says that single quotes can be used for Turtle strings (and the example turtle file uses them). According to the spec at http://www.w3.org/TeamSubmission/turtle/, however, only double quotes are allowed. I wish they were allowed. It would make sense and fit in better with SPARQL. I know that rapper is okay with single-quotes but not all parsers accept them. HTH

Note from the Author or Editor:
OK, between sections 2.1 and 10 of the Turtle spec I see that single quotes are allowed in SPARQL but not Turtle, at least not in the spec's current form. I will fix the book to reflect this. fixed 2013-04-07 update 4/8: that was an older draft of the Turtle spec. Latest one does allow single quotes to delimit strings: http://www.w3.org/2010/01/Turtle/#prod-turtle2-STRING_LITERAL1

Gary King  Feb 03, 2012 
Other Digital Version
152
answer output fr query ex257.rq

There are some conversion errors in the answers given: * boolean true converts to 1 * float converts to int and decimal (unless it's too big or Inf, -Inf or NaN). I believe the correct table would be: ---------------------------------------------------------------------------------------- | o | integerTest | decimalTest | floatTest | doubleTest | ======================================================================================== | 3 | 3 | "3"^^xsd:decimal | "3"^^xsd:float | "3"^^xsd:double | | _:b0 | | | | | | "5 bucks" | | | | | | 4 | 4 | "4"^^xsd:decimal | "4"^^xsd:float | "4"^^xsd:double | | dbr:Montréal | | | | | | true | 1 | 1.0 | 1.0E0 | 1.0E0 | | 1.0e5 | 100000 | 100000.0 | "1.0e5"^^xsd:float | 1.0e5 | ----------------------------------------------------------------------------------------

Note from the Author or Editor:
I have learned that this is a bug in ARQ that has been fixed for the next release, 2.9, so I will redo the example with that release when it is available. fixed 2013-04-07

Gary King  Feb 03, 2012 
Other Digital Version
153
answer table

Any non-zero and non-NaN number should convert to "true"^^xsd:boolean (cf. http://www.w3.org/TR/xpath-functions/#casting-boolean). So the output of the table should be ----------------------------------------------------------------------------------------- | o | stringTest | booleanTest | ========================================================================================= | 3 | "3"^^xsd:string | true | | "true" | "true"^^xsd:string | true | | "2011-11-14T14:30:00"^^xsd:dateTime | "2011-11-14T14:30:00"^^xsd:string | | | _:b0 | | | | "5 bucks" | "5 bucks"^^xsd:string | | | "2011-11-12" | "2011-11-12"^^xsd:string | | | 4 | "4"^^xsd:string | true | | "True" | "True"^^xsd:string | | | true | "true"^^xsd:string | true | | "2011-11-13T14:30:00" | "2011-11-13T14:30:00"^^xsd:string | | | 1.0e5 | "1.0e5"^^xsd:string | true | -----------------------------------------------------------------------------------------

Note from the Author or Editor:
I have learned that this is a bug in ARQ that has been fixed for the next release, 2.9, so I will redo the example with that release when it is available. fixed 2013-04-07

Gary King  Feb 03, 2012 
PDF
Page 9
First para "Let's say ..."

"ab:i8301" should be "d:i8301"

Note from the Author or Editor:
I will make the change; I have the most recent version from svn. fixed 2013-04-07

John Turnbull  Feb 01, 2012 
Printed, PDF
Page 49
lines 2-3

The name of the German language in German is "Deutsch", not "Deutsche". See: http://en.wikipedia.org/wiki/Deutsch

Note from the Author or Editor:
Remove "e". fixed 2013-04-07 (earlier, actually)

Michael Lenahan  Sep 25, 2011  Oct 21, 2011
Printed
Page 20
2nd paragraph

"for sharing data over the web... for use" should be "for sharing data... over the web for use" fixed 2013-04-07 (actually, earlier, but confirmed 4/7)

Bob DuCharme
Bob DuCharme
O'Reilly Author 
Sep 13, 2011  Oct 21, 2011
Printed
Page 202
1st paragraph

1st sentence of this paragraph reads "...triples that have the same subject and object but "cinco" as an object." should be "...triples that have the same subject and predicate but "cinco" as an object."

Note from the Author or Editor:
Make change as described by error report. Confirmed fixed 2013-04-07

Anonymous  Aug 31, 2011  Oct 21, 2011
PDF
Page 114
First paragraph

"they're a a great way" "a" is duplicated.

Note from the Author or Editor:
Remove one "a ". confirmed fixed 2013-04-07

Joćo Paulo Menezes  Aug 25, 2011  Oct 21, 2011
PDF
Page 95
First paragraph

"In the following version of the the.." "the" is duplicated.

Note from the Author or Editor:
Remove one of the "the " from sentence. confirmed fixed 2013-04-07

Joćo Paulo Menezes  Aug 25, 2011  Oct 21, 2011
PDF
Page 83
At the end of the paragraph that is above ex132.ttl

"triplestore in the named graphhttp://"... There is a space missing between the word "graph" and the url starting with "http://..."

Note from the Author or Editor:
Add a space. Confirmed fixed 2013-04-07

Joćo Paulo Menezes  Aug 25, 2011  Oct 21, 2011
Printed
Page 199
Bear Trap point

In the Bear Trap point on this page it states "When you use the USING keyword don't use the WITH keyword" The subsequent pages then go on to show examples doing exactly that and discuss the effect of it in a somewhat disjointed and inconsistent way. For example page 201 goes on to say "the USING keyword in a DELETE update request overrides whatever a WITH clause says about a graph to delete from" which is in fact incorrect. The SPARQL 1.1 Update specification goes into detail on this but my general understanding is as follows: - WITH sets the graph to be used in any place in the update request where a graph is not explicitly specified by a GRAPH clause - USING and USING NAMED sets the graph(s) to be used for the WHERE clause only, again the WHERE clause may use explicit GRAPH clauses which will override these

Note from the Author or Editor:
Revise examples to not use USING with WITH, revise descriptions around them, have Rob review. (The bear trap paragraph was in response to a reviewer comment about my first use of these together, and I didn't notice that the examples following that made the same mistake.) fixed 2013-04-07

Rob Vesse  Aug 17, 2011 
Printed
Page 96
ex167.rq Example

In ex167.rq and subsequent examples that use SERVICE the author writes a full SELECT query inside each SERVICE clause which is unecessary. Anything inside a SERVICE clause is packaged up as a SELECT * WHERE { } query so the effect of writing this may be to send a sub-query to the remote service (depending on whether the SPARQL processor does any special optimisation/handling for this case) which will not be supported when talking to SPARQL 1.0 only endpoints. It would be simpler to write like so: SERVICE { <http://dbpedia.org/resource/Joseph_Hocking> ?p ?o . }

Note from the Author or Editor:
Remove inner SELECT * WHERE {} from ex167.rq and subsequent examples that do this; review descriptions of them. fixed 2013-04-07

Rob Vesse  Aug 17, 2011 
Printed
Page 58
ex067.rq Example

NOT EXISTS is used directly in the query when the SPARQL 1.1 specification states that NOT EXISTS can only be used as a FILTER i.e. should be FILTER(NOT EXISTS { ?s ab:workTel ?workNum }) instead

Note from the Author or Editor:
Revise example to use NOT EXISTS within a FILTER; review description around it; check any other usage of NOT EXISTS for the same issue. fixed 2013-04-07

Rob Vesse  Aug 17, 2011 
Printed
Page 31
ex035.rdf Example

In ex035.rdf the RDF/XML example uses QNames directly within the rdf:datatype attribute which is not permissible, these should be full URIs. This is particularly an issue because the QNames as written are effectively valid URIs themselves because they follow the scheme:hostname style URI convention. This means that an RDF parser presented with the data will generate literals treating "xsd:integer" as the datatype when "http://www.w3.org/2001/XMLSchema#integer" is what is intended.

Note from the Author or Editor:
Replace qnames with full URIs in rdf:datatype attribute values in example file ex035.rdf. fixed fixed 2013-04-07

Rob Vesse  Aug 17, 2011 
Printed, PDF
Page 131
Second bullet in bulleted list

"In RDF/XML, it’s stored in an rdf:type attribute." should say rdf:datatype confirmed fixed 2013-04-07

Bob DuCharme
Bob DuCharme
O'Reilly Author 
Aug 17, 2011  Oct 21, 2011
Printed, PDF
Page 22
5th paragraph

uses the plural 'knows' when it should be singular "It would knows that it meant..."

Note from the Author or Editor:
Lose the extra "s" confirmed fixed 2013-04-07

Anonymous  Aug 05, 2011  Oct 21, 2011
Printed, PDF, Other Digital Version
Page 41
5th paragraph

The word "out" has been written twice in the phrase "RDFS and OWL let you spell out out a list of terms..." the error is located at page 41 of the pdf version, and it's present also in both the mobi and the epub version

Note from the Author or Editor:
Remove one instance of "out" in that sentence. confirmed fixed 2013-04-07

Andrea Bagnacani  Jul 24, 2011  Oct 21, 2011