ssn

field notes

User Tools

Site Tools


teach:dapi:202021:lectures:samplesparql

SPARQL Queries on DBpedia §

Exploring triples §

SELECT *
WHERE
     {
        ?s ?p ?o
     }
LIMIT 20 

Query link on DBpedia 

Exploring annotations §

SELECT *
WHERE
     {
        ?person rdfs:label "Ursula von der Leyen"@en
     } 

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.
     } 

Query link on DBpedia 

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) .
}        

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 <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
}        

Query link on DBpedia 

teach/dapi/202021/lectures/samplesparql.txt · Last modified: 2020/12/04 12:55 by mcr

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki