Cover image for Learning SPARQL

Book description

More and more people are using the query language SPARQL (pronounced "sparkle") to pull data from a growing collection of public and private data. Whether this data is part of a semantic web project or an integration of two inventory databases on different platforms behind the same firewall, SPARQL is making it easier to access this data using both open source and commercial software. In the words of W3C Director and web inventor Tim Berners-Lee, "Trying to use the Semantic Web without SPARQL is like trying to use a relational database without SQL. SPARQL lets them query information from databases and other diverse sources in the wild, across the Web."

Table of Contents

  1. Dedication
  2. Special Upgrade Offer
  3. 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
  4. 1. Jumping Right In: Some Data and
    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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. Glossary
  12. Index
  13. About the Author
  14. Colophon
  15. Special Upgrade Offer
  16. Copyright