teach:dapi:202021:lectures:samplesparql
SPARQL Queries on DBpedia §
Exploring triples §
SELECT * WHERE { ?s ?p ?o } LIMIT 20 ¶
Exploring annotations §
SELECT * WHERE { ?person rdfs:label "Ursula von der Leyen"@en } ¶
More info based on properties §
SELECT * WHERE { ?person rdfs:label "Ursula von der Leyen"@en; dbo:birthDate ?birth; dbo:birthPlace ?where. } ¶
ASK query (boolean result) §
PREFIX prop: <http://dbpedia.org/property/> PREFIX resource: <http://dbpedia.org/resource/> ASK { resource:Amazon_River prop:length ?amazon . resource:Nile prop:length ?nile . FILTER(?amazon > ?nile) . } ¶
Explore DBpedia ontology §
“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” ¶
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 ?soccerplayer } ¶
teach/dapi/202021/lectures/samplesparql.txt · Last modified: 2020/12/04 12:55 by mcr