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

W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
Fabien Gandon
 

What's hot (20)

Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
 
RDF validation tutorial
RDF validation tutorialRDF validation tutorial
RDF validation tutorial
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
 
RDF data model
RDF data modelRDF data model
RDF data model
 
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013W3C Tutorial on Semantic Web and Linked Data at WWW 2013
W3C Tutorial on Semantic Web and Linked Data at WWW 2013
 
SPARQL 사용법
SPARQL 사용법SPARQL 사용법
SPARQL 사용법
 
Data Modeling with NGSI, NGSI-LD
Data Modeling with NGSI, NGSI-LDData Modeling with NGSI, NGSI-LD
Data Modeling with NGSI, NGSI-LD
 
Introduction To RDF and RDFS
Introduction To RDF and RDFSIntroduction To RDF and RDFS
Introduction To RDF and RDFS
 
LOD(linked open data) part 1 lod 란 무엇인가
LOD(linked open data) part 1   lod 란 무엇인가LOD(linked open data) part 1   lod 란 무엇인가
LOD(linked open data) part 1 lod 란 무엇인가
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
JSON-LD and MongoDB
JSON-LD and MongoDBJSON-LD and MongoDB
JSON-LD and MongoDB
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
 
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
 
RDF 개념 및 구문 소개
RDF 개념 및 구문 소개RDF 개념 및 구문 소개
RDF 개념 및 구문 소개
 
FOAF
FOAFFOAF
FOAF
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
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
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
 
Solr Presentation
Solr PresentationSolr Presentation
Solr Presentation
 

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.
 
Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP
yucefmerhi
 

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
 
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
 
Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP
 

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

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

SPARQL in a nutshell