This documents shows by example how to translate informal data questions into formal knowledge base queries. People who were born in Berlin before 1900answer fields:
datasets :
SPARQL query: PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX : <http://dbpedia.org/resource/> 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 ?name Try it in dbpedia. 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 countryanswer fields:
datasets :
SPARQL query: PREFIX dbo: <http://dbpedia.org/ontology/> 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 Try it in dbpedia Localities in the Italian province of Prato with number of foreigners of Asian originanswer fields:
datasets :
Try it in istat endpoint |