Question: Which cities have more than 2 million inhabitants?
SPARQL:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX prop: <http://dbpedia.org/property/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX onto: <http://dbpedia.org/ontology/> SELECT DISTINCT ?uri ?string WHERE { { ?uri rdf:type onto:City. ?uri prop:population ?population. FILTER (xsd:integer(?population) > 2000000). OPTIONAL {?uri rdfs:label ?string .} FILTER (lang(?string) = "en") } UNION { ?uri rdf:type onto:City. ?uri prop:populationUrban ?population. FILTER (xsd:integer(?population) > 2000000) . OPTIONAL {?uri rdfs:label ?string .} FILTER (lang(?string) = "en") } }