Learning SPARQL

Querying and Updating with SPARQL 1.1

Learning SPARQL cover

Buy Now at Amazon

The W3C standard query language SPARQL is letting people access a growing collection of public and private data. Whether this data is part of a semantic web project or a combination of data from two relational databases on different platforms, SPARQL is making it easier to access this data using both open source and commercial software.

"Learning SPARQL" teaches you how to use SPARQL 1.1 by starting you off with simple queries that demonstrate the language's query-by-example approach and then taking you through all the key features of the SPARQL 1.1 query and update languages.


Jul 21: Blog entry SPARQLing anything MS Office files, XML, markdown, plain text, and more.

Jun 23: Blog entry Querying for audio on Wikidata Music and more.

May 26: Blog entry Use SPARQL to query for movies, then watch them On YouTube and more.

Apr 21: Blog entry SPARQL queries of the Billboard Hot 100 Current and historical data!

Mar 25: Blog entry Visualizing RDF I see nodes and edges...

Feb 25: Blog entry Using regular expressions to manipulate data in a SPARQL query A pure, standards-compliant SPARQL query.

Jan 21: Blog entry Appreciating the SPARQL property path slash character more Querying for labels and more.


Dec 17: Blog entry Triples about existing triples The easy way and the hard way.

Nov 19: Blog entry Querying for labels The normal way and the wikibase:label service way.

Oct 29: Blog entry Human-readable names in RDF Sometimes simple, sometimes not.

Aug 18: Blog entry Nicer date and time handling in SPARQL 1.2 Add, subtract, and ADJUST() dates and times.

Jul 23: Blog entry Passing your own data to use in Wikidata visualizations A VALUES-based approach.

