SPARQL Protocol And RDF Query Language

Similar documents
SPARQL Protocol And RDF Query Language

Semantic Web Information Management

SPARQL QUERY LANGUAGE WEB:

Querying the Semantic Web

Using RDF to Model the Structure and Process of Systems

Semantic Web Fundamentals

Semantic Web Technologies: Assignment 1. Axel Polleres Siemens AG Österreich

infoh509 xml & web technologies lecture 9: sparql Stijn Vansummeren February 14, 2017

SPARQL: An RDF Query Language

Day 2. RISIS Linked Data Course

Revisiting Blank Nodes in RDF to Avoid the Semantic Mismatch with SPARQL

Semantic Web and Linked Data

Multi-agent Semantic Web Systems: RDF Models

Semantic Web Fundamentals

SPARQL. Dr Nicholas Gibbins

From the Web to the Semantic Web: RDF and RDF Schema

DBPedia (dbpedia.org)

DBpedia-An Advancement Towards Content Extraction From Wikipedia

MI-PDB, MIE-PDB: Advanced Database Systems

Linked Data Evolving the Web into a Global Data Space

Semantic Web Systems Querying Jacques Fleuriot School of Informatics

Chapter 3 Querying RDF stores with SPARQL

ITARC Stockholm Olle Olsson World Wide Web Consortium (W3C) Swedish Institute of Computer Science (SICS)

ITARC Stockholm Olle Olsson World Wide Web Consortium (W3C) Swedish Institute of Computer Science (SICS)

Multi-agent and Semantic Web Systems: Querying

Proposal for Implementing Linked Open Data on Libraries Catalogue

A General Approach to Query the Web of Data

a paradigm for the Introduction to Semantic Web Semantic Web Angelica Lo Duca IIT-CNR Linked Open Data:

Reminder: RDF triples

SPARQL. Fausto Giunchiglia and Mattia Fumagallli. University of Trento

Interacting with Linked Data Part I: General Introduction

Linking Distributed Data across the Web

Library of Congress BIBFRAME Pilot. NOTSL Fall Meeting October 30, 2015

Logical reconstruction of RDF and ontology languages

XML Perspectives on RDF Querying: Towards integrated Access to Data and Metadata on the Web

Exploring and Using the Semantic Web

CHAPTER 1 INTRODUCTION

Orchestrating Music Queries via the Semantic Web

Semantic Web and Natural Language Processing

Semantic Web and Python Concepts to Application development

3. Queries Applied Artificial Intelligence Prof. Dr. Bernhard Humm Faculty of Computer Science Hochschule Darmstadt University of Applied Sciences

Finding Similarity and Comparability from Merged Hetero Data of the Semantic Web by Using Graph Pattern Matching

Improved Processing of Path Query on RDF Data Using Suffix Array

COMPUTER AND INFORMATION SCIENCE JENA DB. Group Abhishek Kumar Harshvardhan Singh Abhisek Mohanty Suhas Tumkur Chandrashekhara

Unit 1 a Bird s Eye View on RDF(S), OWL & SPARQL

Library Technology Conference, March 20, 2014 St. Paul, MN

RDF AND SPARQL. Part IV: Syntax of SPARQL. Dresden, August Sebastian Rudolph ICCL Summer School

Introduction. October 5, Petr Křemen Introduction October 5, / 31

Querying RDF & RDFS. Several query languages exist to retrieve

a paradigm for the Semantic Web Linked Data Angelica Lo Duca IIT-CNR Linked Open Data:

Querying Description Logics

Introduction to Linked Data

The Data Web and Linked Data.

COMP6217 Social Networking Technologies Web evolution and the Social Semantic Web. Dr Thanassis Tiropanis

On Measuring the Lattice of Commonalities Among Several Linked Datasets

Ontological Modeling: Part 2

Linking Spatial Data from the Web

The P2 Registry

Outline. Introduction Semantic Web

