SlideShare a Scribd company logo
SPARQL
SPARQL Protocol and RDF
Query Language

S. Garlatti

16/01/14
Outline
 SPARQL

page 2

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language


SPARQL
• pronounced "sparkle" [1]) is an RDF query language; its name
is a recursive acronym that stands for SPARQL Protocol and
RDF Query Language. It is standardized by the RDF Data
Access Working Group (DAWG) of the
World Wide Web Consortium, and is considered a component
of the semantic web.
• Initially released as a Candidate Recommendation in April
2006, but returned to Working Draft status in October 2006,
due to two open issues. [2] In June 2007, SPARQL advanced
to Candidate Recommendation once again. [3] On 12th
November 2007 the status of SPARQL changed into Proposed
Recommendation. [4] On 15th January 2008, SPARQL became
an official W3C Recommendation. [5]

page 3

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 SPARQL

=

• A Query Language
• A Result Form
• An Access Protocol

page 4

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
 The

Query Language: query forms

• « Select » clause returns all or subset of the
variables bound in a query pattern match
• « Construct » returns an RDF graph constructed by
substituting variables in a set of triple templates
• « Ask » returns a boolean indicating whether a query
pattern matches
• « Describe » returns an RDF graph that describe the
resources found
page 5

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
«

Select » equivalent to « SQL Select » returns a
regular table
Select …
From …

Identify data sources to query

Where { … } The triple/graph pattern
to be matched against the
triple/graphs of RDF
A conjunction of triples
 PREFIX
page 6

to declare the schema used in the query

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language


PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name
FROM <http://example.org/foaf/aliceFoaf>
WHERE
{
?x foaf:name ?name
}

Result:
name
« Alice »

page 7

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language


PREFIX
PREFIX
PREFIX
PREFIX

foaf: <http://xmlns.com/foaf/0.1/>
: <http://dbpedia.org/resource/>
dbpedia2: <http://dbpedia.org/property/>
dbpedia: <http://dbpedia.org/>

SELECT distinct ?name ?birth ?person
FROM

<http://dbpedia.org/>

WHERE


page 8

{
?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin>.
?person dbpedia2:birth ?birth .
?person foaf:name ?name .
}

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 SPARQL


results:

namebirthperson« ":Dru_Berrymore/birth/birth_date_and_age :Dru_Berrymore "Dru
Berrymore"@de:Dru_Berrymore/birth/birth_date_and_age :Dru_Berrymore "Walter
Benjamin"@de:Berlin :Walter_Benjamin "Walter Benjamin"@de:Germany
:Walter_Benjamin

Name

Birth

« Dru Berrymore »

page 9

Computer Science Department

Semantic Web in Action

Person
SPARQL: SPARQL Protocol and RDF Query
Language




page 10

SELECT distinct ?name ?person
FROM
<http://dbpedia.org/>
WHERE
{
?person dbpedia2:birthPlace
<http://dbpedia.org/resource/Berlin> .
?person foaf:name ?name .
}
SELECT distinct ?name ?birth ?death ?person
FROM
<http://dbpedia.org/>
WHERE
{
?person dbpedia2:birthPlace
<http://dbpedia.org/resource/Berlin> .
?person dbpedia2:birth ?birth .
?person foaf:name ?name .
?person dbpedia2:death ?death.
}
Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
A

constraint, expressed by the keyword “FILTER”,
is a restriction on solutions over the whole group
in which the filter appears

 PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX ns: <http://example.org/ns#>
SELECT ?title ?price
WHERE
{
?x ns:price ?price .
FILTER (?price < 30.5)
?x dc:title ?title .
}
page 11

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
 “regex”

matches only plain literals with no
language tag





page 12

{

?x foaf:name ?name .
?x foaf:mbox ?mbox .
FILTER regex(?name, "Smith")

}

PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?title
WHERE
{
?x dc:title ?title
FILTER regex(?title, "web", "i" ) }

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
 Optional

parts of the graph pattern may be
specified syntactically with the “OPTIONAL”
keyword applied to a graph pattern



page 13

SELECT distinct ?name ?birth ?death ?person
FROM
<http://dbpedia.org/>
WHERE
{ ?person dbpedia2:birthPlace
<http://dbpedia.org/resource/Berlin> .
?person dbpedia2:birth ?birth .
?person foaf:name ?name .
OPTIONAL {?person dbpedia2:death ?death}
}
Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
 Matching

alternative

