/
Sparql  Examples Q1: Querying Berners-Lee’s FOAF data Sparql  Examples Q1: Querying Berners-Lee’s FOAF data

Sparql Examples Q1: Querying Berners-Lee’s FOAF data - PowerPoint Presentation

conchita-marotz
conchita-marotz . @conchita-marotz
Follow
384 views
Uploaded On 2018-03-20

Sparql Examples Q1: Querying Berners-Lee’s FOAF data - PPT Presentation

Redland Rasqal RDF Query Demonstration httplibrdforg2005sparqling Data httpdigcsailmitedu2008webdavtimblfoafrdf Query PREFIX foaf lthttpxmlnscomfoaf01gt SELECT name ID: 658871

foaf http dbo org http foaf org dbo prefix person dbpedia description query filter select www rdf country birth

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Sparql Examples Q1: Querying Berners-Le..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Sparql ExamplesSlide2

Q1: Querying Berners-Lee’s FOAF data

Redland

Rasqal

RDF Query Demonstrationhttp://librdf.org/2005/sparqlingData: http://dig.csail.mit.edu/2008/webdav/timbl/foaf.rdfQuery:

PREFIX

foaf

: <http://xmlns.com/foaf/0.1/>

SELECT ?name

WHERE {

?person

foaf:name

?name .

}Slide3

Q2: Querying Berners-Lee’s FOAF data

Redland

Rasqal

RDF Query Demonstrationhttp://librdf.org/2005/sparqlingData: http://dig.csail.mit.edu/2008/webdav/timbl/foaf.rdfQuery:

PREFIX

foaf

: <http://xmlns.com/foaf/0.1/>

SELECT *

WHERE {

?person

foaf:name

?name .

?person

foaf:mbox

?email .

}Slide4

Q3: Querying Berners-Lee’s FOAF data

Redland

Rasqal

RDF Query Demonstrationhttp://librdf.org/2005/sparqlingData: http://dig.csail.mit.edu/2008/webdav/timbl/foaf.rdfQuery:

PREFIX

foaf

: <http://xmlns.com/foaf/0.1/>

PREFIX card: <http://www.w3.org/People/Berners-Lee/card#>

SELECT ?homepage

WHERE {

card:i

foaf:knows

?known .

?known

foaf:homepage

?homepage .

}Slide5

Q4: DBPedia

http://dbpedia.org/snorql/

Prefix:

PREFIX owl: <http://www.w3.org/2002/07/owl#>

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX foaf: <http://xmlns.com/foaf/0.1/>

PREFIX dc: <http://purl.org/dc/elements/1.1/>

PREFIX : <http://dbpedia.org/resource/>

PREFIX dbpedia2: <http://dbpedia.org/property/>

PREFIX dbpedia: <http://dbpedia.org/>

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>Slide6

Q4: People who were born in Berlin before 1900

Query:

SELECT ?name ?birth ?death ?person

WHERE { ?person

dbo:birthPlace

:Berlin .

?person

dbo:birthDate

?birth .

?person

foaf:name

?name .

?person

dbo:deathDate

?death .

FILTER (?birth < "1900-01-01"^^

xsd:date

) . }

ORDER BY ?nameSlide7

Q5: German musicians with German and English descriptions

Query:

SELECT ?name ?

description_en

?

description_de

?musician

WHERE {?musician

foaf:name

?name .

OPTIONAL {

?

musician

rdfs:comment

?

description_en

.

FILTER (LANG(?

description_en

) = '

en

') . }

OPTIONAL {

?

musician

rdfs:comment

?

description_de

.

FILTER (LANG(?

description_de

) = 'de') . }

}Slide8

Q6: German musicians who were born in Berlin

Query:

SELECT ?name ?birth ?description ?person WHERE {

?person a

dbo:MusicalArtist

.

?person

dbo:birthPlace

:Berlin .

?person

dbo:birthDate

?birth .

?person

foaf:name

?name .

?person

rdfs:comment

?description .

FILTER (LANG(?description) = '

en

') .

} ORDER BY ?nameSlide9

Q7: Soccer players who are born in a country with more than 10 million inhabitants, who played as goalkeeper for a club that has a stadium with more than 30,000 seats and the club country is different from the birth country

Query:

SELECT distinct ?

soccerplayer

?

countryOfBirth

?team ?

countryOfTeam

?

stadiumcapacity

{

?

soccerplayer

a

dbo:SoccerPlayer

;

dbo:position|dbp:position

<http://dbpedia.org/resource/Goalkeeper_(association_football)> ;

dbo:birthPlace

/

dbo:country

* ?

countryOfBirth

;

#

dbo:number

13 ;

dbo:team

?team .

?team

dbo:capacity

?

stadiumcapacity

;

dbo:ground

?

countryOfTeam

.

?

countryOfBirth

a

dbo:Country

;

dbo:populationTotal

?population .

?

countryOfTeam

a

dbo:Country

.

FILTER (?

countryOfTeam

!= ?

countryOfBirth

)

FILTER (?

stadiumcapacity

> 30000)

FILTER (?population > 10000000)

} order by ?

soccerplayerSlide10

Q8: Is Amazon river longer than Nile

Sparql

Endpoint:

http://dbpedia.org/sparqlData: http://dbpedia.org

Query:

PREFIX prop: <http://dbpedia.org/property/>

ASK

{

<http://dbpedia.org/resource/Amazon_River>

prop:length

?amazon .

<http://dbpedia.org/resource/Nile>

prop:length

?

nile

.

FILTER(?amazon > ?

nile

) .

} Slide11