The Linking Open Data Project Bootstrapping the Web of Data

Introduction to Semantic Web Databases. Version 1 Prepared By: Amgad Madkour Ph.D. Candidate Purdue University April 2018

Semantic Days 2011 Tutorial Semantic Web Technologies

Semantic Adaptation Approach for Adaptive Web-Based Systems

The Semantic Web Revisited. Nigel Shadbolt Tim Berners-Lee Wendy Hall

Programming Technologies for Web Resource Mining

BUILDING THE SEMANTIC WEB

Linked Open Data: a short introduction

COMP9321 Web Application Engineering

SEMANTIC WEB 07 SPARQL TUTORIAL BY EXAMPLE: DBPEDIA IMRAN IHSAN ASSISTANT PROFESSOR, AIR UNIVERSITY, ISLAMABAD

COMP9321 Web Application Engineering

2. Knowledge Representation Applied Artificial Intelligence

SPARQL Optimization Using Heuristi Approach

Implementing and extending SPARQL queries over DLVHEX

University of Rome Tor Vergata DBpedia Manuel Fiorelli

On Querying Ontologies with Contextual Logic Programming

SPARQL ME-E4300 Semantic Web,

Semantic Web Technologies

Linked Data: What Now? Maine Library Association 2017

Chapter 16 Linked Data, Ontologies, and DBpedia

Keyword Search over RDF Graphs. Elisa Menendez

Semantic Web Knowledge Representation in the Web Context. CS 431 March 24, 2008 Carl Lagoze Cornell University

Semantic Web Systems Linked Open Data Jacques Fleuriot School of Informatics

Contents. G52IWS: The Semantic Web. The Semantic Web. Semantic web elements. Semantic Web technologies. Semantic Web Services

Representing Linked Data as Virtual File Systems

KNOWLEDGE GRAPHS. Lecture 11: Cypher / Knowledge Graph Quality. TU Dresden, 8th Jan Markus Krötzsch Knowledge-Based Systems

SPARQL เอกสารหล ก ใน มคอ.3

Event Stores (I) [Source: DB-Engines.com, accessed on August 28, 2016]

Semantic Cloud Generation based on Linked Data for Efficient Semantic Annotation

Profiles Research Networking Software API Guide

Knowledge Representation in Social Context. CS227 Spring 2011

Foundations of SPARQL Query Optimization

The Implementation of Semantic Web Technology in Traditional Plant Medicine

The Semantic Web DEFINITIONS & APPLICATIONS

THE GETTY VOCABULARIES TECHNICAL UPDATE

Linked Open Europeana: Semantic Leveraging of European Cultural Heritage

Ivan Herman. F2F Meeting of the W3C Business Group on Oil, Gas, and Chemicals Houston, February 13, 2012

KNOWLEDGE GRAPHS. Lecture 4: Introduction to SPARQL. TU Dresden, 6th Nov Markus Krötzsch Knowledge-Based Systems

Semantic Web. Querying on the Web: XQuery, RDQL, SparQL. Morteza Amini. Sharif University of Technology Fall 94-95

Querying Semantic Web Data

DBpedia Extracting structured data from Wikipedia

Transcription:

SPARQL Protocol And RDF Query Language WS 2011/12: XML Technologies John Julian Carstens Department of Computer Science Communication Systems Group Christian-Albrechts-Universität zu Kiel March 1, 2012 1 John Julian Carstens SPARQL Protocol And RDF Query Language

Overview 1 Introduction 2 Linked Open Data 3 RDF 4 SPARQL 5 Usage and Examples 6 Conclusion 2 John Julian Carstens SPARQL Protocol And RDF Query Language

Overview 1 Introduction 2 Linked Open Data 3 RDF 4 SPARQL 5 Usage and Examples 6 Conclusion 3 John Julian Carstens SPARQL Protocol And RDF Query Language