Jun 25: Blog entry Entity recognition from within a SPARQL query (using my new employer's excellent free product).

May 20: Blog entry Getting ChatGPT to turn a flat vocabulary list into a hierarchical taxonomy ChatGPT-3, Chat GPT-4.

Apr 30: Blog entry Introducing RDF and related standards The series.

Mar 26: Blog entry Normalizing company names (and more) with SPARQL and Wikidata As a service!

Feb 26: Blog entry Using the AWS Graph Explorer with Fuseki and local datasets An open source visual graph navigator.

Jan 22: Blog entry SPARQL and OWL on the command line—of my phone! Termux and rdflib on my Android phone.


Dec 18: Blog entry Web3 and Web 3.0 at OriginTrail An interview with CTO and co-founder Branimir Rakić

Nov 20: Blog entry SPARQL queries of git repository data If we're going to think of git data as a graph...

Oct 23: Blog entry Your own free, publicly available SPARQL endpoint (free as in tier)

Sep 25: Blog entry More Picasso paintings in one year than all the Vermeer paintings? Answering an art history question SPARQL.

Aug 28: Blog entry Learn RDF in Y minutes

Jul 31: Blog entry SPARQL and Instacart's Knowledge Graph Managing data quality.

Jun 19: Blog entry Generating websites with SPARQL and Snowman, part 2 building further on @Rhizome's excellent ArtBase SPARQL endpoint

May 22: Blog entry Generating websites with SPARQL and Snowman, part 1 with @Rhizome's excellent ArtBase SPARQL endpoint

Apr 30: Queries to explore a dataset Even a schemaless one.

Feb 27: Blog entry Taking some RDF beyond what it could do in a relational database Part 2 of 2.

Jan 30: Blog entry Converting Digital Humanities paper and conference metadata to RDF How and why.


Dec 31: Blog entry 17 years of my web bookmarks, with metadata Featuring "75 Bleeding-Edge Search Engines To Beat Google", and more!

Oct 25: Blog entry My command line OWL processor With most of the credit going to to Ivan Herman.

Oct 17: Blog entry You probably don't need OWL And if you do there's a simple way to prove it.

Sep 19: Blog entry Taxonomy management with SKOS Republishing an IBM developer works article.

Aug 20: Blog entry What else can I do with RDFS? Schemas can be a little fancier and even more useful with no need for OWL.

Jul 27: A "Data management for historians" course at Radboud University in the Netherlands includes "Learning SPARQL" as required reading.

Jul 25: Blog entry What is RDFS? And how much can a simple schema do for you?

Jun 27: Blog entry What is RDF? What can this simple standardized model do for you?

May 23: Blog entry Calling your own JavaScript functions from SPARQL queries More Jena arq fun!

Apr 25: Blog entry Hidden gems included with Jena’s command line utilities Lots of ways to manipulate your RDF from the open-source multiplatform tool kit

Mar 28: Blog entry Pulling Turtle RDF triples from the Google Knowledge Graph Even querying by type!

Feb 28: Blog entry Linking different knowledge graphs together Really linking them, not doing ETL.

Jan 24: An excellent compromise between schemas and "schemaless" development. An excellent compromise between schemas and "schemaless" development.


Dec 20: Blog entry Knowledge Graphs! Semantic Linked Knowledge Web Data Graphs?

Nov 22: Blog entry Using SPARQL to combine Wikidata and OSM triples Linking that data!

Oct 25: New blog entry GeoSPARQL queries on OSM Data in GraphDB Or, Querying geospatial data with SPARQL Part 2.

September 27: New blog entry Using SPARQL do to quick and dirty joins of CSV data Or data with other delimiters.

July 19: New blog entry The HTML interface to your SPARQL endpoint is not your SPARQL endpoint: Remember what the 'P' in 'SPARQL' stands for.

June 21: New blog entry Converting CSV to RDF with Tarql: Quick and easy and, if you like, streaming.

May 31: New blog entry SPARQL in a Jupyter Notebook: for real this time.

May 13: In a new Synaptica blog entry titled (Information about) Books about Information, Bob Kasenchak writes "Another standard reference, DuCharme’s Learning SPARQL is pretty definitively the go-to book for getting started with the eponymous RDF query language."

Apr 26: New blog entry Living in a materialized world Managing inferenced triples with SPARQL namespaces.

Mar 29: New blog entry Querying Wikidata for data that you just entered yourself after about four minutes.

Feb 23: New blog entry Populating a Schema.org dataset from Wikidata (Rock and Roll!) Spoiler alert: it's a CONSTRUCT query.

Jan 19: New blog entry One-click replacement of an IMDb page with the corresponding Wikipedia page (with some Python, JavaScript, and of course, SPARQL).


Nov 17: New blog entry Avoiding accidental cross products in SPARQL queries -- because one can sneak into your query when you didn't want it.

Sep 22: New blog entry Converting JSON to RDF -- any JSON at all.

Aug 25: New blog entry Custom HTML form front end, SPARQL endpoint back end.

Jul 13: A Korean translation of Learning SPARQL is now available!

Jun 30: New blog entry Querying geospatial data with SPARQL: Part 1..

May 12: New blog entry Converting JSON-LD schema.org RDF to other vocabularies.

Apr 21: New blog entry Exploring JSON-LD (And of course, querying it with SPARQL).

Feb 24: New blog entry curling SPARQL.

Jan 20 2019: New blog entry Querying machine learning distributional semantics with SPARQL.


Dec 23: New blog entry Playing with wdtaxonomy.

Nov 18: New blog entry Extracting RDF data models from Wikidata.

Oct 28: New blog entry SPARQL full-text Wikipedia searching and Wikidata subclass inferencing.

Aug 27: New blog entry Pipelining SPARQL queries in memory with the rdflib Python library.

Jul 22: New blog entry Dividing and conquering SPARQL endpoint retrieval -- with the VALUES keyword.

Jul 17: New review of Learning SPARQL on goodreads.com.

Apr 22: New blog entry Reification is a red herring—and you don't need property graphs to assign data to individual relationships.

Jan 28: New blog entry JavaScript SPARQL with rdfstore-js.


Dec 31: new blog entry SPARQL and Amazon Web Service's Neptune database

Nov 19: new blog entry SPARQL queries of Beatles recording sessions: Who played what when?

Nov 12: According to a recent tweet, there is apparently a copy of Learning SPARQL in the Microsoft Redmond Library!

Oct 25: sparql.club continues to accumulate entries about big name institutions seeking SPARQL talent.

Jun 25: recent blog entries Instead of writing SPARQL queries for Wikipedia--query for them! and Creating Wide CSV files with SPARQL.

Apr 23: The Wikidata data model and your SPARQL queries

Mar 26: recent blog entries Getting to know Wikidata and Wikidata's excellent sample SPARQL queries.

Jan 22: Brand-name companies advertising for SPARQL talent on indeed.com: the sparql.club!


June 16: Google Scholar shows 99 citations to Learning SPARQL.

May 14: Once again, inspired by yet another silly claim that "No one in industry is using SPARQL," I recently pointed someone at a list of very well-known companies who have listed SPARQL under "skills" in job listings: NBC, Microsoft, Boeing, Goldman Sachs, Vodafone, Turner Broadcasting, and many more. Follow @LearningSPARQL on Twitter for occasional news about big-name organizations looking for people who know SPARQL. (Nine days ago: Northrup Grumman.)


July 28: MarkLogic recommends "Learning SPARQL."

May 5: Sample data and queries used in the SPARQL in 11 minutes video: sparqlIn11Minutes.zip.

May 3: New video SPARQL in 11 minutes provides a brief introduction to RDF and SPARQL.

SPARQL in 11 minutes


October 7: New blog post Dropping OPTIONAL blocks from SPARQL CONSTRUCT queries shows how to use CONSTRUCT queries without OPTIONAL clauses to retrieve remote triples much, much faster.

May 30: review of "Learning SPARQL" by Ian Hopkinson at ScraperWiki.

March 25: review of "Learning SPARQL" in "I Programmer."

January 16: added a new section to the website running examples with TopBraid Composer.


December 17: Learning SPARQL is featured under "Book Watch" in I Programmer.

August 1: semanticweb.com interview about the second edition:A Look Into Learning SPARQL With Author Bob DuCharme

July 17: Second edition now available on Amazon and iTunes:

July 16: The second edition of Learning SPARQL is now available from O'Reilly in all formats!

June 25: An "early access" electronic version of the second edition is available on O'Reilly's website, and all editions of the the finished, edited version of it will be ready in a week or two.

June 2: A new, expanded edition of "Learning SPARQL" is on the way!


December 18: According to the BestBuy.com's Announcing BBYOpen Metis Alpha: Best Buy Product Catalog via Semantic Endpoints, "the Metis Alpha gives developers the ability to consume and query structured data via SPARQL (get up to speed with Learning SPARQL by Bob DuCharme), enabling the discovery of insight hidden deep inside the product catalog."

October 21: Only just now found David Witherspoon's review of "Learning SPARQL" from last November.

September 21: "Learning SPARQL" on the shelf at Blackwell's flagship store in Oxford, UK (founded 1879):

Blackwell's bookshelf

May 21: New review of "Learning SPARQL" by Julien Plu. (In French; scroll down a bit after following link.)


November 20: Read Liam Green-Hughes' review of "Learning SPARQL."

October 13: John Erickson (@olyerickson) has based the label for his new batch of homebrew on the cover of "Learning SPARQL":

September 28: I've only just learned that you can buy the book through iTunes so that you can read it on an iPad, iPhone, and iPad touch.

September 15: Read Dave McComb's review on semanticarts.com.

September 1: Read the "Free Yor Data" blog's review of the book.

August 8: "Learning SPARQL" is now available for the Kindle.

August 6: Read Shawn Day's review of "Learning SPARQL."

July 26: The ebook and print editions of "Learning SPARQL" are now available from O'Reilly, and print editions are available from amazon.com, amazon.co.uk, maybe some more Amazons, and Barnes and Noble. (Borders says that it's on backorder, but I wouldn't hold your breath for that.)

July 15: The ebook version of "Learning SPARQL" is now available on the O'Reilly page! The print edition is scheduled to be available July 19th. Subscribe to the @LearningSPARQL twitter feed to stay updated on the book and on other SPARQL news.