SlideShare a Scribd company logo
1 of 39
S PAR QL in a nutshell fabien, gandon, inria
RDF triple model  ,[object Object]
SPARQL on top... ,[object Object]
SPARQL  stands for ,[object Object]
SPARQL  in 3 parts ,[object Object]
SPARQL  query ,[object Object],[object Object],[object Object]
SELECT  clause ,[object Object]
FROM  clause ,[object Object]
WHERE  clause ,[object Object]
WHERE  clause ,[object Object],[object Object]
PREFIX ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT   ?person ?name WHERE  {   ?person  rdf:type ex:Person   ?person  ex:name  ?name  . }
example ,[object Object],<?xml version=&quot;1.0&quot;?>  <sparql  xmlns=&quot;http://www.w3.org/2005/sparql-results#&quot;  >  <head>   <variable name=&quot; person &quot;/> <variable name=&quot; name &quot;/>   </head>  <results ordered=&quot;false&quot; distinct=&quot;false&quot;>   <result>   <binding name=&quot; person &quot;> <uri>http://inria.fr/schema#fg</uri> </binding> <binding name=&quot; name &quot;> <literal>gandon</literal> </binding>   </result> <result>  ...
FILTER ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT  ?person ?name WHERE  {   ?person  rdf:type ex:Person   ?person  ex:name  ?name  . ?person  ex:age  ?age  . FILTER (?age > 17) }
FILTER ,[object Object]
OPTIONAL ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT  ?person ?name  ?age WHERE  {   ?person  rdf:type ex:Person   ?person  ex:name  ?name  . OPTIONAL {  ?person  ex:age  ?age  } }
UNION ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT  ?name WHERE  {  ?person ex:name ?name . {   {  ?person  rdf:type ex:Adult   }   UNION   {  ?person  ex:age  ?age    FILTER (?age > 17)  }  } }
Sequence & modify  ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT   ?person ?name WHERE  {   ?person  rdf:type ex:Person   ?person  ex:name  ?name  . } ORDER BY ?name LIMIT 20 OFFSET 20
UNBOUND ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT  ?name WHERE  {  ?person ex:name ?name . OPTIONAL {  ?person  ex:author  ?x  }   FILTER (  ! bound(?x) ) }
negation is tricky and errors can easily be made.
? ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT  ?name WHERE  {  ?person ex:name ?name . ?person  ex:knows  ?x   FILTER (  ?x  != &quot;Java &quot;  ) }
NO!  ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT  ?name WHERE  {  ?person ex:name ?name . ?person  ex:knows  ?x   FILTER (  ?x  != &quot;Java&quot;  ) }  fabien  ex:knows  &quot;Java&quot; fabien  ex:knows  &quot;C++&quot; fabien is a answer...
YES!  ,[object Object],PREFIX  ex: < http://inria.fr/schema# > SELECT  ?name WHERE  {  ?person ex:name ?name . OPTIONAL { ?person  ex:knows  ?x FILTER ( ?x  = &quot;Java&quot;  )  }   FILTER (  ! bound(?x)   ) }
ASK ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > ASK {   ?person  ex:age  ?age    FILTER (?age > 17)  }
CONSTRUCT ,[object Object]
example ,[object Object],PREFIX  ex: < http://inria.fr/schema# > CONSTRUCT { ?person  rdf:type ex:Adult } WHERE {   ?person  ex:age  ?age    FILTER (?age > 17)  }
SPARQL  protocol ,[object Object]
example ,[object Object],GET /sparql/?query= <encoded query>   HTTP/1.1 Host: www.inria.fr User-agent: my-sparql-client/0.1
example ,[object Object],<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <soapenv:Envelope  xmlns:soapenv=&quot;http://www.w3.org/2003/05/soap-envelope/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; > <soapenv:Body> <query-request  xmlns=&quot;http://www.w3.org/2005/09/sparql-protocol-types/#&quot; > <query>SELECT ?x ?p ?y WHERE {?x ?p ?y}</query> </query-request> </soapenv:Body> </soapenv:Envelope>
Take-away summary of SPARQL
SPARQL is... ,[object Object],[object Object],[object Object],[object Object]
SPARQL query language ,[object Object],[object Object],[object Object]
fabien, gandon

More Related Content

What's hot

WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
Katrien Verbert
 
