SlideShare a Scribd company logo
S PAR QL in a nutshell fabien, gandon, inria
RDF triple model  is the first layer of the semantic web standards
SPARQL on top... an  R D F  query language and data access protocol
SPARQL  stands for S PARQL  P rotocol and  R DF  Q uery  L anguage
SPARQL  in 3 parts part 1:  query  language part 2:  result  format part 3: access  protocol
SPARQL  query SELECT ... FROM ... WHERE { ... }
SELECT  clause to identify the values to be returned
FROM  clause to identify the data sources to query
WHERE  clause the triple/graph pattern to be matched against the triples/graphs of RDF
WHERE  clause a conjunction of triples: {  ?x  rdf:type ex:Person ?x  ex:name  ?name  }
PREFIX to declare the schema used in the query
example persons and their names PREFIX  ex: < http://inria.fr/schema# > SELECT   ?person ?name WHERE  {   ?person  rdf:type ex:Person   ?person  ex:name  ?name  . }
example of result <?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 to add constraints  to the graph pattern (e.g., numerical like  X>17  )
example persons at least 18-year old 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 can use many operators, functions (e.g., regular expressions), and even users' extensions
OPTIONAL to make the matching of a part of the pattern optional
example retrieve the age if available 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 to give alternative patterns in a query
example explicit or implicit adults  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  ORDER BY  to sort LIMIT  result number OFFSET  rank of first result
example results 21 to 40 ordered by name 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 test a variable is not bound ; used for negation as failure
example persons who are not known authors 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.
? does this find persons who do not know &quot;java&quot; ? PREFIX  ex: < http://inria.fr/schema# > SELECT  ?name WHERE  {  ?person ex:name ?name . ?person  ex:knows  ?x   FILTER (  ?x  != &quot;Java &quot;  ) }
NO!  also persons who know something else  ! 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!  persons who are not known to know &quot;java&quot; ... negation of an option... 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 to check just if there is at least one answer ; result is &quot;true&quot; or &quot;false&quot;
example is there a person older than 17 ? PREFIX  ex: < http://inria.fr/schema# > ASK {   ?person  ex:age  ?age    FILTER (?age > 17)  }
CONSTRUCT return a specific RDF graph for each result
example return instances of adults for persons older than 17 PREFIX  ex: < http://inria.fr/schema# > CONSTRUCT { ?person  rdf:type ex:Adult } WHERE {   ?person  ex:age  ?age    FILTER (?age > 17)  }
SPARQL  protocol sending queries and their results accross the web
example with HTTP Binding GET /sparql/?query= <encoded query>   HTTP/1.1 Host: www.inria.fr User-agent: my-sparql-client/0.1
example with SOAP Binding <?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... ... a query language ... ... a result format ... ... an access protocol ... ...  for RDF
SPARQL query language based on the triple model  ?x   ?p   ?y filters to add constraints optional parts and alternative parts
fabien, gandon

More Related Content

What's hot (20)

PPT
Rdf In A Nutshell V1
Fabien Gandon
 
PPT
RDFS In A Nutshell V1
Fabien Gandon
 
PPT
SPARQL Tutorial
Leigh Dodds
 
PPT
Ontology In A Nutshell (version 2)
Fabien Gandon
 
PDF
Querying Linked Data with SPARQL
Olaf Hartig
 
PPTX
RDF Data Model
Jose Emilio Labra Gayo
 
PPTX
RDF 개념 및 구문 소개
Dongbum Kim
 
PPTX
Model Your Application Domain, Not Your JSON Structures
Markus Lanthaler
 
PPT
RDF and OWL
Rachel Lovinger
 
PPT
Introduction To RDF and RDFS
Nilesh Wagmare
 
PPTX
SPARQL introduction and training (130+ slides with exercices)
Thomas Francart
 
PDF
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Dongbum Kim
 
PPTX
RDF, linked data and semantic web
Jose Emilio Labra Gayo
 
PDF
ESWC 2017 Tutorial Knowledge Graphs
Peter Haase
 
