Why is this SPARQL query missing so many results?
Question: (First off, my apologies as this is a blatant cross-post. I thought
opendata.SE would be the place for this, but it's gotten barely any views
there and it appears to not be a very active site in general, so I figure I
ought to try it here as it's programming-related.)

I'm trying to get a list of major cities in the world: their name, population,
and location. I found what looked like a good query on
[Wikidata](https://query.wikidata.org/#%23Largest%20cities%20of%20the%20world%0A%23defaultView%3ABubbleChart%0ASELECT%20DISTINCT%20%3FcityLabel%20%3Fpopulation%20%3Fgps%20WHERE%20%7B%0A%20%20%3Fcity%20%28wdt%3AP31%2Fwdt%3AP279*%29%20wd%3AQ515.%0A%20%20%3Fcity%20wdt%3AP1082%20%3Fpopulation.%0A%20%20%3Fcity%20wdt%3AP625%20%3Fgps.%0A%20%20FILTER%20%28%3Fpopulation%20%3E%3D%20500000%29%20.%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fpopulation%29),
slightly tweaking one of their built-in query examples:

    
    
    SELECT DISTINCT ?cityLabel ?population ?gps WHERE {
      ?city (wdt:P31/wdt:P279*) wd:Q515.
      ?city wdt:P1082 ?population.
      ?city wdt:P625 ?gps.
      FILTER (?population >= 500000) .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    ORDER BY DESC(?population)
    

The results, at first glance, appear to be good, but it's missing a ton of
important cities. For example, San Francisco (population 800,000+) and Seattle
(population 650,000+) are not in the list, when I specifically asked for all
cities with a population greater than 500,000.

Is there something wrong with my query? If not, there must be something wrong
with the data Wikidata is using. Either way, how can I get a valid data set,
with an API I can query from a Python script? (I've got the script all working
for this; I'm just not getting back valid data.)

    
    
    from SPARQLWrapper import SPARQLWrapper, JSON
    from geopy.distance import great_circle
    
    def parseCoords(gps):
        base = gps[6:-1]
        coords=base.split()
        return (float(coords[1]), float(coords[0]))
    
    sparql = SPARQLWrapper("https://query.wikidata.org/sparql")
    sparql.setReturnFormat(JSON)
    sparql.setQuery("""SELECT DISTINCT ?cityLabel ?population ?gps WHERE {
      ?city (wdt:P31/wdt:P279*) wd:Q515.
      ?city wdt:P1082 ?population.
      ?city wdt:P625 ?gps.
      FILTER (?population >= 500000) .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    ORDER BY DESC(?population)""")
    queryResults = sparql.query().convert()
    cities = [(city["cityLabel"]["value"], int(city["population"]["value"]), parseCoords(city["gps"]["value"])) for city in queryResults["results"]["bindings"]]
    print (cities)
    


Answer: The population of seattle is simply not in this database.

If you execute:

    
    
    #Largest cities of the world
    #defaultView:BubbleChart
    SELECT * WHERE {
     wd:Q5083 wdt:P1082 ?population.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    

You get zero results. Altought the instance `wd:Q5083`(seattle) exists, it
does not have a predicate `wdt:P1082`(population).