• Pattern alternatives are syntactically specified with the 
UNION keyword


SELECT distinct ?name ?birth ?death ?person
WHERE {
{?person dbpedia2:birthPlace
<http://dbpedia.org/resource/Berlin> }
UNION
{?person dbpedia2:death ?death}
?person foaf:name ?name .
?person dbpedia2:birth ?birth .
}

page 14

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
 Sequence

& Modify

• « Order By » to sort, 
• « LIMIT » result number, 
• « OFFSET » rank of first result


SELECT distinct ?name ?person
WHERE
{
?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin>.

?person foaf:name ?name.
}
ORDER BY ?name LIMIT 20 OFFSET 20
page 15

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
«

Construct »

• The CONSTRUCT query form returns a single RDF 
graph specified by a graph template. 
- The result is an RDF graph formed by taking each query 
solution in the solution sequence, substituting for the 
variables in the graph template, and combining the triples into 
a single RDF graph by set union.

• Useful for aggregating data from multiple sources 
and merging it into a local store (from Ingenta)

page 16

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language


PREFIX foaf: <http://xmlns.com/foaf/0.1/>
FROM <http://molene.enstb.org/mlearning09/wpcontent/plugins/wp-rdfa/foaf.php
CONSTRUCT
{
?friend a foaf:Person;
foaf:name ?name;
foaf:homepage ?home.}
WHERE
{
?person foaf:mbox <mailto:ac@enstb.com>;
foaf:knows ?friend.
?friend foaf:name ?name;
foaf:homepage ?home.}

page 17

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
 ASK

• Returns a true/false value: test whether or not a query pattern 
has a solution. 
• No information is returned about the possible query solutions, 
just whether or not a solution exists
• Is there data that looks like this? Do you have any information 
about that? (from Ingenta)


page 18

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
ASK
WHERE {
?person a foaf:Person;
foaf:mbox <mailto:ab@telecom-bretagne>.
}

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 DESCRIBE

• The DESCRIBE form returns a single result RDF 
graph containing RDF data about resources.
• CONSTRUCT but with less control
- Tell me about this or things that look like this … but you
decide what’s relevant (from Ingenta)


PREFIX foaf: <http://xmlns.com/foaf/0.1/>
DESCRIBE ?friend
WHERE {
?person foaf:mbox “mailto:ab@telecom-bretagne”;
foaf:knows ?friend.}

page 19

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 Applied

uses (from Ingenta)

• DESCRIBE for Prototyping
- DESCRIBE <http://example.org/someResource>

- Quickly assembling Uis, Web APIs

• SELECT for Indexing
- Building an ordering over some data ORDER BY, LIMIT

page 20

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 Applied

uses (from Ingenta)

• CONSTRUCT for transformation and also simple 
inferencing
- CONSTRUCT could be the XSLT of RDF
- Currently limited by lack of expressions in CONSTRUCT 
triple templates
• ASK for validation
• ASK – DESCRIBE – CONSTRUCT Pattern: 
- Probe endpoint, Grab default view of data, Refine data extraction and/or 
apply transformation

page 21

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 SPARQL

Protocol (from F. Gandon, INRIA)

• 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

page 22

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 Example


with SOAP binding (from F. Gandon)

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>
<query-request xmlns="http://www.w3.org/2005/09/sparqlprotocol-types/#">
<query> SELECT ?x ?p ?y WHERE {?x ?p ?y} </query>
</query-request>
</soapenv:Body>
</soapenv:Envelope>

page 23

Computer Science Department

Semantic Web in Action
SPARQL: SPARQL Protocol and RDF Query
Language
 Access

to Data on the web

• http://dbpedia.org/snorql/
• http://dbpedia.org/sparql
• http://demo.openlinksw.com/rdfbrowser2/
• http://dataviewer.zitgist.com/
• Etc.


Twinkle : a sparql query tool

• http://www.ldodds.com/projects/twinkle

page 24

Computer Science Department

Linked Data & Social Web
SPARQL: SPARQL Protocol and RDF Query
Language
 Resources

• http://en.wikipedia.org/wiki/SPARQL
• http://www.w3.org/TR/rdf-sparql-query/
• http://jena.sourceforge.net/ARQ/Tutorial/
• http://esw.w3.org/topic/SparqlImplementations
• http://arc.semsol.org/home
• http://virtuoso.openlinksw.com/wiki/main/Main/

page 25

Computer Science Department

Semantic Web in Action

More Related Content

What's hot

HiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint Federation
HiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint FederationHiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint Federation
HiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint Federation
Muhammad Saleem
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
Olaf Hartig
 
SPARQL 1.1 Status
SPARQL 1.1 StatusSPARQL 1.1 Status
SPARQL 1.1 Status
LeeFeigenbaum
 
Federated Query Formulation and Processing Through BioFed
Federated Query Formulation and Processing Through BioFedFederated Query Formulation and Processing Through BioFed
Federated Query Formulation and Processing Through BioFed
Muhammad Saleem
 
Efficient source selection for sparql endpoint federation
Efficient source selection for sparql endpoint federationEfficient source selection for sparql endpoint federation
Efficient source selection for sparql endpoint federation
Muhammad Saleem
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
AdonisDamian
 
Ks2008 Semanticweb In Action
Ks2008 Semanticweb In ActionKs2008 Semanticweb In Action
Ks2008 Semanticweb In ActionRinke Hoekstra
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
andyseaborne
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
andyseaborne
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
Tatiana Al-Chueyr
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
Adriel Café
 
Triple Stores
Triple StoresTriple Stores
Triple Stores
Stephan Volmer
 
Linked Open Data Visualization
Linked Open Data VisualizationLinked Open Data Visualization
Linked Open Data Visualization
Laura Po
 
Wi2015 - Clustering of Linked Open Data - the LODeX tool
Wi2015 - Clustering of Linked Open Data - the LODeX toolWi2015 - Clustering of Linked Open Data - the LODeX tool
Wi2015 - Clustering of Linked Open Data - the LODeX tool
Laura Po
 
Data translation with SPARQL 1.1
Data translation with SPARQL 1.1Data translation with SPARQL 1.1
Data translation with SPARQL 1.1andreas_schultz
 
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
Neo4j
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaKatrien Verbert
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
hardchiu
 

What's hot (20)

HiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint Federation
HiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint FederationHiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint Federation
HiBISCuS: Hypergraph-Based Source Selection for SPARQL Endpoint Federation
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
 
SPARQL 1.1 Status
SPARQL 1.1 StatusSPARQL 1.1 Status
SPARQL 1.1 Status
 
Federated Query Formulation and Processing Through BioFed
Federated Query Formulation and Processing Through BioFedFederated Query Formulation and Processing Through BioFed
Federated Query Formulation and Processing Through BioFed
 
Efficient source selection for sparql endpoint federation
Efficient source selection for sparql endpoint federationEfficient source selection for sparql endpoint federation
Efficient source selection for sparql endpoint federation
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
 
Ks2008 Semanticweb In Action
Ks2008 Semanticweb In ActionKs2008 Semanticweb In Action
Ks2008 Semanticweb In Action
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 
4 sw architectures and sparql
4 sw architectures and sparql4 sw architectures and sparql
4 sw architectures and sparql
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
Triple Stores
Triple StoresTriple Stores
Triple Stores
 
Linked Open Data Visualization
Linked Open Data VisualizationLinked Open Data Visualization
Linked Open Data Visualization
 
Wi2015 - Clustering of Linked Open Data - the LODeX tool
Wi2015 - Clustering of Linked Open Data - the LODeX toolWi2015 - Clustering of Linked Open Data - the LODeX tool
Wi2015 - Clustering of Linked Open Data - the LODeX tool
 
Data translation with SPARQL 1.1
Data translation with SPARQL 1.1Data translation with SPARQL 1.1
Data translation with SPARQL 1.1
 
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
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
 

Similar to Sparql

The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
Myungjin Lee
 
Querying Linked Data
Querying Linked DataQuerying Linked Data
Querying Linked Data
EUCLID project
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLEmanuele Della Valle
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQLLino Valdivia
 
2009 0807 Lod Gmod
2009 0807 Lod Gmod2009 0807 Lod Gmod
2009 0807 Lod Gmod
Jun Zhao
 
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
 
Sparql a simple knowledge query
Sparql  a simple knowledge querySparql  a simple knowledge query
Sparql a simple knowledge query
Stanley Wang
 
SPARQL in the Semantic Web
SPARQL in the Semantic WebSPARQL in the Semantic Web
SPARQL in the Semantic WebJan Beeck
 
SPARQL Query Forms
SPARQL Query FormsSPARQL Query Forms
SPARQL Query Forms
Leigh Dodds
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
Robert Engels
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
sesam4able
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your Analytics
Dr. Neil Brittliff
 
Tutorial Linked APIs
Tutorial Linked APIsTutorial Linked APIs
Tutorial Linked APIs
Steffen Stadtmüller
 
Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011Juan Sequeda
 
Re-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playoutRe-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playout
MediaMixerCommunity
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Jose Emilio Labra Gayo
 
GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelab
CAMELIA BOBAN
 
Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011Juan Sequeda
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic webMarakana Inc.
 

Similar to Sparql (20)

The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
 
Querying Linked Data
Querying Linked DataQuerying Linked Data
Querying Linked Data
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQL
 
2009 0807 Lod Gmod
2009 0807 Lod Gmod2009 0807 Lod Gmod
2009 0807 Lod Gmod
 
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)
 
