There are many cities in Wikipedia/Wikidata named Akron. Perhaps this?

 

SELECT ?wikipedia ?cityLabel ?city

WHERE {

  VALUES ?label {

    "Aachen"@en 

    "Akron"@en

  }

  ?wikipedia schema:name ?page;

    schema:isPartOf <https://en.wikipedia.org/>;

    schema:about ?city.

  ?city rdfs:label ?label .

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

}

 

 

From: Wikidata <wikidata-bounces@lists.wikimedia.org> on behalf of Zsolt Ero <zsolt.ero@gmail.com>
Date: Sunday, February 21, 2021 at 8:34 PM
To: wikidata@lists.wikimedia.org <wikidata@lists.wikimedia.org>
Subject: [External] [Wikidata] SPARQL with wikipedia redirects

Hi,

 

I'm trying to make this query work with Wikipedia redirects: https://w.wiki/$sF



SELECT * WHERE {

  VALUES ?page {

    "Aachen"@en  

    "Akron"@en

  }

  ?sitelink schema:name ?page;

    schema:isPartOf <https://en.wikipedia.org/>;

    schema:about ?city.

}

 

Aachen works, Akron does not, as it is a redirect. How can I make a query which works with such redirects?

 

I'm trying to get Wikidata ids for the links from this table: https://en.wikipedia.org/wiki/List_of_cities_by_GDP

(The html has mw-redirect class for the redirects).

 

Regards,

Zsolt