Motivation Web is largely made for people, not machines Importance of machine-to-machine communication shown by wide use of web services Information retrieval is very difficult for a machine if data is unstructured When data is structured, a language for querying the data for certain information is necessary 4 John Julian Carstens SPARQL Protocol And RDF Query Language

How to use Structured Data? 1. Example, Semantic phone voice control: "Call my girlfriend!" 1. Query: "x = FIND girlfriend OF user"; 2. Query: "FIND phone_no OF x" 2. Example, Information retrieval, e.g. from Wikipedia: "Show me the people born in Kiel in 1950!" Query: "FIND people WHERE place_of_birth = "Kiel" AND year_of_birth = 1950" 5 John Julian Carstens SPARQL Protocol And RDF Query Language

Goals Collect information about everything Combine and connect information to see hidden or unobvious relations Standardizing information storage and the way to access them Many more... 6 John Julian Carstens SPARQL Protocol And RDF Query Language

Overview 1 Introduction 2 Linked Open Data 3 RDF 4 SPARQL 5 Usage and Examples 6 Conclusion 7 John Julian Carstens SPARQL Protocol And RDF Query Language

What is Semantic Web? "New" concept for further developing the world wide web Problem: Web-media like HTML-pages, videos, songs etc. are designed for human consumption Solution: Connect resources with information, so that a machine can process it Especially information about resources metadata Advantages for several use cases: consumers, scientists, health, search engines etc. 8 John Julian Carstens SPARQL Protocol And RDF Query Language

What is Semantic Web? 2009-12-01 Date Mustang Model Image Content Car Construction year 1972 File Type PNG Manufacturer... Ford Figure: Human view 1 Figure: Machine view 1 Image by http://www.bilder1.com/ford-mustang-bilder-concept 9 John Julian Carstens SPARQL Protocol And RDF Query Language

Linked Open Data Basic idea for machine readable web: Connect resources to give them meaning Linked Data On the web, readable by everyone Linked Open Data Thus, we need: 1 Language for connecting data and resources 2 Language for retrieving information from Linked Data 10 John Julian Carstens SPARQL Protocol And RDF Query Language

Introduction Linked Open Data RDF SPARQL Usage and Examples Linked Open Data Cloud Image by Anja Jentzsch in http://en.wikipedia.org/wiki/linked_data 11 John Julian Carstens SPARQL Protocol And RDF Query Language Conclusion

Overview 1 Introduction 2 Linked Open Data 3 RDF 4 SPARQL 5 Usage and Examples 6 Conclusion 12 John Julian Carstens SPARQL Protocol And RDF Query Language

Reminder We needed: 1 Language for connecting data and resources 2 Language for retrieving information from Linked Data To solve 1, the Resource Description Framework (RDF) was introduced 13 John Julian Carstens SPARQL Protocol And RDF Query Language

RDF Basics Recommendation by the W3C XML-based framework to describe and connect resources Every describable thing is a resource, even things outside the web Resources have properties which have values Unique reference to each resource, property or value by URI 14 John Julian Carstens SPARQL Protocol And RDF Query Language

RDF Triples Resource Property The basic view on RDF data is triples Each information is coded as triple, having: Resource, the resource to be described (also called subject) Property, a property of the resource (also called predicate) Value, the value of the property (also called object) Use "blank nodes" to group properties and values for one resource Value Resource, Property and Value can be something referred to by a URI, Value can also be a literal 15 John Julian Carstens SPARQL Protocol And RDF Query Language

RDF Syntax Different syntaxes are given for RDF: XML and triple Data can also be regarded as a graph, introducing RDF graphs Example: Car8231 Type Mustang68. Mustang68 Manufacturer Ford. Car8231 LicensePlate "Lic42". Ford Founder Henry_Ford 16 John Julian Carstens SPARQL Protocol And RDF Query Language

RDF Syntax Example (cont d): "Lic42" Ford Founder Henry Ford LicensePlate Manufacturer Car8231 Type Mustang68 Figure: XML representation Figure: Graph representation 17 John Julian Carstens SPARQL Protocol And RDF Query Language

Notable RDF Extensions/Vocabulary FOAF: Friend of a friend, describing persons, their activities and relations to people and objects DC: Dublin core, vocabulary terms that can be used to describe documents by metadata DBO: DBpedia ontology, vocabulary to describe structured data of Wikipedia articles 18 John Julian Carstens SPARQL Protocol And RDF Query Language

Overview 1 Introduction 2 Linked Open Data 3 RDF 4 SPARQL 5 Usage and Examples 6 Conclusion 19 John Julian Carstens SPARQL Protocol And RDF Query Language

Reminder We needed: 1 Language for connecting data and resources 2 Language for retrieving information from Linked Data To solve 2, we need a query language querying one representation of RDF 20 John Julian Carstens SPARQL Protocol And RDF Query Language

Which Representation of RDF to Query? XML-representation X-Path, other XML query languages Triple representation Fulltext, triple query? Graph representation Pattern matching? SPARQL matching patterns against the RDF graph Other RDF query languages: RDQL, ICS-FORTH RQL, SeRQL (not covered here) 21 John Julian Carstens SPARQL Protocol And RDF Query Language

What is a Graph Pattern? Graph pattern is constructed out of triple patterns Triple pattern is a RDF triple where variables can be used in resource, property or value Example: <http://example.com/cars/mustang68> <http://purl.org/goodrelations/v1#hasmanufacturer>?name 22 John Julian Carstens SPARQL Protocol And RDF Query Language

What is a Graph Pattern? A B? A B B C D A single triple pattern is already a graph pattern Create complex graph patterns by using group patterns Many creation possibilities 23 John Julian Carstens SPARQL Protocol And RDF Query Language

Basic Graph Patterns (BGP) BGP is a sequence of triple patterns Can be regarded as the conjunction of the single patterns Write a full stop after each single pattern Can use namespace prefix like in XML Example: cars:mustang68 gr:hasmanufacturer?name.?name foaf:page?url 24 John Julian Carstens SPARQL Protocol And RDF Query Language

Group Graph Patterns A group graph pattern is a set of graph patterns Group pattern is indicated by surrounding brackets {} and can be empty Patterns within a group are implicitly conjuncted, there is no AND keyword in SPARQL Example: {cars:mustang68 gr:hasmanufacturer?name. cars:mustang68 foaf:page?url. } {{cars:mustang68 gr:hasmanufacturer?name.} {cars:mustang68 foaf:page?url.} } 25 John Julian Carstens SPARQL Protocol And RDF Query Language

Filters Give filter expression to restrict values of a variable Filter expression is evaluated, when returns true Value is accepted Use arithmetic filters or string filters (with regular expression evaluation based on XPath) Can use multiple filters in group graph pattern Examples: FILTER (?model_year = 1968) FILTER regex(?name, "Ford") 26 John Julian Carstens SPARQL Protocol And RDF Query Language

Optional Allows to include values in the result when available, but doesn t deny result when value is not available When value is not available, the query variable is not set Useful, when it is not sure whether RDF information is complete Example: OPTIONAL {cars:mustang68 cars:license_plate?license_plate } 27 John Julian Carstens SPARQL Protocol And RDF Query Language

