SPARQL query timing out for WIkidata

35 Views Asked by At

I am trying to run a SPARQL query. As soon as I try to query schema:about for a query , the query starts timing out. I am trying to write a query to get all cities with population greater than X. Am I doing something wrong or is there a way to optimise it? Original query which is working

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

Query to get about article:

SELECT DISTINCT ?city ?cityLabel ?population ?country ?countryLabel ?loc ?article  WHERE {
  ?city wdt:P31/wdt:P279* wd:Q515 .
  ?city wdt:P1082 ?population .
  ?city wdt:P17 ?country .
  ?city wdt:P625 ?loc .
  FILTER (?population >= 1000000) .
  ?article schema:about ?city .
  ?article schema:isPartOf <https://en.wikipedia.org/>.
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
ORDER BY DESC(?population)

Here is the link where I am trying to run the query: https://query.wikidata.org/

0

There are 0 best solutions below