Sparql a simple knowledge query
Sparql  a simple knowledge querySparql  a simple knowledge query
Sparql a simple knowledge query
 
SPARQL in the Semantic Web
SPARQL in the Semantic WebSPARQL in the Semantic Web
SPARQL in the Semantic Web
 
SPARQL Query Forms
SPARQL Query FormsSPARQL Query Forms
SPARQL Query Forms
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your Analytics
 
Tutorial Linked APIs
Tutorial Linked APIsTutorial Linked APIs
Tutorial Linked APIs
 
Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011Consuming Linked Data 4/5 Semtech2011
Consuming Linked Data 4/5 Semtech2011
 
XSPARQL CrEDIBLE workshop
XSPARQL CrEDIBLE workshopXSPARQL CrEDIBLE workshop
XSPARQL CrEDIBLE workshop
 
Re-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playoutRe-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playout
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelab
 
Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic web
 

More from Serge Garlatti

Seminaire campus lab
Seminaire campus labSeminaire campus lab
Seminaire campus lab
Serge Garlatti
 
ATIEF IA CIEP Février 2019
ATIEF IA CIEP Février 2019ATIEF IA CIEP Février 2019
ATIEF IA CIEP Février 2019
Serge Garlatti
 
Learning Analytics : entre Promesses et Réalité
Learning Analytics : entre Promesses et RéalitéLearning Analytics : entre Promesses et Réalité
Learning Analytics : entre Promesses et Réalité
Serge Garlatti
 