온톨로지 추론 개요
온톨로지 추론 개요온톨로지 추론 개요
온톨로지 추론 개요
Sang-Kyun Kim
 

What's hot (20)

Introduction To RDF and RDFS
Introduction To RDF and RDFSIntroduction To RDF and RDFS
Introduction To RDF and RDFS
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
 
SPARQL Tutorial
SPARQL TutorialSPARQL Tutorial
SPARQL Tutorial
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
 
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
RDF 개념 및 구문 소개
RDF 개념 및 구문 소개RDF 개념 및 구문 소개
RDF 개념 및 구문 소개
 
RDF 해설서
RDF 해설서RDF 해설서
RDF 해설서
 
RDF and OWL
RDF and OWLRDF and OWL
RDF and OWL
 
Model Your Application Domain, Not Your JSON Structures
Model Your Application Domain, Not Your JSON StructuresModel Your Application Domain, Not Your JSON Structures
Model Your Application Domain, Not Your JSON Structures
 
SHACL by example
SHACL by exampleSHACL by example
SHACL by example
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
 
Rdf data-model-and-storage
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage
 
SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)
 
SHACL: Shaping the Big Ball of Data Mud
SHACL: Shaping the Big Ball of Data MudSHACL: Shaping the Big Ball of Data Mud
SHACL: Shaping the Big Ball of Data Mud
 
온톨로지 추론 개요
온톨로지 추론 개요온톨로지 추론 개요
온톨로지 추론 개요
 
RDF, linked data and semantic web
RDF, linked data and semantic webRDF, linked data and semantic web
RDF, linked data and semantic web
 
Understanding RDF: the Resource Description Framework in Context (1999)
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)
 
Debunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative FactsDebunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative Facts
 

Similar to SPARQL in a nutshell

Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
Emanuele Della Valle
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
Lorna Mitchell
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
Doncho Minkov
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical Data
Marakana Inc.
 

Similar to SPARQL in a nutshell (20)

From SQL to SPARQL
From SQL to SPARQLFrom SQL to SPARQL
From SQL to SPARQL
 
Sparql a simple knowledge query
Sparql  a simple knowledge querySparql  a simple knowledge query
Sparql a simple knowledge query
 
SPARQLing Services
SPARQLing ServicesSPARQLing Services
SPARQLing Services
 
Visualize open data with Plone - eea.daviz PLOG 2013
Visualize open data with Plone - eea.daviz PLOG 2013Visualize open data with Plone - eea.daviz PLOG 2013
Visualize open data with Plone - eea.daviz PLOG 2013
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Sem webmaubeuge
Sem webmaubeugeSem webmaubeuge
Sem webmaubeuge
 
PHP MySQL
PHP MySQLPHP MySQL
PHP MySQL
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
 
Sparql
SparqlSparql
Sparql
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
 
Introducción a la web semántica - Linkatu - irekia 2012
Introducción a la web semántica - Linkatu - irekia 2012Introducción a la web semántica - Linkatu - irekia 2012
Introducción a la web semántica - Linkatu - irekia 2012
 
RDF validation tutorial
RDF validation tutorialRDF validation tutorial
RDF validation tutorial
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
XML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEARXML and Web Services with PHP5 and PEAR
XML and Web Services with PHP5 and PEAR
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical Data
 
Using DAOs without implementing them
Using DAOs without implementing themUsing DAOs without implementing them
Using DAOs without implementing them
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
 
Ontologias - RDF
Ontologias - RDFOntologias - RDF
Ontologias - RDF
 

More from Fabien Gandon

Walking Our Way to the Web
Walking Our Way to the WebWalking Our Way to the Web
Walking Our Way to the Web
Fabien Gandon
 
a shift in our research focus: from knowledge acquisition to knowledge augmen...
a shift in our research focus: from knowledge acquisition to knowledge augmen...a shift in our research focus: from knowledge acquisition to knowledge augmen...
a shift in our research focus: from knowledge acquisition to knowledge augmen...
Fabien Gandon
 
CovidOnTheWeb : covid19 linked data published on the Web
CovidOnTheWeb : covid19 linked data published on the WebCovidOnTheWeb : covid19 linked data published on the Web
CovidOnTheWeb : covid19 linked data published on the Web
Fabien Gandon
 

More from Fabien Gandon (20)

Walking Our Way to the Web
Walking Our Way to the WebWalking Our Way to the Web
Walking Our Way to the Web
 