PPTX
The Semantic Web #6 - RDF Schema
Myungjin Lee
 
PDF
Introduction to RDF & SPARQL
Open Data Support
 
PDF
Introduction to RDF
Dr Sukhpal Singh Gill
 
PDF
RDF 해설서
Hansung University
 
PDF
Full-on Hypermedia APIs with Hydra
Markus Lanthaler
 
PPTX
Semantic Web - Ontologies
Serge Linckels
 
Rdf In A Nutshell V1
Fabien Gandon
 
RDFS In A Nutshell V1
Fabien Gandon
 
SPARQL Tutorial
Leigh Dodds
 
Ontology In A Nutshell (version 2)
Fabien Gandon
 
Querying Linked Data with SPARQL
Olaf Hartig
 
RDF Data Model
Jose Emilio Labra Gayo
 
RDF 개념 및 구문 소개
Dongbum Kim
 
Model Your Application Domain, Not Your JSON Structures
Markus Lanthaler
 
RDF and OWL
Rachel Lovinger
 
Introduction To RDF and RDFS
Nilesh Wagmare
 
SPARQL introduction and training (130+ slides with exercices)
Thomas Francart
 
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Dongbum Kim
 
RDF, linked data and semantic web
Jose Emilio Labra Gayo
 
ESWC 2017 Tutorial Knowledge Graphs
Peter Haase
 
The Semantic Web #6 - RDF Schema
Myungjin Lee
 
Introduction to RDF & SPARQL
Open Data Support
 
Introduction to RDF
Dr Sukhpal Singh Gill
 
RDF 해설서
Hansung University
 
Full-on Hypermedia APIs with Hydra
Markus Lanthaler
 
Semantic Web - Ontologies
Serge Linckels
 

Similar to SPARQL in a nutshell (20)

PPTX
Semantic web meetup – sparql tutorial
AdonisDamian
 
PPTX
SPARQL
Raji Ghawi
 
PPTX
What;s Coming In SPARQL2?
LeeFeigenbaum
 
PDF
Sparql a simple knowledge query
Stanley Wang
 
PPT
From SQL to SPARQL
George Roth
 
PDF
Introducción a la web semántica - Linkatu - irekia 2012
Alberto Labarga
 
PPTX
Sparql
Tamrat Amare
 
PDF
Tutorial on SPARQL: SPARQL Protocol and RDF Query Language
Biswanath Dutta
 
PPT
Semantic Web
amberkhan59
 
PPT
Semantic Web
amberkhan59
 
PPTX
Introduction to SPARQL
Jose Emilio Labra Gayo
 
PPTX
Introduction to SPARQL
Jose Emilio Labra Gayo
 
PDF
Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: Univer...
Allison Jai O'Dell
 
PPT
Querying the Semantic Web with SPARQL
Emanuele Della Valle
 
PPT
Sparql
Serge Garlatti
 
PPT
SPARQL and SQL: technical aspects and synergy
Yannis Kalfoglou
 
PPTX
SPARQL-DL - Theory & Practice
Adriel Café
 
ODP
NoSQL and Triple Stores
andyseaborne
 
PDF
SPARQL and the Open Linked Data initiative
Fulvio Corno
 
PDF
HyperGraphQL
Szymon Klarman
 
Semantic web meetup – sparql tutorial
AdonisDamian
 
SPARQL
Raji Ghawi
 
What;s Coming In SPARQL2?
LeeFeigenbaum
 
Sparql a simple knowledge query
Stanley Wang
 
From SQL to SPARQL
George Roth
 
Introducción a la web semántica - Linkatu - irekia 2012
Alberto Labarga
 
Sparql
Tamrat Amare
 
Tutorial on SPARQL: SPARQL Protocol and RDF Query Language
Biswanath Dutta
 
Semantic Web
amberkhan59
 
Semantic Web
amberkhan59
 
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: Univer...
Allison Jai O'Dell
 
Querying the Semantic Web with SPARQL
Emanuele Della Valle
 
