diff --git a/plugins/Geography/test.py b/plugins/Geography/test.py index 0b496d2fa..4dbfb8538 100644 --- a/plugins/Geography/test.py +++ b/plugins/Geography/test.py @@ -187,7 +187,7 @@ class GeographyLocaltimeTestCase(PluginTestCase): class GeographyWikidataTestCase(SupyTestCase): @skipIf(not network, "Network test") - def testOsmidToTimezone(self): + def testRelationOsmidToTimezone(self): self.assertEqual( wikidata.uri_from_osmid(450381), "http://www.wikidata.org/entity/Q22690", @@ -196,6 +196,12 @@ class GeographyWikidataTestCase(SupyTestCase): wikidata.uri_from_osmid(192468), "http://www.wikidata.org/entity/Q47045", ) + @skipIf(not network, "Network test") + def testNodeOsmidToTimezone(self): + self.assertEqual( + wikidata.uri_from_osmid(436012592), + "http://www.wikidata.org/entity/Q933", + ) @skipIf(not network, "Network test") def testDirect(self): diff --git a/plugins/Geography/wikidata.py b/plugins/Geography/wikidata.py index 2256691ee..d07c0ebb4 100644 --- a/plugins/Geography/wikidata.py +++ b/plugins/Geography/wikidata.py @@ -115,7 +115,14 @@ LIMIT 1 OSMID_QUERY = string.Template( """ SELECT ?item WHERE { - ?item wdt:P402 "$osmid". + { + ?item wdt:P402 "$osmid". # OSM relation ID + } + UNION + { + ?item wdt:P11693 "$osmid". # OSM node ID + } + } LIMIT 1 """