Skip to content

Instantly share code, notes, and snippets.

@marco-brandizi
Last active August 29, 2015 14:04
Show Gist options
  • Save marco-brandizi/f90e7014b1fce177df2b to your computer and use it in GitHub Desktop.
Save marco-brandizi/f90e7014b1fce177df2b to your computer and use it in GitHub Desktop.
# Composers of Italian movies, who was born in places having more than 100k inhabitants
# Usage: paste it into http://it.dbpedia.org/sparql and then hit 'Run Query'
#
PREFIX dbp-onto: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?composerName ?birthplaceName
WHERE
{
# Movies from italy and their music composers
?movie a dbp-onto:Film;
dbp-onto:country <http://it.dbpedia.org/resource/Italia>;
dbp-onto:musicComposer ?composer.
# Link between the composer and its birth place
?composer
dbp-onto:birthPlace ?birthplace;
rdfs:label ?composerName.
# Details about the place where the composer (from the movie) was born
?birthplace
dbp-onto:populationTotal ?population;
rdfs:label ?birthplaceName.
# And the filter over the population
FILTER ( ?population > 100000 ).
}
ORDER BY ?composerName
LIMIT 100.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment