Author: Bob DuCharme
SPARQL is a technology that’s more important than you may realize, making this book equally important.
Tim Berners-Lee, inventor of the Web and director of W3C, says:
“Trying to use the Semantic Web without SPARQL is like trying to use a relational database without SQL”.
The semantic web, of course, is the W3C backed concept that the current web should be converted from unstructured documents to a ‘web of data’. The concept is closely allied to that of the Resource Description Framework (RDF). RDF is a set of W3C specifications that started life as a metadata model, and has moved on to become a general method of modeling web data.
So if SPARQL is going to be a major language for working with web data, learning it is a good idea, which is where this book comes in. This is very much a book for developers, heavy on code and examples. DuCharme starts with a chapter titled ‘Jumping Right In’, where he introduces you to a sample data file in Turtle RDF format, then moves on to how you’d query the file. He then introduces more realistic data and queries, all before page 10!
Having got you started and shown the practical use of SPARQL, the next chapter does look at what exactly the Semantic Web, RDF and SPARQL is all about. From then onwards, though, the chapters are back to SPARQL, starting with a more in-depth look at how to form SPARQL queries, adding filters, combining search conditions, querying named graphs, sorting and aggregating.
By Chapter 4 we’re on to copying, creating and converting data, including how to identify any bad data. The way SPARQL lets you deal with data that doesn’t conform to rules is interesting and given the quality of much of the information on the Web, is probably among its more useful options!
Using datatypes and functions in queries is the subject of the next chapter; essentially SPARQL 1.1 has many new functions for working with numeric values, dates and times, and strings. Update functions get a chapter of their own, including working with named graphs. There’s a good chapter on query efficiency and debugging, and another useful chapter on working with SPARQL query result functions using results in XML, JSON, CSV and TSV formats.
Chapter 9 looks at RDF schema, OWL (the Web Ontology Language), and inferencing. RDFS and OWL let you define and describe classes and properties that a dataset’s triples (identifier, property name, value) might use, and inferencing is the act of working out new triples from existing triples. DuCharme describes the process nice and clearly with minimal jargon. Next comes a chapter on building applications with SPARQL that introduces you to various SPARQL processors and shows how to use SPARQL from HTTP. This chapter was more of an introduction than an in-depth how-to, but at least points you in the right direction. The book closes with a SPARQL cookbook, essentially a set of problems and solutions showing the answers to questions such as ‘How do I treat a URL as a String?’, and ‘How do I Globally Replace a Property Value?’
This is a good book for developers who know how to program, ideally know SQL, and who want to find out about SPARQL. It has plenty of well-constructed examples, and should get you well on the way to being able to use SPARQL in your apps.