Non Standard Logics & Modal Logics
Non Standard Logics & Modal LogicsNon Standard Logics & Modal Logics
Non Standard Logics & Modal Logics
Serge Garlatti
 
Predicate Calculus
Predicate CalculusPredicate Calculus
Predicate Calculus
Serge Garlatti
 
Modal Logic
Modal LogicModal Logic
Modal Logic
Serge Garlatti
 
Du Calcul des prédicats vers Prolog
Du Calcul des prédicats vers PrologDu Calcul des prédicats vers Prolog
Du Calcul des prédicats vers Prolog
Serge Garlatti
 
Cours intro ia_2015_2016
Cours intro ia_2015_2016Cours intro ia_2015_2016
Cours intro ia_2015_2016
Serge Garlatti
 
Les ontologies 2014_2015
Les ontologies 2014_2015Les ontologies 2014_2015
Les ontologies 2014_2015
Serge Garlatti
 
Sens des donnees_2014_2015
Sens des donnees_2014_2015Sens des donnees_2014_2015
Sens des donnees_2014_2015
Serge Garlatti
 
Intelligence du _web_semantique_1_2014
Intelligence du _web_semantique_1_2014Intelligence du _web_semantique_1_2014
Intelligence du _web_semantique_1_2014Serge Garlatti
 
Les ontologies 2013_2014
Les ontologies 2013_2014Les ontologies 2013_2014
Les ontologies 2013_2014Serge Garlatti
 
Le web semantique_2013_2014
Le web semantique_2013_2014Le web semantique_2013_2014
Le web semantique_2013_2014Serge Garlatti
 
Scenario convergence 2013_2014
Scenario convergence 2013_2014Scenario convergence 2013_2014
Scenario convergence 2013_2014
Serge Garlatti
 
Intelligent google 02_2013
Intelligent google 02_2013Intelligent google 02_2013
Intelligent google 02_2013Serge Garlatti
 
Scenario Convergence SW+2.0+Pervasive
Scenario Convergence SW+2.0+PervasiveScenario Convergence SW+2.0+Pervasive
Scenario Convergence SW+2.0+PervasiveSerge Garlatti
 