Alternative Returns result when at least one alternative matches Returns all matching result Similar to SQL UNION operation, thus keyword UNION was chosen Example: { {car? gr:hasmanufacturer "Ford". } UNION {car? gr:hasmanufacturer "GM". } } 28 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries Queries are constructed by using the patterns above and some surrounding syntax Basic queries are using SELECT and WHERE, similar to SQL Reply depends on content of SELECT, e.g. SELECT?x SELECT * is also possible Results are returned as bindings to the variables in SELECT Example: SELECT?name WHERE {cars:mustang68 gr:hasmanufacturer?name. } 29 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries Above: Namespaces "assumed" due to simplicity Include namespace prefix in query by using the PREFIX keyword Example: Give the manufacturer(s) of certain car. PREFIX cars: <http://example.com/cars> PREFIX gr: <http://purl.org/goodrelations/v1> SELECT?name WHERE {cars:mustang68 gr:hasmanufacturer?name. } 30 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries: Blank Nodes When a certain value is not of interest for the result: Use blank node Write either _:<label> or [] Is defined in a BGP, refers the same value if used more then once May not use the same blank node in two different BGPs Can also express this by using a variable and not including it in SELECT 31 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries: Blank Nodes Blank nodes examples: Give all manufacturers of anything. PREFIX gr: <http://purl.org/goodrelations/v1> SELECT?name WHERE {[] gr:hasmanufacturer?name. } Give all types of goods and their manufacturers. PREFIX gr: <http://purl.org/goodrelations/v1> SELECT?name?type WHERE {_:v gr:hasmanufacturer?name. _:v gr:typeofgood?type } 32 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries: CONSTRUCT CONSTRUCT keyword returns a new RDF graph instead of a variable binding Useful for preparing information for further processing or transformating a data set Example: Create RDF graph describing portfolio of manufacturers. PREFIX gr: <http://purl.org/goodrelations/v1> CONSTRUCT {?name gr:offers?car} WHERE {?car gr:hasmanufacturer?name. } 33 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries: ASK Use keyword ASK to check, whether a graph pattern matches Returns only yes or no Example: Is there a car manufactured by Ford? PREFIX gr: <http://purl.org/goodrelations/v1> ASK {?car gr:hasmanufacturer "Ford" } 34 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries: ORDER BY Can sort results similar to SQL by using ORDER BY keyword Can sort using multiple columns and is descending DESC() or ascending ASC() Example: Give all manufacturers, ordered by manufacturers name. PREFIX gr: <http://purl.org/goodrelations/v1> SELECT?name WHERE {?car gr:hasmanufacturer?name } ORDER BY DESC(?name) 35 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries: DISTINCT and REDUCED To exclude duplicates from result, DISTINCT keyword can be added to query REDUCED allows to exclude any number of duplicates from the result, e.g. if the result contains the same value thrice, REDUCED may return it once, twice or thice again (the standard does not specify how this is decided) Example: Give all manufacturers without duplicates. PREFIX gr: <http://purl.org/goodrelations/v1> SELECT DISTINCT(or REDUCED)?name WHERE {?car gr:hasmanufacturer?name } 36 John Julian Carstens SPARQL Protocol And RDF Query Language

Queries: LIMIT and OFFSET LIMIT creates an upper bound for the number of solutions in the result OFFSET will skip the first n solutions of the result Only useful when kept predictable by using ORDER BY Example: Give manufacturers 20 to 30, ordered by manufacturers name. PREFIX gr: <http://purl.org/goodrelations/v1> SELECT?name WHERE {?car gr:hasmanufacturer?name } ORDER BY DESC(?name) LIMIT 10 OFFSET 20 37 John Julian Carstens SPARQL Protocol And RDF Query Language

Overview 1 Introduction 2 Linked Open Data 3 RDF 4 SPARQL 5 Usage and Examples 6 Conclusion 38 John Julian Carstens SPARQL Protocol And RDF Query Language

Reminder We needed: 1 Language for connecting data and resources 2 Language for retrieving information from Linked Data Thus, we have now a representation for our data and a language to ask questions. What to do with that now? 39 John Julian Carstens SPARQL Protocol And RDF Query Language

Usage examples Use RDF to store any data schema-less and SPARQL to query Similar usecase like SQL, e.g. AllegroGraph Use knowledge which is already collected and stored in RDF Query SPARQL-Endpoints Machines can collect and present data with less human support 40 John Julian Carstens SPARQL Protocol And RDF Query Language

SPARQL Endpoint SPARQL accepting web service Allows clients (humans and machines) to query a knowledge base via SPARQL Returns data in formats explained above To be used by experts or machines (or to be enhanced for end-users) Many large ontologies from Linked Open Data offer endpoints, e.g. BioGateway, data.gov or DBpedia 41 John Julian Carstens SPARQL Protocol And RDF Query Language

DBpedia Project to extract structured content from the information collected in Wikipedia Part of Linked Open Data Started by Free University of Berlin and University of Leipzig Data is stored using RDF As of September 2011, DBpedia contains 1 billion of RDF triples Commonly referred when chosing URI for real world resources Provides open SPARQL endpoint 42 John Julian Carstens SPARQL Protocol And RDF Query Language

Querying DBpedia Use SPARQL endpoint at http://dbpedia-live.openlinksw.com/sparql Use DBpedia ontologies <http://dbpedia.org/ontology/> and <http://dbpedia.org/resource/> Example queries: PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX res: <http://dbpedia.org/resource/> SELECT?name WHERE { res:ford_mustang dbo:manufacturer?name} CONSTRUCT {res:ford_motor_company dbo:product?car} WHERE {?car dbo:manufacturer res:ford_motor_company} 43 John Julian Carstens SPARQL Protocol And RDF Query Language

RelFinder Question: How are any two things connected with each other? Dynamic graphical visualization Bases on DBpedia dataset Uses SPARQL to find connections Example: Let s try to find out how Harry S. Truman and Dwight D. Eisenhower are connected! 44 John Julian Carstens SPARQL Protocol And RDF Query Language

RelFinder Image created with http://www.visualdataweb.org/relfinder.php 45 John Julian Carstens SPARQL Protocol And RDF Query Language

RelFinder: How it works Accesses data base, e.g. DBpedia, via SPARQL endpoint Poses queries with growing complexity, patterns have the two subjects to be compared as leftmost/rightmost object Sample query: PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX res: <http://dbpedia.org/resource/> SELECT?conn?obj?conn2 WHERE { res:harry_s._truman?conn?obj. res:dwight_d._eisenhower?conn2?obj } 46 John Julian Carstens SPARQL Protocol And RDF Query Language

Overview 1 Introduction 2 Linked Open Data 3 RDF 4 SPARQL 5 Usage and Examples 6 Conclusion 47 John Julian Carstens SPARQL Protocol And RDF Query Language

Problems Very complex language, semantics not fully defined (ambiguities, gaps) Knowledge bases tend to become very large (remember the Semantic Web map) Runtime problems Problem of graph pattern matching is NP-complete Triple model is very different to classic models like relational databases Rather small (research) community 48 John Julian Carstens SPARQL Protocol And RDF Query Language

Conclusion Versatile framework for knowledge and data store (RDF) Query language for navigating in data store Several real world applications, e.g. Semantic Web, triple store (AllegroGraph), DBpedia etc. Yet many goals to approach, e.g. semantic voice/natural language processing Not well known or commonly used 49 John Julian Carstens SPARQL Protocol And RDF Query Language

Literature (1) Tim Berners-Lee. Linked Data - The Story So Far. In International Journal on Semantic Web and Information Systems, 2009. (2) Manolis Koubarakis. SPARQL Introduction. Lecture Notes, National and Kapodistrian University of Athens, 2011/12. (3) Norbert Luttenberger. XML in Communication Systems. Lecture Notes, Christian-Albrechts-Universität zu Kiel, 2011/12. (4) Frank Manola and Eric Miller. RDF Primer. http://www.w3.org/tr/rdf-primer/, 2004. (5) Eric Prud hommeaux and Andy Seaborne. SPARQL Query Language for RDF. http://www.w3.org/tr/rdf-sparql-query/, 2008. 50 John Julian Carstens SPARQL Protocol And RDF Query Language