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
Ad

More Related Content

What's hot (20)

Rdf In A Nutshell V1
Rdf In A Nutshell V1Rdf In A Nutshell V1
Rdf In A Nutshell V1
Fabien Gandon
 
RDFS In A Nutshell V1
RDFS In A Nutshell V1RDFS In A Nutshell V1
RDFS In A Nutshell V1
Fabien Gandon
 
SPARQL Tutorial
SPARQL TutorialSPARQL Tutorial
SPARQL Tutorial
Leigh Dodds
 
Introduction To RDF and RDFS
Introduction To RDF and RDFSIntroduction To RDF and RDFS
Introduction To RDF and RDFS
Nilesh Wagmare
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
Olaf Hartig
 
RDF and OWL
RDF and OWLRDF and OWL
RDF and OWL
Rachel Lovinger
 
SPARQL - Basic and Federated Queries
SPARQL - Basic and Federated QueriesSPARQL - Basic and Federated Queries
SPARQL - Basic and Federated Queries
Knud Möller
 
Ontology In A Nutshell (version 2)
Ontology In A Nutshell (version 2)Ontology In A Nutshell (version 2)
Ontology In A Nutshell (version 2)
Fabien Gandon
 
SHACL by example
SHACL by exampleSHACL by example
SHACL by example
Jose Emilio Labra Gayo
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
Olaf Hartig
 
DBIx::Class beginners
DBIx::Class beginnersDBIx::Class beginners
DBIx::Class beginners
leo lapworth
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
Jose Emilio Labra Gayo
 
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)
Thomas Francart
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
Narni Rajesh
 
SPARQL 사용법
SPARQL 사용법SPARQL 사용법
SPARQL 사용법
홍수 허
 
Building Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
Markus Lanthaler
 
Introduction to RDF Data Model
Introduction to RDF Data ModelIntroduction to RDF Data Model
Introduction to RDF Data Model
Cesar Augusto Nogueira
 
RDF 개념 및 구문 소개
RDF 개념 및 구문 소개RDF 개념 및 구문 소개
RDF 개념 및 구문 소개
Dongbum Kim
 
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Dongbum Kim
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
Adriel Café
 
Rdf In A Nutshell V1
Rdf In A Nutshell V1Rdf In A Nutshell V1
Rdf In A Nutshell V1
Fabien Gandon
 
RDFS In A Nutshell V1
RDFS In A Nutshell V1RDFS In A Nutshell V1
RDFS In A Nutshell V1
Fabien Gandon
 
Introduction To RDF and RDFS
Introduction To RDF and RDFSIntroduction To RDF and RDFS
Introduction To RDF and RDFS
Nilesh Wagmare
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
Olaf Hartig
 
SPARQL - Basic and Federated Queries
SPARQL - Basic and Federated QueriesSPARQL - Basic and Federated Queries
SPARQL - Basic and Federated Queries
Knud Möller
 
Ontology In A Nutshell (version 2)
Ontology In A Nutshell (version 2)Ontology In A Nutshell (version 2)
Ontology In A Nutshell (version 2)
Fabien Gandon
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
Olaf Hartig
 
DBIx::Class beginners
DBIx::Class beginnersDBIx::Class beginners
DBIx::Class beginners
leo lapworth
 
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)
Thomas Francart
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
Narni Rajesh
 
SPARQL 사용법
SPARQL 사용법SPARQL 사용법
SPARQL 사용법
홍수 허
 
Building Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
Markus Lanthaler
 
RDF 개념 및 구문 소개
RDF 개념 및 구문 소개RDF 개념 및 구문 소개
RDF 개념 및 구문 소개
Dongbum Kim
 
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Linked Data의 RDF 어휘 이해하고 체험하기 - FOAF, SIOC, SKOS를 중심으로 -
Dongbum Kim
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
Adriel Café
 

Similar to SPARQL in a nutshell (20)

From SQL to SPARQL
From SQL to SPARQLFrom SQL to SPARQL
From SQL to SPARQL
George Roth
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
AdonisDamian
 
Sparql a simple knowledge query
Sparql  a simple knowledge querySparql  a simple knowledge query
Sparql a simple knowledge query
Stanley Wang
 
SPARQLing Services
SPARQLing ServicesSPARQLing Services
SPARQLing Services
Leigh Dodds
 
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
Antonio De Marinis
 
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
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Sem webmaubeuge
Sem webmaubeugeSem webmaubeuge
Sem webmaubeuge
Jose Emilio Labra Gayo
 
