SlideShare a Scribd company logo
SPARQL Query Language for RDF Cluj Semantic WEB meetup http://www.meetup.com/Cluj-Semantic-WEB/ presented by  Dia MIRON 17 May 2011
Introduction - SPARQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SPARQL – a first example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SPARQL General Form ORDER BY, DISTINCT  etc (Modifiers) e.g. ORDER BY ?name WHERE  (Query Triple Pattern) e.g. WHERE { ?planttype plant:planttype ?name } FROM  (Data Set) e.g. FROM <http://www.linkeddatatools.com/plantsdata/plants.rdf> SELECT  (Result Set) e.q. SELECT ?name PREFIX  (Namespace Prefixes) e.g. PREFIX plant:<http://www.linkeddatatools.com/plants>
Data set Example: triple data containing a variety of shrubs and plants, and their family names
Select All Data ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
And the results are… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],29.         <binding name=&quot;family&quot;> 30.            <literal>Aralianae</literal> 31.         </binding> 32.      </result> 33.      <result> 34.         <binding name=&quot;name&quot;> 35.            <uri>http://www.linkeddatatools.com/plants#velvetleaf</uri> 36.         </binding> 37.         <binding name=&quot;family&quot;> 38.            <literal>Malvaceae</literal> 39.         </binding> 40.      </result> 41.      <result> 42.         <binding name=&quot;name&quot;> 43.            <uri>http://www.linkeddatatools.com/plants#manglietia</uri> 44.         </binding> 45.         <binding name=&quot;family&quot;> 46.            <literal>Magnoliaceae</literal> 47.         </binding> 48.      </result> 49.   </results> 50.</sparql>
A more specific query ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What About CREATE, INSERT, UPDATE? ,[object Object],[object Object],[object Object]
Basic Graph Pattern  - Multiple Matches Group Graph Pattern  (set of graph patterns) also! Data Query Query Result PREFIX foaf: <http://xmlns.com/foaf/0.1/>  SELECT ?name ?mbox  WHERE  { ?x foaf:name ?name .  ?x foaf:mbox ?mbox }   @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Johnny Lee Outlaw&quot; .  _:a foaf:mbox <mailto:jlow@example.com> .  _:b foaf:name &quot;Peter Goodguy&quot; .  _:b foaf:mbox <mailto:peter@example.org> . <mailto:peter@example.org> &quot;Peter Goodguy&quot; <mailto:jlow@example.com> &quot;Johnny Lee Outlaw&quot; mbox name
Basic Graph Pattern  - Blank Nodes Data Query Query Result PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?x ?name  WHERE { ?x foaf:name ?name }  @prefix foaf: <http://xmlns.com/foaf/0.1/> .  _:a foaf:name &quot;Alice&quot; .  _:b foaf:name &quot;Bob&quot; .  “ Bob” _:d “ Alice“ _:c name x
Value Constraints Data Query Query Result 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 .  ?x dc:title ?title . }  @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix : <http://example.org/book/> . @prefix ns: <http://example.org/ns#> .  :book1 dc:title &quot;SPARQL Tutorial&quot; .  :book1 ns:price 42 .  :book2 dc:title &quot;The Semantic Web&quot; .  :book2 ns:price 23  .  23 &quot;The Semantic Web&quot;  price title
Optional graph patterns Data Query Query Result PREFIX dc: <http://purl.org/dc/elements/1.1/>  PREFIX ns: <http://example.org/ns#>  SELECT ?title ?price  WHERE { ?x dc:title ?title .  OPTIONAL { ?x ns:price ?price .  FILTER ?price < 30 }} @prefix dc: <http://purl.org/dc/elements/1.1/> .  @prefix : <http://example.org/book/> . @prefix ns: <http://example.org/ns#> .  :book1 dc:title &quot;SPARQL Tutorial&quot; .  :book1 ns:price 42 .  :book2 dc:title &quot;The Semantic Web&quot; . :book2 ns:price 23  .  “ SPARQL Tutorial“ 23 &quot;The Semantic Web&quot;  price title
Multiple Optional Blocks Data Query Query Result PREFIX foaf: <http://xmlns.com/foaf/0.1/>  SELECT ?name ?mbox ?hpage  WHERE { ?x foaf:name ?name .  OPTIONAL { ?x foaf:mbox ?mbox }.  OPTIONAL { ?x foaf:homepage ?hpage } }  @prefix foaf: <http://xmlns.com/foaf/0.1/> .  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .  _:a foaf:name &quot;Alice&quot; .  _:a foaf:homepage <http://work.example.org/alice/> .  _:b foaf:name &quot;Bob&quot; .  _:b foaf:mbox <mailto:bob@work.example> .  <mailto:bob@example.com>  “ Bob“ <http://work.example.org/alice/>  “ Alice“ hpage Mbox name
Alternative Graph Patterns Data Query Query Result PREFIX dc10: <http://purl.org/dc/elements/1.0/>  PREFIX dc11: <http://purl.org/dc/elements/1.1/> SELECT ?x ?y  WHERE { { ?book dc10:title ?x } UNION { ?book dc11:title ?y } }  @prefix dc10: <http://purl.org/dc/elements/1.0/> . @prefix dc11: <http://purl.org/dc/elements/1.1/> .  _:a dc10:title &quot;SPARQL Query Language Tutorial&quot; .  _:b dc11:title &quot;SPARQL Protocol Tutorial&quot; .  _:c dc10:title &quot;SPARQL&quot; .  _:c dc11:title &quot;SPARQL (updated)&quot; .  y x &quot;SPARQL (updated)&quot;  &quot;SPARQL Query Language Tutorial&quot;  &quot;SPARQL&quot;  &quot;SPARQL Protocol Tutorial&quot;
RDF Dataset ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
RDF Dataset- T he Relationship between Named and Background Graphs (I) #  Background graph   @prefix dc: <http://purl.org/dc/elements/1.1/> .  <http://example.org/bob> dc:publisher &quot;Bob&quot; .  <http://example.org/alice> dc:publisher &quot;Alice&quot; .  #  Graph: http://example.org/bob   @prefix foaf: <http://xmlns.com/foaf/0.1/> .  _:a foaf:name &quot;Bob&quot; .  _:a foaf:mbox <mailto:bob@oldcorp.example.org> . #  Graph: http://example.org/alice   @prefix foaf: <http://xmlns.com/foaf/0.1/> .  _:a foaf:name &quot;Alice&quot; .  _:a foaf:mbox <mailto:alice@work.example.org>  .
RDF Dataset- T he Relationship between Named and Background Graphs (II) #  Background graph   @prefix foaf: <http://xmlns.com/foaf/0.1/>   .  _:x foaf:name &quot;Bob&quot; .  _:x foaf:mbox <mailto:bob@oldcorp.example.org> . _:y foaf:name &quot;Alice&quot; .  _:y foaf:mbox <mailto:alice@work.example.org> .  #  Graph: http://example.org/bob   @prefix foaf: <http://xmlns.com/foaf/0.1/> .  _:a foaf:name &quot;Bob&quot; .  _:a foaf:mbox <mailto:bob@oldcorp.example.org> . #  Graph: http://example.org/alice   @prefix foaf: <http://xmlns.com/foaf/0.1/> .  _:a foaf:name &quot;Alice&quot; .  _:a foaf:mbox <mailto:alice@work.example.org>  .
Querying the Dataset # Graph: http://example.org/foaf/aliceFoaf  @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .  @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .  _:a foaf:name &quot;Alice&quot; .  _:a foaf:mbox <mailto:alice@work.example> .  _:a foaf:knows _:b .  _:b rdfs:seeAlso <http://example.org/foaf/bobFoaf> .  <http://example.org/foaf/bobFoaf> rdf:type foaf:PersonalProfileDocument .  _:b foaf:name &quot;Bob&quot; .  _:b foaf:mbox <mailto:bob@work.example> .  _:b foaf:age 32 .  # Graph: http://example.org/foaf/bobFoaf  @prefix foaf: <http://xmlns.com/foaf/0.1/> .  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .  @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:1 foaf:mbox <mailto:bob@work.example> . _:1 rdfs:seeAlso <http://example.org/foaf/bobFoaf> .  _:1 foaf:age 35 .  <http://example.org/foaf/bobFoaf> rdf:type foaf:PersonalProfileDocument .
Querying the Dataset  - Accessing Graph Labels PREFIX foaf: <http://xmlns.com/foaf/0.1/>  SELECT ?src ?bobAge  WHERE { GRAPH ?src  { ?x foaf:mbox <mailto:bob@work.example> .  ?x foaf:age ?bobAge } } 35  <http://example.org/foaf/bobFoaf>  32  <http://example.org/foaf/aliceFoaf>  bobAge src
Querying the Dataset  -  Restricting by Graph Label  PREFIX foaf: <http://xmlns.com/foaf/0.1/>  PREFIX data: <http://example.org/foaf/>  SELECT ?age  WHERE  { GRAPH data:bobFoaf  {  ?x foaf:mbox <mailto:bob@work.example> .  ?x foaf:age ?age  }  } 35 age
Querying the Dataset  -  Restricting via Query Pattern  PREFIX data: <http://example.org/foaf/>  PREFIX foaf: <http://xmlns.com/foaf/0.1/>  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>  SELECT ?mbox ?age ?ppd  WHERE  { GRAPH data:aliceFoaf  { ?alice foaf:mbox <mailto:alice@work.example> ; foaf:knows ?whom .  ?whom foaf:mbox ?mbox ;  rdfs:seeAlso ?ppd .  ?ppd a foaf:PersonalProfileDocument . } .  GRAPH ?ppd { ?w foaf:mbox ?mbox ;  foaf:age ?age } }  <http://example.org/foaf/bobFoaf>  35  <mailto:bob@work.example>  ppd age mbox
Query Execution and Ordering  ,[object Object],[object Object],[object Object]
Query forms:   ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CONSTRUCT Examples(I) PREFIX foaf: <http://xmlns.com/foaf/0.1/>  PREFIX vcard: <http://www.w3.org/2001/vcard-rdf/3.0#>  CONSTRUCT { <http://example.org/person#Alice> vcard:FN ?name }  WHERE { ?x foaf:name ?name }  @prefix foaf: <http://xmlns.com/foaf/0.1/> .  _:a foaf:name &quot;Alice&quot; . _:a foaf:mbox <mailto:alice@example.org> . @prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#>. <http://example.org/person#Alice> vcard:FN &quot;Alice&quot; . #extracting a whole graph from the target RDF dataset CONSTRUCT { ?s ?p ?o }  WHERE { GRAPH <http://example.org/myGraph> { ?s ?p ?o } . }
CONSTRUCT Examples(II) accesing a graph conditional on other information contained in the metadata about named graphs in the dataset PREFIX dc: <http://purl.org/dc/elements/1.1/>  PREFIX app: <http://example.org/ns#>  CONSTRUCT { ?s ?p ?o }  WHERE { GRAPH ?g { ?s ?p ?o } .  { ?g dc:publisher <http://www.w3.org/> } .  { ?g dc:date ?date } .  FILTER app:myDate(?date) > &quot;2005-02-8T00:00:00Z&quot;^^xsd:dateTime.  }
DESCRIBE PREFIX ent: <http://myorg.example/employees#> DESCRIBE ?x WHERE { ?x ent:employeeId &quot;1234&quot; }  @prefix foaf: <http://xmlns.com/foaf/0.1/> .  @prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0> .  @prefix myOrg: <http://myorg.example/employees#> . _:a myOrg:employeeId &quot;1234&quot; ;  foaf:mbox_sha1sum &quot;ABCD1234&quot; ;  vcard:N [ vcard:Family &quot;Smith&quot; ;  vcard:Given &quot;John&quot; ] .  foaf:mbox_sha1sum rdf:type owl:InverseFunctionalProperty .
ASK @prefix foaf: <http://xmlns.com/foaf/0.1/> .  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .  _:a foaf:name &quot;Alice&quot; .  _:a foaf:homepage <http://work.example.org/alice/> .  _:b foaf:name &quot;Bob&quot; .  _:b foaf:mbox <mailto:bob@work.example> . PREFIX foaf: <http://xmlns.com/foaf/0.1/>  ASK { ?x foaf:name &quot;Alice&quot; } .
Testing Values ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Support for SPARQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Contact ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)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 1.1 Status
SPARQL 1.1 StatusSPARQL 1.1 Status
SPARQL 1.1 Status
LeeFeigenbaum
 