a shift in our research focus: from knowledge acquisition to knowledge augmen...
a shift in our research focus: from knowledge acquisition to knowledge augmen...a shift in our research focus: from knowledge acquisition to knowledge augmen...
a shift in our research focus: from knowledge acquisition to knowledge augmen...
 
Evaluation d’explications pour la prédiction de liens dans les graphes de con...
Evaluation d’explications pour la prédiction de liens dans les graphes de con...Evaluation d’explications pour la prédiction de liens dans les graphes de con...
Evaluation d’explications pour la prédiction de liens dans les graphes de con...
 
A Never-Ending Project for Humanity Called “the Web”
A Never-Ending Project for Humanity Called “the Web”A Never-Ending Project for Humanity Called “the Web”
A Never-Ending Project for Humanity Called “the Web”
 
Wimmics Overview 2021
Wimmics Overview 2021Wimmics Overview 2021
Wimmics Overview 2021
 
CovidOnTheWeb : covid19 linked data published on the Web
CovidOnTheWeb : covid19 linked data published on the WebCovidOnTheWeb : covid19 linked data published on the Web
CovidOnTheWeb : covid19 linked data published on the Web
 
Web open standards for linked data and knowledge graphs as enablers of EU dig...
Web open standards for linked data and knowledge graphs as enablers of EU dig...Web open standards for linked data and knowledge graphs as enablers of EU dig...
Web open standards for linked data and knowledge graphs as enablers of EU dig...
 
from linked data & knowledge graphs to linked intelligence & intelligence graphs
from linked data & knowledge graphs to linked intelligence & intelligence graphsfrom linked data & knowledge graphs to linked intelligence & intelligence graphs
from linked data & knowledge graphs to linked intelligence & intelligence graphs
 
The Web We Mix - benevolent AIs for a resilient web
The Web We Mix - benevolent AIs for a resilient webThe Web We Mix - benevolent AIs for a resilient web
The Web We Mix - benevolent AIs for a resilient web
 
Overview of the Research in Wimmics 2018
Overview of the Research in Wimmics 2018Overview of the Research in Wimmics 2018
Overview of the Research in Wimmics 2018
 
Web science AI and IA
Web science AI and IAWeb science AI and IA
Web science AI and IA
 
Normative Requirements as Linked Data
Normative Requirements as Linked DataNormative Requirements as Linked Data
Normative Requirements as Linked Data
 
Wimmics Research Team Overview 2017
Wimmics Research Team Overview 2017Wimmics Research Team Overview 2017
Wimmics Research Team Overview 2017
 
On the many graphs of the Web and the interest of adding their missing links.
On the many graphs of the Web and the interest of adding their missing links. On the many graphs of the Web and the interest of adding their missing links.
On the many graphs of the Web and the interest of adding their missing links.
 
One Web of pages, One Web of peoples, One Web of Services, One Web of Data, O...
One Web of pages, One Web of peoples, One Web of Services, One Web of Data, O...One Web of pages, One Web of peoples, One Web of Services, One Web of Data, O...
One Web of pages, One Web of peoples, One Web of Services, One Web of Data, O...
 
How to supervise your supervisor?
How to supervise your supervisor?How to supervise your supervisor?
How to supervise your supervisor?
 
Dans l'esprit du Pagerank: regards croisés sur les algorithmes,
Dans l'esprit du Pagerank: regards croisés sur les algorithmes,Dans l'esprit du Pagerank: regards croisés sur les algorithmes,
Dans l'esprit du Pagerank: regards croisés sur les algorithmes,
 
Wimmics Research Team 2015 Activity Report
Wimmics Research Team 2015 Activity ReportWimmics Research Team 2015 Activity Report
Wimmics Research Team 2015 Activity Report
 
Retours sur le MOOC "Web Sémantique et Web de données"
Retours sur le MOOC "Web Sémantique et Web de données"Retours sur le MOOC "Web Sémantique et Web de données"
Retours sur le MOOC "Web Sémantique et Web de données"
 
Emotions in Argumentation: an Empirical Evaluation @ IJCAI 2015
Emotions in Argumentation: an Empirical Evaluation @ IJCAI 2015Emotions in Argumentation: an Empirical Evaluation @ IJCAI 2015
Emotions in Argumentation: an Empirical Evaluation @ IJCAI 2015
 

Recently uploaded

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

SPARQL in a nutshell