PHP MySQL
PHP MySQLPHP MySQL
PHP MySQL
Md. Sirajus Salayhin
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
Lorna Mitchell
 
Sparql
SparqlSparql
Sparql
Serge Garlatti
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
Doncho Minkov
 
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
Alberto Labarga
 
RDF validation tutorial
RDF validation tutorialRDF validation tutorial
RDF validation tutorial
Jose Emilio Labra Gayo
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
Wildan Maulana
 
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
Stephan Schmidt
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
hardchiu
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical Data
Marakana Inc.
 
Using DAOs without implementing them
Using DAOs without implementing themUsing DAOs without implementing them
Using DAOs without implementing them
benfante
 
From SQL to SPARQL
From SQL to SPARQLFrom SQL to SPARQL
From SQL to SPARQL
George Roth
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
AdonisDamian
 
Sparql a simple knowledge query
Sparql  a simple knowledge querySparql  a simple knowledge query
Sparql a simple knowledge query
Stanley Wang
 
SPARQLing Services
SPARQLing ServicesSPARQLing Services
SPARQLing Services
Leigh Dodds
 
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
Antonio De Marinis
 
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
 
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
Alberto Labarga
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
Wildan Maulana
 
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
Stephan Schmidt
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
hardchiu
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical Data
Marakana Inc.
 
Using DAOs without implementing them
Using DAOs without implementing themUsing DAOs without implementing them
Using DAOs without implementing them
benfante
 
Ad

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
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
 
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...
Fabien Gandon
 
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”
Fabien Gandon
 
Wimmics Overview 2021
Wimmics Overview 2021Wimmics Overview 2021
Wimmics Overview 2021
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
 
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...
Fabien Gandon
 
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
Fabien Gandon
 
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
Fabien Gandon
 
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
Fabien Gandon
 
Web science AI and IA
Web science AI and IAWeb science AI and IA
Web science AI and IA
Fabien Gandon
 
Normative Requirements as Linked Data
Normative Requirements as Linked DataNormative Requirements as Linked Data
Normative Requirements as Linked Data
Fabien Gandon
 
Wimmics Research Team Overview 2017
Wimmics Research Team Overview 2017Wimmics Research Team Overview 2017
Wimmics Research Team Overview 2017
Fabien Gandon
 
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.
Fabien Gandon
 
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...
Fabien Gandon
 
How to supervise your supervisor?
How to supervise your supervisor?How to supervise your supervisor?
How to supervise your supervisor?
Fabien Gandon
 
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,
Fabien Gandon
 
Wimmics Research Team 2015 Activity Report
Wimmics Research Team 2015 Activity ReportWimmics Research Team 2015 Activity Report
Wimmics Research Team 2015 Activity Report
Fabien Gandon
 
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"
Fabien Gandon
 
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
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
 
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...
Fabien Gandon
 
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”
Fabien Gandon
 
Wimmics Overview 2021
Wimmics Overview 2021Wimmics Overview 2021
Wimmics Overview 2021
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
 
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...
Fabien Gandon
 
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
Fabien Gandon
 
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
Fabien Gandon
 
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
Fabien Gandon
 
Web science AI and IA
Web science AI and IAWeb science AI and IA
Web science AI and IA
Fabien Gandon
 
Normative Requirements as Linked Data
Normative Requirements as Linked DataNormative Requirements as Linked Data
Normative Requirements as Linked Data
Fabien Gandon
 
Wimmics Research Team Overview 2017
Wimmics Research Team Overview 2017Wimmics Research Team Overview 2017
Wimmics Research Team Overview 2017
Fabien Gandon
 
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.
Fabien Gandon
 
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...
Fabien Gandon
 
How to supervise your supervisor?
How to supervise your supervisor?How to supervise your supervisor?
How to supervise your supervisor?
Fabien Gandon
 
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,
Fabien Gandon
 
Wimmics Research Team 2015 Activity Report
Wimmics Research Team 2015 Activity ReportWimmics Research Team 2015 Activity Report
Wimmics Research Team 2015 Activity Report
Fabien Gandon
 
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"
Fabien Gandon
 
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
Fabien Gandon
 
Ad

Recently uploaded (20)

Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
accessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electricaccessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electric
UXPA Boston
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural NetworksDistributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Ivan Ruchkin
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptxUiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
anabulhac
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
accessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electricaccessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electric
UXPA Boston
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural NetworksDistributionally Robust Statistical Verification with Imprecise Neural Networks
Distributionally Robust Statistical Verification with Imprecise Neural Networks
Ivan Ruchkin
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptxUiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
anabulhac
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 

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
  翻译: