Upload
knud-moeller
View
3.103
Download
0
Embed Size (px)
Citation preview
SPARQL -
Query Basics and Federated Queries
Knud Möller, Talis Systems Ltd.@knudmoeller
16 April 2012Tutorial: Practical Cross-Dataset Queries on the Web of Data
WWW2012, Lyon, France
What is SPARQL?
• query language for RDF graphs (i.e., linked data)
• get specific information out of a dataset (or several datasets)
• “The SQL for the Web of Data”
SPARQL
History
• 2004: work started on SPARQL
• 2008: SPARQL 1.0 finished (W3C Rec)
• 2009: work started on SPARQL 1.1
• 2012 (now): SPARQL 1.1 almost finished
• soon: SPARQL 1.1 finished
SPARQL Endpoint
SPAR
QL Endpoint
Query in
Result back
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
SPARQL in a Nutshell
query clause1
WHERE clause2
SPARQL in a Nutshell
query clause1
WHERE clause2
What do I want to get back?• SELECT: list of things• DESCRIBE: RDF graph for one
resource• CONSTRUCT: custom RDF graph• ASK: boolean value (true or false)
SPARQL in a Nutshell
query clause1
WHERE clause2
What do I want to get back?• SELECT: list of things• DESCRIBE: RDF graph for one
resource• CONSTRUCT: custom RDF graph• ASK: boolean value (true or false)
Which part of the graph am I looking for?• WHERE• triple patterns• graph patterns
SPARQL in a Nutshell
query clause1
WHERE clause2
Prologue0
What do I want to get back?• SELECT: list of things• DESCRIBE: RDF graph for one
resource• CONSTRUCT: custom RDF graph• ASK: boolean value (true or false)
Which part of the graph am I looking for?• WHERE• triple patterns• graph patterns
SPARQL in a Nutshell
query clause1
WHERE clause2
Prologue0
Modifiers3
What do I want to get back?• SELECT: list of things• DESCRIBE: RDF graph for one
resource• CONSTRUCT: custom RDF graph• ASK: boolean value (true or false)
Which part of the graph am I looking for?• WHERE• triple patterns• graph patterns
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
graph pattern
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
graph pattern
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_date
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
ORDER BY ?release_date
graph pattern
Example Data• from music site Jamendo:
http://ww.jamendo.com
• linked data at DBTune:
http://dbtune.org/jamendo/
• thousands of artists with albums, tracks, etc.
• additionally, some geographical data from Geonames:
http://www.geonames.org/
artists:3732
mo:MusicArtist
a
locations:3019599/foaf:based_near
http://blackshoulders.hautetfort.com/
foaf:homepage
http://img.jamendo.com/artists/w/white-shoulders.jpg
foaf:img
records:8836
foaf:made
records:4092 foaf:made
records:6361foaf:made
records:3738
foaf:made
foaf:name
artists:3908a
foaf:based_near
http://www.petithomme.org
foaf:homepage
http://img.jamendo.com/
artists/p/petit.homme.gif
foaf:imgrecords:4295
foaf:made
records:3604
foaf:made
foaf:name
mo:Record
a
dce:date
dce:title
tracks:90508
mo:track
tracks:90496
mo:track
tracks:90510
mo:track
tracks:90504
mo:track
tags:noisy hg:taggedWithTag
tags:electro
hg:taggedWithTag
tags:experimental
hg:taggedWithTag
tags:noise
hg:taggedWithTag
foaf:maker
Whiteshoulders Petit Homme
2007-10-09T15:58:17
W (EP)
Text
@base <http://dbtune.org/jamendo/> .@prefix foaf: <http://xmlns.com/foaf/0.1/> .@prefix mo: <http://purl.org/ontology/mo/> .@prefix dce: <http://purl.org/dc/elements/1.1/> .@prefix hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/> .@prefix tags: <tag/> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<artist/3908> a mo:MusicArtist ; foaf:based_near <http://sws.geonames.org/3019599/> ; foaf:homepage <http://www.petithomme.org> ; foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> ; foaf:made <record/3604>, <record/4295> ; foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist ; foaf:based_near <http://sws.geonames.org/3019599/> ; foaf:homepage <http://blackshoulders.hautetfort.com/> ; foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> ; foaf:made <record/3738>, <record/4092>, <record/6361>, <record/8836> ; foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime ; dce:title "W (EP)"^^xsd:string ; mo:track <track/90496>, <track/90504>, <track/90508>, <track/90510> ; hg:taggedWithTag tags:electro, tags:experimental, tags:noise, tags:noisy ; a mo:Record ; foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Triple and Graph Patterns
WHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (year(?release_date) = 2007 && month(?release_date) = 7)}
no variables
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
one variable
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
two variables
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Text
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
?subject ?predicate ?object
three variables
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
?artist a mo:MusicArtist ;! ! foaf:name ?artist_name ;! ! foaf:homepage ?homepage .
graph pattern
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
<artist/3908> a mo:MusicArtist .<artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3908> foaf:homepage <http://www.petithomme.org> .<artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> .<artist/3908> foaf:made <record/3604> .<artist/3908> foaf:made <record/4295> .<artist/3908> foaf:name "Petit Homme"^^xsd:string .
<artist/3732> a mo:MusicArtist .<artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> .<artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> .<artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> .<artist/3732> foaf:made <record/3738> .<artist/3732> foaf:made <record/4092> .<artist/3732> foaf:made <record/6361> .<artist/3732> foaf:made <record/8836> .<artist/3732> foaf:name "Whiteshoulders"^^xsd:string .
<record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime .<record/8836> dce:title "W (EP)"^^xsd:string .<record/8836> mo:track <track/90496> .<record/8836> mo:track <track/90504> .<record/8836> mo:track <track/90508> .<record/8836> mo:track <track/90510> .<record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental .<record/8836> hg:taggedWithTag tags:noise .<record/8836> hg:taggedWithTag tags:noisy .<record/8836> a mo:Record .<record/8836> foaf:maker <artist/3732> .
Interfaces to SPARQL endpoints
•Web interfaces
• Bindings for programming languages
• straight HTTP
• command line interfaces
http://data.semanticweb.org/snorql
http://kasabi.com/dataset/world-geography
ARQ
we will use the arq command line tool - see the ARQ Command Line Cheat Sheet:
arq --data data/jamendo.nt
--query queries/query5.rq
Example Scenario
• Get all albums for a particular month (e.g., July 2007)
• List all Jamendo artists in France
• explore datasets and build final query bit by bit
• learn about different features of SPARQL along the way
• cannot cover every aspect of SPARQL! E.g., property paths are missing.
List all ClassesSELECT DISTINCT ?classWHERE {! ?s a ?class .}
find all types of things in the dataset (classes)
List all ClassesSELECT DISTINCT ?classWHERE {! ?s a ?class .}
find all types of things in the dataset (classes)
--------------------------------------------------------| class |========================================================| <http://purl.org/ontology/mo/Playlist> || <http://purl.org/ontology/mo/Signal> || <http://purl.org/ontology/mo/Lyrics> || <http://purl.org/ontology/mo/Track> || <http://www.w3.org/2006/time#Interval> || <http://purl.org/ontology/mo/Torrent> || <http://purl.org/ontology/mo/ED2K> || <http://purl.org/ontology/mo/Record> || <http://www.holygoat.co.uk/owl/redwood/0.1/tags/Tag> || <http://purl.org/ontology/mo/MusicArtist> || <http://xmlns.com/foaf/0.1/Document> |--------------------------------------------------------
List all ClassesSELECT DISTINCT ?classWHERE {! ?s a ?class .}
find all types of things in the dataset (classes)
--------------------------------------------------------| class |========================================================| <http://purl.org/ontology/mo/Playlist> || <http://purl.org/ontology/mo/Signal> || <http://purl.org/ontology/mo/Lyrics> || <http://purl.org/ontology/mo/Track> || <http://www.w3.org/2006/time#Interval> || <http://purl.org/ontology/mo/Torrent> || <http://purl.org/ontology/mo/ED2K> || <http://purl.org/ontology/mo/Record> || <http://www.holygoat.co.uk/owl/redwood/0.1/tags/Tag> || <http://purl.org/ontology/mo/MusicArtist> || <http://xmlns.com/foaf/0.1/Document> |--------------------------------------------------------
Properties of ArtistsPREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?predWHERE {! ?artist a mo:MusicArtist ;! ! ?pred ?obj .}
all properties for the mo:MusicArtist class
Properties of ArtistsPREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?predWHERE {! ?artist a mo:MusicArtist ;! ! ?pred ?obj .}
all properties for the mo:MusicArtist class
-----------------------------------------------------| pred |=====================================================| <http://xmlns.com/foaf/0.1/name> || <http://xmlns.com/foaf/0.1/made> || <http://xmlns.com/foaf/0.1/img> || <http://xmlns.com/foaf/0.1/based_near> || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> || <http://xmlns.com/foaf/0.1/homepage> || mo:biography |-----------------------------------------------------
Properties of Artists, ctd.PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?classWHERE {! ?artist a mo:MusicArtist ;! ! ?pred ?obj .! ?obj a ?class ;}
properties with objects
Properties of Artists, ctd.PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?classWHERE {! ?artist a mo:MusicArtist ;! ! ?pred ?obj .! ?obj a ?class ;}
properties with objects
------------------------------------------------| pred | class |================================================| <http://xmlns.com/foaf/0.1/made> | mo:Record |------------------------------------------------
only one result?
PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?classWHERE {! ?artist a mo:MusicArtist ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }} OPTIONAL statement
Properties of Artists, ctd.
PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?classWHERE {! ?artist a mo:MusicArtist ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }} OPTIONAL statement
-----------------------------------------------------------------| pred | class |=================================================================| <http://xmlns.com/foaf/0.1/name> | || <http://xmlns.com/foaf/0.1/made> | mo:Record || <http://xmlns.com/foaf/0.1/img> | || <http://xmlns.com/foaf/0.1/based_near> | || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | || <http://xmlns.com/foaf/0.1/homepage> | || mo:biography | |-----------------------------------------------------------------
Properties of Artists, ctd.
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dce: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?pred ?classWHERE {! ?record a mo:Record ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }}
Properties of Records
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dce: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?pred ?classWHERE {! ?record a mo:Record ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }}
----------------------------------------------------------------------| pred | class |======================================================================| foaf:maker | mo:MusicArtist || mo:track | mo:Track || hg:taggedWithTag | hg:Tag || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | || mo:available_as | mo:ED2K || mo:image | || dce:date | || mo:available_as | mo:Torrent || dce:title | || mo:available_as | mo:Playlist || dce:description | |----------------------------------------------------------------------
Properties of Records
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dce: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?pred ?classWHERE {! ?record a mo:Record ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }}
----------------------------------------------------------------------| pred | class |======================================================================| foaf:maker | mo:MusicArtist || mo:track | mo:Track || hg:taggedWithTag | hg:Tag || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | || mo:available_as | mo:ED2K || mo:image | || dce:date | || mo:available_as | mo:Torrent || dce:title | || mo:available_as | mo:Playlist || dce:description | |----------------------------------------------------------------------
Properties of Records
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dce: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?pred ?classWHERE {! ?record a mo:Record ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }} ORDER BY ASC(?pred) DESC(?class)
Properties of Records, ctd.
ORDER BY statement
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dce: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?pred ?classWHERE {! ?record a mo:Record ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }} ORDER BY ASC(?pred) DESC(?class)
----------------------------------------------------------------------| pred | class |======================================================================| dce:date | || dce:description | || dce:title | || mo:available_as | mo:Torrent || mo:available_as | mo:Playlist || mo:available_as | mo:ED2K || mo:image | || mo:track | mo:Track || hg:taggedWithTag | hg:Tag || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | || foaf:maker | mo:MusicArtist |----------------------------------------------------------------------
Properties of Records, ctd.
ORDER BY statement
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dce: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?pred ?classWHERE {! ?record a mo:Record ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }} ORDER BY ASC(?pred) DESC(?class)
----------------------------------------------------------------------| pred | class |======================================================================| dce:date | || dce:description | || dce:title | || mo:available_as | mo:Torrent || mo:available_as | mo:Playlist || mo:available_as | mo:ED2K || mo:image | || mo:track | mo:Track || hg:taggedWithTag | hg:Tag || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | || foaf:maker | mo:MusicArtist |----------------------------------------------------------------------
Properties of Records, ctd.
ORDER BY statement
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX hg: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dce: <http://purl.org/dc/elements/1.1/>
SELECT DISTINCT ?pred ?classWHERE {! ?record a mo:Record ;! ! ?pred ?obj .! OPTIONAL {! ! ?obj a ?class .! }} ORDER BY ASC(?pred) DESC(?class)
----------------------------------------------------------------------| pred | class |======================================================================| dce:date | || dce:description | || dce:title | || mo:available_as | mo:Torrent || mo:available_as | mo:Playlist || mo:available_as | mo:ED2K || mo:image | || mo:track | mo:Track || hg:taggedWithTag | hg:Tag || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> | || foaf:maker | mo:MusicArtist |----------------------------------------------------------------------
Properties of Records, ctd.
ORDER BY statement
Problem: Wrong data format
• date/time related functions in SPARQL expect dates in xsd:dateTime format:
"2007-06-15T17:13:58"^^xsd:dateTime
• however, source data has dates as plain literals with wrong format:
"2007-06-15 17:13:58"
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>PREFIX dce: <http://purl.org/dc/elements/1.1/>
CONSTRUCT {! ?s2 dce:date ?date_fixed .}WHERE {! ?s2 dce:date ?date .! BIND (STRDT(REPLACE(?date, " ", "T"), xsd:dateTime) AS ?date_fixed)}
Fixing Data
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>PREFIX dce: <http://purl.org/dc/elements/1.1/>
CONSTRUCT {! ?s2 dce:date ?date_fixed .}WHERE {! ?s2 dce:date ?date .! BIND (STRDT(REPLACE(?date, " ", "T"), xsd:dateTime) AS ?date_fixed)}
Fixing Data
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>PREFIX dce: <http://purl.org/dc/elements/1.1/>
CONSTRUCT {! ?s2 dce:date ?date_fixed .}WHERE {! ?s2 dce:date ?date .! BIND (STRDT(REPLACE(?date, " ", "T"), xsd:dateTime) AS ?date_fixed)}
Fixing Data
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>PREFIX dce: <http://purl.org/dc/elements/1.1/>
CONSTRUCT {! ?s2 dce:date ?date_fixed .}WHERE {! ?s2 dce:date ?date .! BIND (STRDT(REPLACE(?date, " ", "T"), xsd:dateTime) AS ?date_fixed)}
Fixing Data
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>PREFIX dce: <http://purl.org/dc/elements/1.1/>
CONSTRUCT {! ?s2 dce:date ?date_fixed .}WHERE {! ?s2 dce:date ?date .! BIND (STRDT(REPLACE(?date, " ", "T"), xsd:dateTime) AS ?date_fixed)}
Fixing Data
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>PREFIX dce: <http://purl.org/dc/elements/1.1/>
CONSTRUCT {! ?s2 dce:date ?date_fixed .}WHERE {! ?s2 dce:date ?date .! BIND (STRDT(REPLACE(?date, " ", "T"), xsd:dateTime) AS ?date_fixed)}
Fixing Data
@prefix dce: <http://purl.org/dc/elements/1.1/> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://dbtune.org/jamendo/record/6015> dce:date "2007-06-15T17:13:58"^^xsd:dateTime .
<http://dbtune.org/jamendo/record/6343> dce:date "2007-07-05T19:32:23"^^xsd:dateTime .
<http://dbtune.org/jamendo/record/12863> dce:date "2007-11-19T11:46:34"^^xsd:dateTime .
<http://dbtune.org/jamendo/record/3993> dce:date "2007-02-01T18:08:28"^^xsd:dateTime .
PREFIX dce: <http://purl.org/dc/elements/1.1/>
CONSTRUCT {! ?s ?p ?o .}WHERE {! ?s ?p ?o .! FILTER (?p != dce:date)}
Filtering Results
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_dateWHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (YEAR(?release_date) = 2007 && MONTH(?release_date) = 7)}ORDER BY ?release_date
All albums for 2007/07
PREFIX mo: <http://purl.org/ontology/mo/>PREFIX dce: <http://purl.org/dc/elements/1.1/>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?album ?title ?release_dateWHERE {! ?album a mo:Record ;! ! dce:date ?release_date ;! ! dce:title ?title .! FILTER (YEAR(?release_date) = 2007 && MONTH(?release_date) = 7)}ORDER BY ?release_date
All albums for 2007/07
--------------------------------------------------------------------------------------------------------------------------| album | title | release_date |==========================================================================================================================| <http://dbtune.org/jamendo/record/6310> | "Demo 2005"^^xsd:string | "2007-07-04T16:24:23"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6320> | "Cinema"^^xsd:string | "2007-07-04T16:39:11"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6312> | "ECLECTEK II"^^xsd:string | "2007-07-04T17:02:09"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6302> | "Unknow user"^^xsd:string | "2007-07-04T18:06:18"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6323> | "girls always cry-xysides"^^xsd:string | "2007-07-04T23:16:26"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6327> | "Fest-noz is dead"^^xsd:string | "2007-07-05T11:29:03"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6328> | "Félin Pour L'Autre"^^xsd:string | "2007-07-05T13:04:37"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6250> | "BLAPP."^^xsd:string | "2007-07-05T14:18:11"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6332> | "Cà Phê and Pizza"^^xsd:string | "2007-07-05T16:04:02"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6329> | "Life in Lento Violento"^^xsd:string | "2007-07-05T16:39:17"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6336> | "Transition"^^xsd:string | "2007-07-05T16:47:49"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6338> | "Die Zahl der Toten"^^xsd:string | "2007-07-05T19:20:52"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6343> | "Offender Girl"^^xsd:string | "2007-07-05T19:32:23"^^xsd:dateTime || <http://dbtune.org/jamendo/record/6377> | "Donne moi"^^xsd:string | "2007-07-10T17:29:23"^^xsd:dateTime |
SPARQLFederated Queries
PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?locationWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near ?location .}
Artists in France
PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?locationWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near ?location .}
Artists in France
PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX mo: <http://purl.org/ontology/mo/>
SELECT DISTINCT ?locationWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near ?location .}
Artists in France
--------------------------------------| location |======================================| <http://sws.geonames.org/2661602/> || <http://sws.geonames.org/2997861/> || <http://sws.geonames.org/3013767/> || <http://sws.geonames.org/3013726/> || <http://sws.geonames.org/2802361/> || <http://sws.geonames.org/3026644/> || <http://sws.geonames.org/3017382/> || <http://sws.geonames.org/3865483/> || <http://sws.geonames.org/2968815/> || <http://sws.geonames.org/3013657/> || <http://sws.geonames.org/2987410/> || <http://sws.geonames.org/2750405/> || <http://sws.geonames.org/6424360/> || <http://sws.geonames.org/6556330/> || <http://sws.geonames.org/3213264/> || <http://sws.geonames.org/2967196/> |
Geonames SPARQL endpoints
• http://api.kasabi.com/dataset/geonames/apis/sparql
• http://factforge.net/sparql
SELECT DISTINCT ?predWHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! <http://sws.geonames.org/2661602/> ?pred ?obj .! }}
Querying Remote Endpoint
SELECT DISTINCT ?predWHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! <http://sws.geonames.org/2661602/> ?pred ?obj .! }}
Querying Remote Endpoint
SELECT DISTINCT ?predWHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! <http://sws.geonames.org/2661602/> ?pred ?obj .! }}
Querying Remote Endpoint
-------------------------------------------------------| pred |=======================================================| <http://www.geonames.org/ontology#alternateName> || <http://www.geonames.org/ontology#countryCode> || <http://www.geonames.org/ontology#featureClass> || <http://www.geonames.org/ontology#featureCode> || <http://www.geonames.org/ontology#locationMap> || <http://www.geonames.org/ontology#name> || <http://www.geonames.org/ontology#parentADM1> || <http://www.geonames.org/ontology#parentCountry> || <http://www.geonames.org/ontology#parentFeature> || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> || <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> || <http://www.w3.org/2003/01/geo/wgs84_pos#lat> || <http://www.w3.org/2003/01/geo/wgs84_pos#long> || <http://www.geonames.org/ontology#childrenFeatures> |-------------------------------------------------------
SELECT DISTINCT ?predWHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! <http://sws.geonames.org/2661602/> ?pred ?obj .! }}
Querying Remote Endpoint
-------------------------------------------------------| pred |=======================================================| <http://www.geonames.org/ontology#alternateName> || <http://www.geonames.org/ontology#countryCode> || <http://www.geonames.org/ontology#featureClass> || <http://www.geonames.org/ontology#featureCode> || <http://www.geonames.org/ontology#locationMap> || <http://www.geonames.org/ontology#name> || <http://www.geonames.org/ontology#parentADM1> || <http://www.geonames.org/ontology#parentCountry> || <http://www.geonames.org/ontology#parentFeature> || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> || <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> || <http://www.w3.org/2003/01/geo/wgs84_pos#lat> || <http://www.w3.org/2003/01/geo/wgs84_pos#long> || <http://www.geonames.org/ontology#childrenFeatures> |-------------------------------------------------------
SELECT DISTINCT ?predWHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! <http://sws.geonames.org/2661602/> ?pred ?obj .! }}
Querying Remote Endpoint
-------------------------------------------------------| pred |=======================================================| <http://www.geonames.org/ontology#alternateName> || <http://www.geonames.org/ontology#countryCode> || <http://www.geonames.org/ontology#featureClass> || <http://www.geonames.org/ontology#featureCode> || <http://www.geonames.org/ontology#locationMap> || <http://www.geonames.org/ontology#name> || <http://www.geonames.org/ontology#parentADM1> || <http://www.geonames.org/ontology#parentCountry> || <http://www.geonames.org/ontology#parentFeature> || <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> || <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> || <http://www.w3.org/2003/01/geo/wgs84_pos#lat> || <http://www.w3.org/2003/01/geo/wgs84_pos#long> || <http://www.geonames.org/ontology#childrenFeatures> |-------------------------------------------------------
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist ?nameWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near ?location .! !! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! ?location geonames:name ?name .! }! !}LIMIT 50
Combining Local + Remote
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist ?nameWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near ?location .! !! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! ?location geonames:name ?name .! }! !}LIMIT 50
Combining Local + Remote
-------------------------------------------------------------------------------------| artist | name |=====================================================================================| <http://dbtune.org/jamendo/artist/5496> | "Kanton Basel-Stadt" || <http://dbtune.org/jamendo/artist/256> | "Département de la Loire-Atlantique" || <http://dbtune.org/jamendo/artist/337049> | "Département de la Haute-Garonne" || <http://dbtune.org/jamendo/artist/8035> | "Département des Hautes-Pyrénées" || <http://dbtune.org/jamendo/artist/6260> | "Kingdom of Belgium" || <http://dbtune.org/jamendo/artist/2471> | "Département de la Charente-Maritime" || <http://dbtune.org/jamendo/artist/3572> | "Republic of France" || <http://dbtune.org/jamendo/artist/4680> | "Argentine Republic" |
PREFIX geonames: <http://www.geonames.org/ontology#>
SELECT DISTINCT ?country ?nameWHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! SELECT DISTINCT ?country ?name! ! WHERE {! ! ! ?country geonames:featureCode geonames:A.PCLI ;! ! ! ! geonames:name ?name .! ! ! FILTER (regex(?name, "france", "i"))! ! }! }}ORDER BY ?name
What is France?
PREFIX geonames: <http://www.geonames.org/ontology#>
SELECT DISTINCT ?country ?nameWHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=07d5e23c8d7bf5ae576f39c64e822ea6baffea98>! {! ! SELECT DISTINCT ?country ?name! ! WHERE {! ! ! ?country geonames:featureCode geonames:A.PCLI ;! ! ! ! geonames:name ?name .! ! ! FILTER (regex(?name, "france", "i"))! ! }! }}ORDER BY ?name
What is France?
-------------------------------------------------------------| country | name |=============================================================| <http://sws.geonames.org/3017382/> | "Republic of France" |-------------------------------------------------------------
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist ?nameWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near <http://sws.geonames.org/3017382/> ;! ! foaf:name ?name .! !}ORDER BY ?name
Artists in France (1)
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist ?nameWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near <http://sws.geonames.org/3017382/> ;! ! foaf:name ?name .! !}ORDER BY ?name
Artists in France (1)
-------------------------------------------------------------------------------------------------------------------| artist | name |===================================================================================================================| <http://dbtune.org/jamendo/artist/3972> | "#2 Orchestra"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/5865> | "(own+line)"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/4779> | "7BZH"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/3297> | "AMarie.C"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/754> | "Adam Lwo"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/4825> | "Alteranti"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/784> | "Ataraxia Rebel Force"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/289> | "Auto/Sexual"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/565> | "BUREAU DES FLUIDES"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/336803> | "Baron Baroff"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/8316> | "Bertrand Homassel"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/274> | "Bleacher"^^<http://www.w3.org/2001/XMLSchema#string> || <http://dbtune.org/jamendo/artist/3835> | "Brigade Neurale"^^<http://www.w3.org/2001/XMLSchema#string> |
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist ?name ?place ?place_nameWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near ?place ;! ! foaf:name ?name .!! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=APIKEY>! {! ! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! ! geonames:name ?place_name .! }! !}ORDER BY ?nameLIMIT 10
Artists in France (2)
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist ?name ?place ?place_nameWHERE {! ?artist a mo:MusicArtist ;! ! foaf:based_near ?place ;! ! foaf:name ?name .!! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=APIKEY>! {! ! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! ! geonames:name ?place_name .! }! !}ORDER BY ?nameLIMIT 10
Artists in France (2)
PREFIX geonames: ! <http://www.geonames.org/ontology#>
CONSTRUCT {! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! geonames:name ?name .}WHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=APIKEY>! {! ! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! ! geonames:name ?name .! }! !}
Places in France
PREFIX geonames: ! <http://www.geonames.org/ontology#>
CONSTRUCT {! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! geonames:name ?name .}WHERE {! SERVICE <http://api.kasabi.com/dataset/geonames/apis/sparql?apikey=APIKEY>! {! ! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! ! geonames:name ?name .! }! !}
Places in France
@prefix geonames: <http://www.geonames.org/ontology#> .
<http://sws.geonames.org/3003977/> geonames:name "Le Grand Merimont" ; geonames:parentCountry <http://sws.geonames.org/3017382/> .
<http://sws.geonames.org/2994812/> geonames:name "Mean-Ruz" ; geonames:parentCountry <http://sws.geonames.org/3017382/> .
<http://sws.geonames.org/7535264/> geonames:name "Golf du Prieuré" ; geonames:parentCountry <http://sws.geonames.org/3017382/> .
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist_name ?place_nameFROM <../data/jamendo-rdf/jamendo.nt>FROM <../data/in_france.nt>WHERE { ! ?artist a mo:MusicArtist ; ! ! foaf:based_near ?place ; ! ! foaf:name ?artist_name .! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! geonames:name ?place_name .}ORDER BY ?artist_name
Et voilà - Les artistes de France!
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist_name ?place_nameFROM <../data/jamendo-rdf/jamendo.nt>FROM <../data/in_france.nt>WHERE { ! ?artist a mo:MusicArtist ; ! ! foaf:based_near ?place ; ! ! foaf:name ?artist_name .! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! geonames:name ?place_name .}ORDER BY ?artist_name
Et voilà - Les artistes de France!
----------------------------------------------------------------------------------------------------------------| artist_name | place_name |================================================================================================================| "#2 Orchestra"^^<http://www.w3.org/2001/XMLSchema#string> | "Republic of France" || "#Blockout"^^<http://www.w3.org/2001/XMLSchema#string> | "Département des Yvelines" || "#Dance 75#"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "#NarNaoud#"^^<http://www.w3.org/2001/XMLSchema#string> | "Département de la Gironde" || "#ZedMeta#"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "#Zorglups#"^^<http://www.w3.org/2001/XMLSchema#string> | "Département de l'Essonne" || "&ND"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "(own+line)"^^<http://www.w3.org/2001/XMLSchema#string> | "Republic of France" || "* Q u i r y *"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "-=Kwada=-"^^<http://www.w3.org/2001/XMLSchema#string> | "Département de la Haute-Garonne" || "-DEMO-"^^<http://www.w3.org/2001/XMLSchema#string> | "Département du Nord" |
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist_name ?place_nameFROM <../data/jamendo-rdf/jamendo.nt>FROM <../data/in_france.nt>WHERE { ! ?artist a mo:MusicArtist ; ! ! foaf:based_near ?place ; ! ! foaf:name ?artist_name .! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! geonames:name ?place_name .}ORDER BY ?artist_name
Et voilà - Les artistes de France!
----------------------------------------------------------------------------------------------------------------| artist_name | place_name |================================================================================================================| "#2 Orchestra"^^<http://www.w3.org/2001/XMLSchema#string> | "Republic of France" || "#Blockout"^^<http://www.w3.org/2001/XMLSchema#string> | "Département des Yvelines" || "#Dance 75#"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "#NarNaoud#"^^<http://www.w3.org/2001/XMLSchema#string> | "Département de la Gironde" || "#ZedMeta#"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "#Zorglups#"^^<http://www.w3.org/2001/XMLSchema#string> | "Département de l'Essonne" || "&ND"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "(own+line)"^^<http://www.w3.org/2001/XMLSchema#string> | "Republic of France" || "* Q u i r y *"^^<http://www.w3.org/2001/XMLSchema#string> | "Paris" || "-=Kwada=-"^^<http://www.w3.org/2001/XMLSchema#string> | "Département de la Haute-Garonne" || "-DEMO-"^^<http://www.w3.org/2001/XMLSchema#string> | "Département du Nord" |
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist_name ?place_nameFROM <../data/jamendo-rdf/jamendo.nt>FROM NAMED <../data/in_france.nt>WHERE { ! ?artist a mo:MusicArtist ; ! ! foaf:based_near ?place ; ! ! foaf:name ?artist_name .! GRAPH <../data/in_france.nt> {! ! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! ! geonames:name ?place_name .! }}ORDER BY ?artist_name
One more thing...
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist_name ?place_nameFROM <../data/jamendo-rdf/jamendo.nt>FROM NAMED <../data/in_france.nt>WHERE { ! ?artist a mo:MusicArtist ; ! ! foaf:based_near ?place ; ! ! foaf:name ?artist_name .! GRAPH <../data/in_france.nt> {! ! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! ! geonames:name ?place_name .! }}ORDER BY ?artist_name
One more thing...
PREFIX foaf: ! ! <http://xmlns.com/foaf/0.1/>PREFIX geonames: ! <http://www.geonames.org/ontology#>PREFIX mo: ! ! <http://purl.org/ontology/mo/>
SELECT DISTINCT ?artist_name ?place_nameFROM <../data/jamendo-rdf/jamendo.nt>FROM NAMED <../data/in_france.nt>WHERE { ! ?artist a mo:MusicArtist ; ! ! foaf:based_near ?place ; ! ! foaf:name ?artist_name .! GRAPH <../data/in_france.nt> {! ! ?place geonames:parentCountry <http://sws.geonames.org/3017382/> ;! ! ! geonames:name ?place_name .! }}ORDER BY ?artist_name
One more thing...
PREFIX swrc: <http://swrc.ontoware.org/ontology#>PREFIX org: <http://data.semanticweb.org/organization/>
SELECT ?affiliation ?conference_graphWHERE {! SERVICE <http://data.semanticweb.org/sparql> {! ! GRAPH ?conference_graph {! ! ! <http://data.semanticweb.org/person/richard-cyganiak> swrc:affiliation ?affiliation .! ! }! }}
One last thing...
PREFIX swrc: <http://swrc.ontoware.org/ontology#>PREFIX org: <http://data.semanticweb.org/organization/>
SELECT ?affiliation ?conference_graphWHERE {! SERVICE <http://data.semanticweb.org/sparql> {! ! GRAPH ?conference_graph {! ! ! <http://data.semanticweb.org/person/richard-cyganiak> swrc:affiliation ?affiliation .! ! }! }}
One last thing...
PREFIX swrc: <http://swrc.ontoware.org/ontology#>PREFIX org: <http://data.semanticweb.org/organization/>
SELECT ?affiliation ?conference_graphWHERE {! SERVICE <http://data.semanticweb.org/sparql> {! ! GRAPH ?conference_graph {! ! ! <http://data.semanticweb.org/person/richard-cyganiak> swrc:affiliation ?affiliation .! ! }! }}
One last thing...
---------------------------------------------------------------------------------------------------------| affiliation | conference_graph |=========================================================================================================| org:freie-universitaet-berlin | <http://data.semanticweb.org/conference/iswc-aswc/2007/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/eswc/2008/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/iswc/2008/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/iswc/2009/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/eswc/2010/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/isemantics/2009/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/eswc/2011/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/ruleml-eu/2011/complete> || org:freie-universitaet-berlin | <http://data.semanticweb.org/conference/ruleml-eu/2011/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/iswc/2011/complete> || org:deri-nui-galway | <http://data.semanticweb.org/workshop/cold/2011/complete> || org:deri-nui-galway | <http://data.semanticweb.org/workshop/sdow/2011/complete> || org:deri-nui-galway | <http://data.semanticweb.org/conference/www/2012/complete> || org:deri-nui-galway | <http://data.semanticweb.org/workshop/ldow/2012/complete> |---------------------------------------------------------------------------------------------------------
Now you try it!Run queries from within
/Datasets/Hands On Session I
Homepage of this tutorial:
http://latc-project.eu/events/www2012-tutorial-cross-dataset-queries
All materials should be linked from there!