Graph Data -- RDF and Property Graphs
Graph Data -- RDF and Property GraphsGraph Data -- RDF and Property Graphs
Graph Data -- RDF and Property Graphs
andyseaborne
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaKatrien Verbert
 
RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031
kwangsub kim
 
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
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
andyseaborne
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Aidan's PhD Viva
Aidan's PhD VivaAidan's PhD Viva
Aidan's PhD Viva
Aidan Hogan
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapes
Jose Emilio Labra Gayo
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
Jose Emilio Labra Gayo
 
Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1net2-project
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02eswcsummerschool
 
SWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingSWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingMariano Rodriguez-Muro
 
Getty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic RepresentationGetty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic Representation
Vladimir Alexiev, PhD, PMP
 

What's hot (20)

SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)
 
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
 
SPARQL 1.1 Status
SPARQL 1.1 StatusSPARQL 1.1 Status
SPARQL 1.1 Status
 
Graph Data -- RDF and Property Graphs
Graph Data -- RDF and Property GraphsGraph Data -- RDF and Property Graphs
Graph Data -- RDF and Property Graphs
 
WebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPediaWebTech Tutorial Querying DBPedia
WebTech Tutorial Querying DBPedia
 
4 sw architectures and sparql
4 sw architectures and sparql4 sw architectures and sparql
4 sw architectures and sparql
 
RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031RDF Tutorial - SPARQL 20091031
RDF Tutorial - SPARQL 20091031
 
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
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Aidan's PhD Viva
Aidan's PhD VivaAidan's PhD Viva
Aidan's PhD Viva
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapes
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
 
Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1
 
SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1SWT Lecture Session 10 R2RML Part 1
SWT Lecture Session 10 R2RML Part 1
 
SWT Lecture Session 3 - SPARQL
SWT Lecture Session 3 - SPARQLSWT Lecture Session 3 - SPARQL
SWT Lecture Session 3 - SPARQL
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02
 
SWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mappingSWT Lecture Session 9 - RDB2RDF direct mapping
SWT Lecture Session 9 - RDB2RDF direct mapping
 
Getty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic RepresentationGetty Vocabulary Program LOD: Ontologies and Semantic Representation
Getty Vocabulary Program LOD: Ontologies and Semantic Representation
 
SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2SWT Lecture Session 11 - R2RML part 2
SWT Lecture Session 11 - R2RML part 2
 

Viewers also liked

[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond
Carles Farré
 
New Yarns and Funny Jokes
New Yarns and Funny JokesNew Yarns and Funny Jokes
New Yarns and Funny Jokes
Chuck Thompson
 
Trafiklab Meetup 20161206
Trafiklab Meetup 20161206Trafiklab Meetup 20161206
Trafiklab Meetup 20161206
Elias Arnestrand
 
malagigi
malagigimalagigi
malagigiuokko
 
Salute e scuola
Salute e scuolaSalute e scuola
Salute e scuolasepulvi
 
Brachyura
BrachyuraBrachyura
Brachyura
Muhammad Shafi
 
Meducate® GI Patient Education Brochures
Meducate® GI Patient Education BrochuresMeducate® GI Patient Education Brochures
Meducate® GI Patient Education Brochures
GI Supply
 
08 newton's law of motion
08 newton's law of motion08 newton's law of motion
08 newton's law of motionIZZUDIN IBRAHIM
 
Mandible # brief
Mandible # brief Mandible # brief
Mandible # brief
Jyothish krishna
 
Mangan i hrom
Mangan i hrom Mangan i hrom
Mangan i hrom vukpro97
 
Guia de_derecho_romano
Guia  de_derecho_romanoGuia  de_derecho_romano
Guia de_derecho_romanoMariana Muñoz
 
Malingering and how to spot it
Malingering and how to spot itMalingering and how to spot it
Malingering and how to spot it
Nelson Hendler
 
carnivora dan proboscidea
carnivora dan proboscidea carnivora dan proboscidea
carnivora dan proboscidea
Aka Tedi Nurwalidin
 
Parní lokomotivy čsd
Parní lokomotivy čsdParní lokomotivy čsd
Parní lokomotivy čsdcorvik
 
Te Reo o Ngatihine
Te Reo o NgatihineTe Reo o Ngatihine
Te Reo o Ngatihine
kiamataara
 
MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...
MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...
MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...
Maghrenov
 
Subphylum mandibulata (By: J.Q)
Subphylum mandibulata (By: J.Q)Subphylum mandibulata (By: J.Q)
Subphylum mandibulata (By: J.Q)
Josefino Quieta
 
Martensitic stainless steel
Martensitic stainless steel Martensitic stainless steel
Martensitic stainless steel
thiru1mech
 
E-nano Newsletter 32
E-nano Newsletter 32E-nano Newsletter 32
E-nano Newsletter 32
Phantoms Foundation
 

Viewers also liked (20)

SQL2SPARQL
SQL2SPARQLSQL2SPARQL
SQL2SPARQL
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond
 
New Yarns and Funny Jokes
New Yarns and Funny JokesNew Yarns and Funny Jokes
New Yarns and Funny Jokes
 
Trafiklab Meetup 20161206
Trafiklab Meetup 20161206Trafiklab Meetup 20161206
Trafiklab Meetup 20161206
 
malagigi
malagigimalagigi
malagigi
 
Salute e scuola
Salute e scuolaSalute e scuola
Salute e scuola
 
Brachyura
BrachyuraBrachyura
Brachyura
 
Meducate® GI Patient Education Brochures
Meducate® GI Patient Education BrochuresMeducate® GI Patient Education Brochures
Meducate® GI Patient Education Brochures
 
08 newton's law of motion
08 newton's law of motion08 newton's law of motion
08 newton's law of motion
 
Mandible # brief
Mandible # brief Mandible # brief
Mandible # brief
 
Mangan i hrom
Mangan i hrom Mangan i hrom
Mangan i hrom
 
Guia de_derecho_romano
Guia  de_derecho_romanoGuia  de_derecho_romano
Guia de_derecho_romano
 
Malingering and how to spot it
Malingering and how to spot itMalingering and how to spot it
Malingering and how to spot it
 
carnivora dan proboscidea
carnivora dan proboscidea carnivora dan proboscidea
carnivora dan proboscidea
 
Parní lokomotivy čsd
Parní lokomotivy čsdParní lokomotivy čsd
Parní lokomotivy čsd
 
Te Reo o Ngatihine
Te Reo o NgatihineTe Reo o Ngatihine
Te Reo o Ngatihine
 
MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...
MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...
MAGHRENOV deliverable 2.1: Roadmap of an EU-MPC entrepreneurial education pro...
 
Subphylum mandibulata (By: J.Q)
Subphylum mandibulata (By: J.Q)Subphylum mandibulata (By: J.Q)
Subphylum mandibulata (By: J.Q)
 
Martensitic stainless steel
Martensitic stainless steel Martensitic stainless steel
Martensitic stainless steel
 
E-nano Newsletter 32
E-nano Newsletter 32E-nano Newsletter 32
E-nano Newsletter 32
 

Similar to From SQL to SPARQL

The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
Myungjin Lee
 
Creating APIs over RDF
Creating APIs over RDFCreating APIs over RDF
Creating APIs over RDFLeigh Dodds
 
Creating APIs over RDF
Creating APIs over RDFCreating APIs over RDF
Creating APIs over RDFLeigh Dodds
 
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
 
Gist od2-feb-2011
Gist od2-feb-2011Gist od2-feb-2011
Gist od2-feb-2011
ianibbo
 
Exploiter le Web Semantic, le comprendre et y contribuer
Exploiter le Web Semantic, le comprendre et y contribuerExploiter le Web Semantic, le comprendre et y contribuer
Exploiter le Web Semantic, le comprendre et y contribuer
Mathieu d'Aquin
 
Building linked data apps
Building linked data appsBuilding linked data apps
Building linked data apps
Henk Jurriens
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Creating Linked Data 2/5 Semtech2011
Creating Linked Data 2/5 Semtech2011Creating Linked Data 2/5 Semtech2011
Creating Linked Data 2/5 Semtech2011Juan Sequeda
 
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
Israeli Internet Association technology committee
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
hardchiu
 
Web 3 0
Web 3 0Web 3 0
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 SPARQLEmanuele Della Valle
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIsJosef Petrák
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Pedro Szekely
 
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
 
The Web, one huge database ...
The Web, one huge database ...The Web, one huge database ...
The Web, one huge database ...
Michael Hausenblas
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web ServicesLorna Mitchell
 

Similar to From SQL to SPARQL (20)

The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
 
Creating APIs over RDF
Creating APIs over RDFCreating APIs over RDF
Creating APIs over RDF
 
Creating APIs over RDF
Creating APIs over RDFCreating APIs over RDF
Creating APIs over RDF
 
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
 
Gist od2-feb-2011
Gist od2-feb-2011Gist od2-feb-2011
Gist od2-feb-2011
 
Exploiter le Web Semantic, le comprendre et y contribuer
Exploiter le Web Semantic, le comprendre et y contribuerExploiter le Web Semantic, le comprendre et y contribuer
Exploiter le Web Semantic, le comprendre et y contribuer
 
Building linked data apps
Building linked data appsBuilding linked data apps
Building linked data apps
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Creating Linked Data 2/5 Semtech2011
Creating Linked Data 2/5 Semtech2011Creating Linked Data 2/5 Semtech2011
Creating Linked Data 2/5 Semtech2011
 
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
W3 C Specification For Interoperability And Accessibility For Ajax, Dhtml, Xm...
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
 
Web 3 0
Web 3 0Web 3 0
Web 3 0
 
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
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP Lecture 3 - Comm Lab: Web @ ITP
Lecture 3 - Comm Lab: Web @ ITP
 
The Web, one huge database ...
The Web, one huge database ...The Web, one huge database ...
The Web, one huge database ...
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
 

Recently uploaded

Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Newntide latest company Introduction.pdf
Newntide latest company Introduction.pdfNewntide latest company Introduction.pdf
Newntide latest company Introduction.pdf
LucyLuo36
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 

Recently uploaded (20)

Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Newntide latest company Introduction.pdf
Newntide latest company Introduction.pdfNewntide latest company Introduction.pdf
Newntide latest company Introduction.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 

From SQL to SPARQL

  • 1. SPARQL Query Language for RDF Cluj Semantic WEB meetup http://www.meetup.com/Cluj-Semantic-WEB/ presented by Dia MIRON 17 May 2011
  • 2.
  • 3.
  • 4. SPARQL General Form ORDER BY, DISTINCT etc (Modifiers) e.g. ORDER BY ?name WHERE (Query Triple Pattern) e.g. WHERE { ?planttype plant:planttype ?name } FROM (Data Set) e.g. FROM <http://www.linkeddatatools.com/plantsdata/plants.rdf> SELECT (Result Set) e.q. SELECT ?name PREFIX (Namespace Prefixes) e.g. PREFIX plant:<http://www.linkeddatatools.com/plants>
  • 5. Data set Example: triple data containing a variety of shrubs and plants, and their family names
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Basic Graph Pattern - Multiple Matches Group Graph Pattern (set of graph patterns) also! Data Query Query Result PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . ?x foaf:mbox ?mbox } @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Johnny Lee Outlaw&quot; . _:a foaf:mbox <mailto:jlow@example.com> . _:b foaf:name &quot;Peter Goodguy&quot; . _:b foaf:mbox <mailto:peter@example.org> . <mailto:peter@example.org> &quot;Peter Goodguy&quot; <mailto:jlow@example.com> &quot;Johnny Lee Outlaw&quot; mbox name
  • 11. Basic Graph Pattern - Blank Nodes Data Query Query Result PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?x ?name WHERE { ?x foaf:name ?name } @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Alice&quot; . _:b foaf:name &quot;Bob&quot; . “ Bob” _:d “ Alice“ _:c name x
  • 12. Value Constraints Data Query Query Result 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 . ?x dc:title ?title . } @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix : <http://example.org/book/> . @prefix ns: <http://example.org/ns#> . :book1 dc:title &quot;SPARQL Tutorial&quot; . :book1 ns:price 42 . :book2 dc:title &quot;The Semantic Web&quot; . :book2 ns:price 23 . 23 &quot;The Semantic Web&quot; price title
  • 13. Optional graph patterns Data Query Query Result PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX ns: <http://example.org/ns#> SELECT ?title ?price WHERE { ?x dc:title ?title . OPTIONAL { ?x ns:price ?price . FILTER ?price < 30 }} @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix : <http://example.org/book/> . @prefix ns: <http://example.org/ns#> . :book1 dc:title &quot;SPARQL Tutorial&quot; . :book1 ns:price 42 . :book2 dc:title &quot;The Semantic Web&quot; . :book2 ns:price 23 . “ SPARQL Tutorial“ 23 &quot;The Semantic Web&quot; price title
  • 14. Multiple Optional Blocks Data Query Query Result PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox ?hpage WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox }. OPTIONAL { ?x foaf:homepage ?hpage } } @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:a foaf:name &quot;Alice&quot; . _:a foaf:homepage <http://work.example.org/alice/> . _:b foaf:name &quot;Bob&quot; . _:b foaf:mbox <mailto:bob@work.example> . <mailto:bob@example.com> “ Bob“ <http://work.example.org/alice/> “ Alice“ hpage Mbox name
  • 15. Alternative Graph Patterns Data Query Query Result PREFIX dc10: <http://purl.org/dc/elements/1.0/> PREFIX dc11: <http://purl.org/dc/elements/1.1/> SELECT ?x ?y WHERE { { ?book dc10:title ?x } UNION { ?book dc11:title ?y } } @prefix dc10: <http://purl.org/dc/elements/1.0/> . @prefix dc11: <http://purl.org/dc/elements/1.1/> . _:a dc10:title &quot;SPARQL Query Language Tutorial&quot; . _:b dc11:title &quot;SPARQL Protocol Tutorial&quot; . _:c dc10:title &quot;SPARQL&quot; . _:c dc11:title &quot;SPARQL (updated)&quot; . y x &quot;SPARQL (updated)&quot; &quot;SPARQL Query Language Tutorial&quot; &quot;SPARQL&quot; &quot;SPARQL Protocol Tutorial&quot;
  • 16.
  • 17. RDF Dataset- T he Relationship between Named and Background Graphs (I) # Background graph @prefix dc: <http://purl.org/dc/elements/1.1/> . <http://example.org/bob> dc:publisher &quot;Bob&quot; . <http://example.org/alice> dc:publisher &quot;Alice&quot; . # Graph: http://example.org/bob @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Bob&quot; . _:a foaf:mbox <mailto:bob@oldcorp.example.org> . # Graph: http://example.org/alice @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Alice&quot; . _:a foaf:mbox <mailto:alice@work.example.org> .
  • 18. RDF Dataset- T he Relationship between Named and Background Graphs (II) # Background graph @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:x foaf:name &quot;Bob&quot; . _:x foaf:mbox <mailto:bob@oldcorp.example.org> . _:y foaf:name &quot;Alice&quot; . _:y foaf:mbox <mailto:alice@work.example.org> . # Graph: http://example.org/bob @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Bob&quot; . _:a foaf:mbox <mailto:bob@oldcorp.example.org> . # Graph: http://example.org/alice @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Alice&quot; . _:a foaf:mbox <mailto:alice@work.example.org> .
  • 19. Querying the Dataset # Graph: http://example.org/foaf/aliceFoaf @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:a foaf:name &quot;Alice&quot; . _:a foaf:mbox <mailto:alice@work.example> . _:a foaf:knows _:b . _:b rdfs:seeAlso <http://example.org/foaf/bobFoaf> . <http://example.org/foaf/bobFoaf> rdf:type foaf:PersonalProfileDocument . _:b foaf:name &quot;Bob&quot; . _:b foaf:mbox <mailto:bob@work.example> . _:b foaf:age 32 . # Graph: http://example.org/foaf/bobFoaf @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:1 foaf:mbox <mailto:bob@work.example> . _:1 rdfs:seeAlso <http://example.org/foaf/bobFoaf> . _:1 foaf:age 35 . <http://example.org/foaf/bobFoaf> rdf:type foaf:PersonalProfileDocument .
  • 20. Querying the Dataset - Accessing Graph Labels PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?src ?bobAge WHERE { GRAPH ?src { ?x foaf:mbox <mailto:bob@work.example> . ?x foaf:age ?bobAge } } 35 <http://example.org/foaf/bobFoaf> 32 <http://example.org/foaf/aliceFoaf> bobAge src
  • 21. Querying the Dataset - Restricting by Graph Label PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX data: <http://example.org/foaf/> SELECT ?age WHERE { GRAPH data:bobFoaf { ?x foaf:mbox <mailto:bob@work.example> . ?x foaf:age ?age } } 35 age
  • 22. Querying the Dataset - Restricting via Query Pattern PREFIX data: <http://example.org/foaf/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?mbox ?age ?ppd WHERE { GRAPH data:aliceFoaf { ?alice foaf:mbox <mailto:alice@work.example> ; foaf:knows ?whom . ?whom foaf:mbox ?mbox ; rdfs:seeAlso ?ppd . ?ppd a foaf:PersonalProfileDocument . } . GRAPH ?ppd { ?w foaf:mbox ?mbox ; foaf:age ?age } } <http://example.org/foaf/bobFoaf> 35 <mailto:bob@work.example> ppd age mbox
  • 23.
  • 24.
  • 25. CONSTRUCT Examples(I) PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> CONSTRUCT { <http://example.org/person#Alice> vcard:FN ?name } WHERE { ?x foaf:name ?name } @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name &quot;Alice&quot; . _:a foaf:mbox <mailto:alice@example.org> . @prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#>. <http://example.org/person#Alice> vcard:FN &quot;Alice&quot; . #extracting a whole graph from the target RDF dataset CONSTRUCT { ?s ?p ?o } WHERE { GRAPH <http://example.org/myGraph> { ?s ?p ?o } . }
  • 26. CONSTRUCT Examples(II) accesing a graph conditional on other information contained in the metadata about named graphs in the dataset PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX app: <http://example.org/ns#> CONSTRUCT { ?s ?p ?o } WHERE { GRAPH ?g { ?s ?p ?o } . { ?g dc:publisher <http://www.w3.org/> } . { ?g dc:date ?date } . FILTER app:myDate(?date) > &quot;2005-02-8T00:00:00Z&quot;^^xsd:dateTime. }
  • 27. DESCRIBE PREFIX ent: <http://myorg.example/employees#> DESCRIBE ?x WHERE { ?x ent:employeeId &quot;1234&quot; } @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0> . @prefix myOrg: <http://myorg.example/employees#> . _:a myOrg:employeeId &quot;1234&quot; ; foaf:mbox_sha1sum &quot;ABCD1234&quot; ; vcard:N [ vcard:Family &quot;Smith&quot; ; vcard:Given &quot;John&quot; ] . foaf:mbox_sha1sum rdf:type owl:InverseFunctionalProperty .
  • 28. ASK @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:a foaf:name &quot;Alice&quot; . _:a foaf:homepage <http://work.example.org/alice/> . _:b foaf:name &quot;Bob&quot; . _:b foaf:mbox <mailto:bob@work.example> . PREFIX foaf: <http://xmlns.com/foaf/0.1/> ASK { ?x foaf:name &quot;Alice&quot; } .
  • 29.
  • 30.
  • 31.