O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning SPARQL

Book Description

Get hands-on experience with SPARQL, the RDF query language that's become a key component of the semantic web. With this concise book, you will learn how to use the latest version of this W3C standard to retrieve and manipulate the increasing amount of public and private data available via SPARQL endpoints. Several open source and commercial tools already support SPARQL, and this introduction gets you started right away.

Begin with how to write and run simple SPARQL 1.1 queries, then dive into the language's powerful features and capabilities for manipulating the data you retrieve. Learn what you need to know to add to, update, and delete data in RDF datasets, and give web applications access to this data.

  • Understand SPARQL’s connection with RDF, the semantic web, and related specifications
  • Query and combine data from local and remote sources
  • Copy, convert, and create new RDF data
  • Learn how datatype metadata, standardized functions, and extension functions contribute to your queries
  • Incorporate SPARQL queries into web-based applications

Table of Contents

  1. Dedication
  2. Preface
    1. Why Learn SPARQL?
    2. Organization of This Book
    3. Conventions Used in This Book
    4. Documentation Conventions
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
  3. 1. Jumping Right In: Some Data and Some Queries
    1. The Data to Query
    2. Querying the Data
    3. More Realistic Data and Matching on Multiple Triples
    4. Searching for Strings
    5. What Could Go Wrong?
    6. Querying a Public Data Source
    7. Summary
  4. 2. The Semantic Web, RDF, and Linked Data (and SPARQL)
    1. What Exactly Is the “Semantic Web”?
    2. URLs, URIs, IRIs, and Namespaces
    3. The Resource Description Format (RDF)
      1. Storing RDF in Files
      2. Storing RDF in Databases
      3. Data Typing
      4. Making RDF More Readable with Language Tags and Labels
      5. Blank Nodes and Why They’re Useful
      6. Named Graphs
    4. Reusing and Creating Vocabularies: RDF Schema and OWL
    5. Linked Data
    6. SPARQL’s Past, Present, and Future
    7. The SPARQL Specifications
    8. Summary
  5. 3. SPARQL Queries: A Deeper Dive
    1. More Readable Query Results
      1. Using the Labels Provided by DBpedia
      2. Getting Labels from Schemas and Ontologies
    2. Data That Might Not Be There
    3. Finding Data That Doesn’t Meet Certain Conditions
    4. Searching Further in the Data
    5. Searching with Blank Nodes
    6. Eliminating Redundant Output
    7. Combining Different Search Conditions
    8. FILTERing Data Based on Conditions
    9. Retrieving a Specific Number of Results
    10. Querying Named Graphs
    11. Queries in Your Queries
    12. Combining Values and Assigning Values to Variables
    13. Sorting, Aggregating, Finding the Biggest and Smallest and...
      1. Sorting Data
      2. Finding the Smallest, the Biggest, the Count, the Average...
      3. Grouping Data and Finding Aggregate Values within Groups
    14. Querying a Remote SPARQL Service
    15. Federated Queries: Searching Multiple Datasets with One Query
    16. Summary
  6. 4. Copying, Creating, and Converting Data (and Finding Bad Data)
    1. Query Forms: SELECT, DESCRIBE, ASK, and CONSTRUCT
    2. Copying Data
    3. Creating New Data
    4. Converting Data
    5. Finding Bad Data
      1. Defining Rules with SPARQL
      2. Generating Data About Broken Rules
      3. Using Existing SPARQL Rules Vocabularies
    6. Asking for a Description of a Resource
    7. Summary
  7. 5. Datatypes and Functions
    1. Datatypes and Queries
      1. Representing Strings
      2. Comparing Values and Doing Arithmetic
    2. Functions
      1. Program Logic Functions
      2. Node Type and Datatype Checking Functions
      3. Node Type Conversion Functions
      4. Datatype Conversion
      5. Checking, Adding, and Removing Spoken Language Tags
      6. String Functions
      7. Numeric Functions
      8. Date and Time Functions
      9. Hash Functions
    3. Extension Functions
    4. Summary
  8. 6. Updating Data with SPARQL
    1. Getting Started with Fuseki
    2. Adding Data to a Dataset
    3. Deleting Data
    4. Changing Existing Data
    5. Named Graphs
      1. Dropping Graphs
      2. Named Graph Syntax Shortcuts: WITH and USING
      3. Deleting and Replacing Triples in Named Graphs
    6. Summary
  9. 7. Building Applications with SPARQL: A Brief Tour
    1. SPARQL and Web Application Development
    2. SPARQL Query Results XML Format
    3. SPARQL Processors
      1. Standalone Processors
      2. Triplestore SPARQL Support
      3. Middleware SPARQL Support
      4. Public Endpoints, Private Endpoints
    4. Summary
  10. Glossary
  11. Index
  12. About the Author
  13. Colophon
  14. Copyright