====== SPARQL Queries on DBpedia ====== === Exploring triples === SELECT * WHERE { ?s ?p ?o } LIMIT 20 [[https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+*%0D%0AWHERE%0D%0A+++++%7B%0D%0A++++++++%3Fs+%3Fp+%3Fo%0D%0A+++++%7D%0D%0ALIMIT+20%0D%0A%0D%0A&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on&run=+Run+Query+ |Query link on DBpedia]] === Exploring annotations === SELECT * WHERE { ?person rdfs:label "Ursula von der Leyen"@en } [[https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+*%0D%0AWHERE%0D%0A+++++%7B%0D%0A++++++++%3Fperson+rdfs%3Alabel+%22Ursula+von+der+Leyen%22%40en%0D%0A+++++%7D%0D%0A&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on&run=+Run+Query+ |Query link on DBpedia]] === More info based on properties === SELECT * WHERE { ?person rdfs:label "Ursula von der Leyen"@en; dbo:birthDate ?birth; dbo:birthPlace ?where. } [[https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+*%0D%0AWHERE%0D%0A+++++%7B%0D%0A++++++++%3Fperson+rdfs%3Alabel+%22Ursula+von+der+Leyen%22%40en%3B%0D%0A++++++++dbo%3AbirthDate+%3Fbirth%3B%0D%0A++++++++dbo%3AbirthPlace+%3Fwhere.%0D%0A+++++%7D&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on&run=+Run+Query+ |Query link on DBpedia]] === ASK query (boolean result) === PREFIX prop: PREFIX resource: ASK { resource:Amazon_River prop:length ?amazon . resource:Nile prop:length ?nile . FILTER(?amazon > ?nile) . } [[https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=PREFIX+prop%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fproperty%2F%3E%0D%0APREFIX+resource%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%0D%0A%0D%0AASK%0D%0A%7B%0D%0A++resource%3AAmazon_River+prop%3Alength+%3Famazon+.%0D%0A++resource%3ANile+prop%3Alength+%3Fnile+.%0D%0A++FILTER%28%3Famazon+%3E+%3Fnile%29+.%0D%0A%7D+&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on&run=+Run+Query+ |Query link on DBpedia]] === 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 ; 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 } [[https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+distinct+%3Fsoccerplayer+%3FcountryOfBirth+%3Fteam+%3FcountryOfTeam+%3Fstadiumcapacity%0D%0A%7B+%0D%0A%3Fsoccerplayer+a+dbo%3ASoccerPlayer+%3B%0D%0A+++dbo%3Aposition%7Cdbp%3Aposition+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FGoalkeeper_%28association_football%29%3E+%3B%0D%0A+++dbo%3AbirthPlace%2Fdbo%3Acountry*+%3FcountryOfBirth+%3B%0D%0A+++%23dbo%3Anumber+13+%3B%0D%0A+++dbo%3Ateam+%3Fteam+.%0D%0A+++%3Fteam+dbo%3Acapacity+%3Fstadiumcapacity+%3B+dbo%3Aground+%3FcountryOfTeam+.+%0D%0A+++%3FcountryOfBirth+a+dbo%3ACountry+%3B+dbo%3ApopulationTotal+%3Fpopulation+.%0D%0A+++%3FcountryOfTeam+a+dbo%3ACountry+.%0D%0AFILTER+%28%3FcountryOfTeam+%21%3D+%3FcountryOfBirth%29%0D%0AFILTER+%28%3Fstadiumcapacity+%3E+30000%29%0D%0AFILTER+%28%3Fpopulation+%3E+10000000%29%0D%0A%7D+order+by+%3Fsoccerplayer&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on&run=+Run+Query+ |Query link on DBpedia]]