SPARQL and SQL: technical aspects and synergy
Yannis Kalfoglou
 
SPARQL-DL - Theory & Practice
Adriel Café
 
NoSQL and Triple Stores
andyseaborne
 
SPARQL and the Open Linked Data initiative
Fulvio Corno
 
HyperGraphQL
Szymon Klarman
 
Ad

More from Fabien Gandon (20)

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

Recently uploaded (20)

PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 

SPARQL in a nutshell

  • 1. S PAR QL in a nutshell fabien, gandon, inria
  • 2. RDF triple model is the first layer of the semantic web standards
  • 3. SPARQL on top... an R D F query language and data access protocol
  • 4. SPARQL stands for S PARQL P rotocol and R DF Q uery L anguage
  • 5. SPARQL in 3 parts part 1: query language part 2: result format part 3: access protocol
  • 6. SPARQL query SELECT ... FROM ... WHERE { ... }
  • 7. SELECT clause to identify the values to be returned
  • 8. FROM clause to identify the data sources to query
  • 9. WHERE clause the triple/graph pattern to be matched against the triples/graphs of RDF
  • 10. WHERE clause a conjunction of triples: { ?x rdf:type ex:Person ?x ex:name ?name }
  • 11. PREFIX to declare the schema used in the query
  • 12. example persons and their names PREFIX ex: < http://inria.fr/schema# > SELECT ?person ?name WHERE { ?person rdf:type ex:Person ?person ex:name ?name . }
  • 13. example of result <?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> ...
  • 14. FILTER to add constraints to the graph pattern (e.g., numerical like X>17 )
  • 15. example persons at least 18-year old 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) }
  • 16. FILTER can use many operators, functions (e.g., regular expressions), and even users' extensions
  • 17. OPTIONAL to make the matching of a part of the pattern optional
  • 18. example retrieve the age if available 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 } }
  • 19. UNION to give alternative patterns in a query
  • 20. example explicit or implicit adults 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) } } }
  • 21. Sequence & modify ORDER BY to sort LIMIT result number OFFSET rank of first result
  • 22. example results 21 to 40 ordered by name 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
  • 23. UNBOUND test a variable is not bound ; used for negation as failure
  • 24. example persons who are not known authors PREFIX ex: < http://inria.fr/schema# > SELECT ?name WHERE { ?person ex:name ?name . OPTIONAL { ?person ex:author ?x } FILTER ( ! bound(?x) ) }
  • 25. negation is tricky and errors can easily be made.
  • 26. ? does this find persons who do not know &quot;java&quot; ? PREFIX ex: < http://inria.fr/schema# > SELECT ?name WHERE { ?person ex:name ?name . ?person ex:knows ?x FILTER ( ?x != &quot;Java &quot; ) }
  • 27. NO! also persons who know something else ! 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...
  • 28. YES! persons who are not known to know &quot;java&quot; ... negation of an option... 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) ) }
  • 29. ASK to check just if there is at least one answer ; result is &quot;true&quot; or &quot;false&quot;
  • 30. example is there a person older than 17 ? PREFIX ex: < http://inria.fr/schema# > ASK { ?person ex:age ?age FILTER (?age > 17) }
  • 31. CONSTRUCT return a specific RDF graph for each result
  • 32. example return instances of adults for persons older than 17 PREFIX ex: < http://inria.fr/schema# > CONSTRUCT { ?person rdf:type ex:Adult } WHERE { ?person ex:age ?age FILTER (?age > 17) }
  • 33. SPARQL protocol sending queries and their results accross the web
  • 34. example with HTTP Binding GET /sparql/?query= <encoded query> HTTP/1.1 Host: www.inria.fr User-agent: my-sparql-client/0.1
  • 35. example with SOAP Binding <?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>
  • 37. SPARQL is... ... a query language ... ... a result format ... ... an access protocol ... ... for RDF
  • 38. SPARQL query language based on the triple model ?x ?p ?y filters to add constraints optional parts and alternative parts