About Thing 5
Purpose: SPARQL is a query language and protocol for working with RDF (Resource Description Framework) data. It allows humans and applications to send and answer complex queries.
Learning Outcomes: Users will familiarize themselves with the basic elements of a simple SPARQL query and learn why SPARQL is important in a linked data context. Additionally, users can apply the ‘concept’ to see an example of how MARC could be queried using SPARQL.
Intended Audience: Beginner
Prerequisites: Thing 2. RDF and URIs
Author: Hsianghui Liu-Spencer, Carleton College
Expected Duration: 45-60 minutes
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
Getting Started
SPARQL stands for SPARQL Protocol and RDF Query Language. It was first introduced in 2008 as a World Wide Web Consortium (W3C) standard and since 2013 W3C has had stable releases. SPARQL is used to query data and manipulate RDF graph content on the web or from an RDF triple store.
Activities
- Watch "SPARQL in 11 minutes" (11:13)
- Read Section 2 (Making Simple Queries) and Section 2.1 (Writing a Simple Query) of the W3C's SPARQL 1.1 Query Language document
This next activity may be useful for staff who work with MARC records.
- Watch the recording “How MARC can SPARQL” from the LD4 2022 Linked Data Conference
At about 11 minutes in, review the slides that show a SPARQL query for MARC field 310, subfield a (current publication frequency) and the results. After converting MARC into RDF, Kirk Hess at OCLC queried MARC tag 310 $a from series records to see the most popular frequency for a serial. The highest frequency is “Annual” and what follows is a record count and the other frequency categories. A data element, once stored in RDF, could be manipulated for quality control projects. For example, potentially, you could pull a list to conduct a cleanup of records.
Reflection
How can SPARQL query "structured data" such as a list of phone numbers, directories, or MARC tags? Do you have other data sets at your work that might be candidates to query with SPARQL?
Additional Resources
- “Making Simple Queries.” SPARQL 1.1 Query Language. 2013, https://www.w3.org/TR/sparql11-query/#basicpatterns
- UCLA Library. “SPARQL.” Research Guides, 21 July 2022, https://guides.library.ucla.edu/semantic-web/SPARQL
Claim Credit
Need a certificate of completion? Answer the questions below, submit them, and you’ll receive an email confirmation with a link to download your certificate.
How can SPARQL query "structured data" such as a list of phone numbers, directories, or MARC tags? By treating them as objects in the triple graph vernacular sense.
Do you have other data sets at your work that might be candidates to query with SPARQL? Yes, circulating Toys and puzzles (pieces, in-house vs. circ stats, etc.); In-house produced streaming videos (MARC data, event data, participant data, and so on)
How can SPARQL query "structured data" such as a list of phone numbers, directories, or MARC tags? Do you have other data sets at your work that might be candidates to query with SPARQL?