Social web Ontologies
Social web OntologiesSocial web Ontologies
Social web Ontologies
Serge Garlatti
 

More from Serge Garlatti (20)

Seminaire campus lab
Seminaire campus labSeminaire campus lab
Seminaire campus lab
 
ATIEF IA CIEP Février 2019
ATIEF IA CIEP Février 2019ATIEF IA CIEP Février 2019
ATIEF IA CIEP Février 2019
 
Learning Analytics : entre Promesses et Réalité
Learning Analytics : entre Promesses et RéalitéLearning Analytics : entre Promesses et Réalité
Learning Analytics : entre Promesses et Réalité
 
Non Standard Logics & Modal Logics
Non Standard Logics & Modal LogicsNon Standard Logics & Modal Logics
Non Standard Logics & Modal Logics
 
Predicate Calculus
Predicate CalculusPredicate Calculus
Predicate Calculus
 
Modal Logic
Modal LogicModal Logic
Modal Logic
 
Du Calcul des prédicats vers Prolog
Du Calcul des prédicats vers PrologDu Calcul des prédicats vers Prolog
Du Calcul des prédicats vers Prolog
 
Cours intro ia_2015_2016
Cours intro ia_2015_2016Cours intro ia_2015_2016
Cours intro ia_2015_2016
 
Les ontologies 2014_2015
Les ontologies 2014_2015Les ontologies 2014_2015
Les ontologies 2014_2015
 
Sens des donnees_2014_2015
Sens des donnees_2014_2015Sens des donnees_2014_2015
Sens des donnees_2014_2015
 
Intelligence du _web_semantique_1_2014
Intelligence du _web_semantique_1_2014Intelligence du _web_semantique_1_2014
Intelligence du _web_semantique_1_2014
 
Les ontologies 2013_2014
Les ontologies 2013_2014Les ontologies 2013_2014
Les ontologies 2013_2014
 
Le web semantique_2013_2014
Le web semantique_2013_2014Le web semantique_2013_2014
Le web semantique_2013_2014
 
Scenario convergence 2013_2014
Scenario convergence 2013_2014Scenario convergence 2013_2014
Scenario convergence 2013_2014
 
Intelligent google 02_2013
Intelligent google 02_2013Intelligent google 02_2013
Intelligent google 02_2013
 
Intelligent google
Intelligent googleIntelligent google
Intelligent google
 
Scenario Convergence SW+2.0+Pervasive
Scenario Convergence SW+2.0+PervasiveScenario Convergence SW+2.0+Pervasive
Scenario Convergence SW+2.0+Pervasive
 
Sem info system_2012
Sem info system_2012Sem info system_2012
Sem info system_2012
 
Ontologies 2011 2012
Ontologies 2011 2012Ontologies 2011 2012
Ontologies 2011 2012
 
Social web Ontologies
Social web OntologiesSocial web Ontologies
Social web Ontologies
 

Recently uploaded

How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 

Recently uploaded (20)

How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 

