Chapter 3. SPARQL Queries: A Deeper Dive
Chapter 1 gave you your first taste of writing and running SPARQL queries. In this chapter, we’ll dig into more powerful features of the SPARQL query language:
- More Readable Query Results
URIs are important for identifying and linking things, but when it’s time to display query results in an application, users want to see information they can read, not something that looks like a bunch of web addresses.
- Data That Might Not Be There
In Chapter 1, we started learning how to request data that matches certain patterns. When you can ask for data that may or may not match certain patterns, it makes your queries more flexible, which is especially useful when exploring data you’re unfamiliar with.
- Finding Data That Doesn’t Meet Certain Conditions
Much of SPARQL is about retrieving data that fits certain patterns. What if you want the data that doesn’t fit a particular pattern—for example, to clean it up?
- Searching Further in the Data
SPARQL offers some simple ways to ask for a set of triples and additional triples that may be connected to them.
- Eliminating Redundant Output
If you’re looking for triples that fit some pattern, and a SPARQL query engine finds multiple instances of certain values, it will show you all of them—unless you tell it not to.
- Combining Different Search Conditions
SPARQL lets you ask, in one query, for data that fits certain patterns and other data that fits other patterns; you can also ask for data that meets either of two sets of patterns. ...