Sparql

  • 1. SPARQL SPARQL Protocol and RDF Query Language S. Garlatti 16/01/14
  • 2. Outline  SPARQL page 2 Computer Science Department Semantic Web in Action
  • 3. SPARQL: SPARQL Protocol and RDF Query Language  SPARQL • pronounced "sparkle" [1]) is an RDF query language; its name is a recursive acronym that stands for SPARQL Protocol and RDF Query Language. It is standardized by the RDF Data Access Working Group (DAWG) of the World Wide Web Consortium, and is considered a component of the semantic web. • Initially released as a Candidate Recommendation in April 2006, but returned to Working Draft status in October 2006, due to two open issues. [2] In June 2007, SPARQL advanced to Candidate Recommendation once again. [3] On 12th November 2007 the status of SPARQL changed into Proposed Recommendation. [4] On 15th January 2008, SPARQL became an official W3C Recommendation. [5] page 3 Computer Science Department Semantic Web in Action
  • 4. SPARQL: SPARQL Protocol and RDF Query Language  SPARQL = • A Query Language • A Result Form • An Access Protocol page 4 Computer Science Department Linked Data & Social Web
  • 5. SPARQL: SPARQL Protocol and RDF Query Language  The Query Language: query forms • « Select » clause returns all or subset of the variables bound in a query pattern match • « Construct » returns an RDF graph constructed by substituting variables in a set of triple templates • « Ask » returns a boolean indicating whether a query pattern matches • « Describe » returns an RDF graph that describe the resources found page 5 Computer Science Department Linked Data & Social Web
  • 6. SPARQL: SPARQL Protocol and RDF Query Language « Select » equivalent to « SQL Select » returns a regular table Select … From … Identify data sources to query Where { … } The triple/graph pattern to be matched against the triple/graphs of RDF A conjunction of triples  PREFIX page 6 to declare the schema used in the query Computer Science Department Linked Data & Social Web
  • 7. SPARQL: SPARQL Protocol and RDF Query Language  PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name FROM <http://example.org/foaf/aliceFoaf> WHERE { ?x foaf:name ?name } Result: name « Alice » page 7 Computer Science Department Linked Data & Social Web
  • 8. SPARQL: SPARQL Protocol and RDF Query Language  PREFIX PREFIX PREFIX PREFIX foaf: <http://xmlns.com/foaf/0.1/> : <http://dbpedia.org/resource/> dbpedia2: <http://dbpedia.org/property/> dbpedia: <http://dbpedia.org/> SELECT distinct ?name ?birth ?person FROM <http://dbpedia.org/> WHERE  page 8 { ?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin>. ?person dbpedia2:birth ?birth . ?person foaf:name ?name . } Computer Science Department Semantic Web in Action
  • 9. SPARQL: SPARQL Protocol and RDF Query Language  SPARQL  results: namebirthperson« ":Dru_Berrymore/birth/birth_date_and_age :Dru_Berrymore "Dru Berrymore"@de:Dru_Berrymore/birth/birth_date_and_age :Dru_Berrymore "Walter Benjamin"@de:Berlin :Walter_Benjamin "Walter Benjamin"@de:Germany :Walter_Benjamin Name Birth « Dru Berrymore » page 9 Computer Science Department Semantic Web in Action Person
  • 10. SPARQL: SPARQL Protocol and RDF Query Language   page 10 SELECT distinct ?name ?person FROM <http://dbpedia.org/> WHERE { ?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin> . ?person foaf:name ?name . } SELECT distinct ?name ?birth ?death ?person FROM <http://dbpedia.org/> WHERE { ?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin> . ?person dbpedia2:birth ?birth . ?person foaf:name ?name . ?person dbpedia2:death ?death. } Computer Science Department Semantic Web in Action
  • 11. SPARQL: SPARQL Protocol and RDF Query Language A constraint, expressed by the keyword “FILTER”, is a restriction on solutions over the whole group in which the filter appears  PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX ns: <http://example.org/ns#> SELECT ?title ?price WHERE { ?x ns:price ?price . FILTER (?price < 30.5) ?x dc:title ?title . } page 11 Computer Science Department Linked Data & Social Web
  • 12. SPARQL: SPARQL Protocol and RDF Query Language  “regex” matches only plain literals with no language tag   page 12 { ?x foaf:name ?name . ?x foaf:mbox ?mbox . FILTER regex(?name, "Smith") } PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?title WHERE { ?x dc:title ?title FILTER regex(?title, "web", "i" ) } Computer Science Department Linked Data & Social Web
  • 13. SPARQL: SPARQL Protocol and RDF Query Language  Optional parts of the graph pattern may be specified syntactically with the “OPTIONAL” keyword applied to a graph pattern  page 13 SELECT distinct ?name ?birth ?death ?person FROM <http://dbpedia.org/> WHERE { ?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin> . ?person dbpedia2:birth ?birth . ?person foaf:name ?name . OPTIONAL {?person dbpedia2:death ?death} } Computer Science Department Linked Data & Social Web
  • 14. SPARQL: SPARQL Protocol and RDF Query Language  Matching alternative • Pattern alternatives are syntactically specified with the  UNION keyword  SELECT distinct ?name ?birth ?death ?person WHERE { {?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin> } UNION {?person dbpedia2:death ?death} ?person foaf:name ?name . ?person dbpedia2:birth ?birth . } page 14 Computer Science Department Linked Data & Social Web
  • 15. SPARQL: SPARQL Protocol and RDF Query Language  Sequence & Modify • « Order By » to sort,  • « LIMIT » result number,  • « OFFSET » rank of first result  SELECT distinct ?name ?person WHERE { ?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin>. ?person foaf:name ?name. } ORDER BY ?name LIMIT 20 OFFSET 20 page 15 Computer Science Department Linked Data & Social Web
  • 16. SPARQL: SPARQL Protocol and RDF Query Language « Construct » • The CONSTRUCT query form returns a single RDF  graph specified by a graph template.  - The result is an RDF graph formed by taking each query  solution in the solution sequence, substituting for the  variables in the graph template, and combining the triples into  a single RDF graph by set union. • Useful for aggregating data from multiple sources  and merging it into a local store (from Ingenta) page 16 Computer Science Department Linked Data & Social Web
  • 17. SPARQL: SPARQL Protocol and RDF Query Language  PREFIX foaf: <http://xmlns.com/foaf/0.1/> FROM <http://molene.enstb.org/mlearning09/wpcontent/plugins/wp-rdfa/foaf.php CONSTRUCT { ?friend a foaf:Person; foaf:name ?name; foaf:homepage ?home.} WHERE { ?person foaf:mbox <mailto:ac@enstb.com>; foaf:knows ?friend. ?friend foaf:name ?name; foaf:homepage ?home.} page 17 Computer Science Department Linked Data & Social Web
  • 18. SPARQL: SPARQL Protocol and RDF Query Language  ASK • Returns a true/false value: test whether or not a query pattern  has a solution.  • No information is returned about the possible query solutions,  just whether or not a solution exists • Is there data that looks like this? Do you have any information  about that? (from Ingenta)  page 18 PREFIX foaf: <http://xmlns.com/foaf/0.1/> ASK WHERE { ?person a foaf:Person; foaf:mbox <mailto:ab@telecom-bretagne>. } Computer Science Department Semantic Web in Action
  • 19. SPARQL: SPARQL Protocol and RDF Query Language  DESCRIBE • The DESCRIBE form returns a single result RDF  graph containing RDF data about resources. • CONSTRUCT but with less control - Tell me about this or things that look like this … but you decide what’s relevant (from Ingenta)  PREFIX foaf: <http://xmlns.com/foaf/0.1/> DESCRIBE ?friend WHERE { ?person foaf:mbox “mailto:ab@telecom-bretagne”; foaf:knows ?friend.} page 19 Computer Science Department Semantic Web in Action
  • 20. SPARQL: SPARQL Protocol and RDF Query Language  Applied uses (from Ingenta) • DESCRIBE for Prototyping - DESCRIBE <http://example.org/someResource> - Quickly assembling Uis, Web APIs • SELECT for Indexing - Building an ordering over some data ORDER BY, LIMIT page 20 Computer Science Department Semantic Web in Action
  • 21. SPARQL: SPARQL Protocol and RDF Query Language  Applied uses (from Ingenta) • CONSTRUCT for transformation and also simple  inferencing - CONSTRUCT could be the XSLT of RDF - Currently limited by lack of expressions in CONSTRUCT  triple templates • ASK for validation • ASK – DESCRIBE – CONSTRUCT Pattern:  - Probe endpoint, Grab default view of data, Refine data extraction and/or  apply transformation page 21 Computer Science Department Semantic Web in Action
  • 22. SPARQL: SPARQL Protocol and RDF Query Language  SPARQL Protocol (from F. Gandon, INRIA) • 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 page 22 Computer Science Department Semantic Web in Action
  • 23. SPARQL: SPARQL Protocol and RDF Query Language  Example  with SOAP binding (from F. Gandon) <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <query-request xmlns="http://www.w3.org/2005/09/sparqlprotocol-types/#"> <query> SELECT ?x ?p ?y WHERE {?x ?p ?y} </query> </query-request> </soapenv:Body> </soapenv:Envelope> page 23 Computer Science Department Semantic Web in Action
  • 24. SPARQL: SPARQL Protocol and RDF Query Language  Access to Data on the web • http://dbpedia.org/snorql/ • http://dbpedia.org/sparql • http://demo.openlinksw.com/rdfbrowser2/ • http://dataviewer.zitgist.com/ • Etc.  Twinkle : a sparql query tool • http://www.ldodds.com/projects/twinkle page 24 Computer Science Department Linked Data & Social Web
  • 25. SPARQL: SPARQL Protocol and RDF Query Language  Resources • http://en.wikipedia.org/wiki/SPARQL • http://www.w3.org/TR/rdf-sparql-query/ • http://jena.sourceforge.net/ARQ/Tutorial/ • http://esw.w3.org/topic/SparqlImplementations • http://arc.semsol.org/home • http://virtuoso.openlinksw.com/wiki/main/Main/ page 25 Computer Science Department Semantic Web in Action