From 641490f4ea71e8130929f8266071d3d8aee7fd77 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Fri, 23 Jul 2021 14:38:13 +0200 Subject: [PATCH] Library items don't need to look for the Key:office tag --- matcher/api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/matcher/api.py b/matcher/api.py index cd52f0a..1edc8bd 100644 --- a/matcher/api.py +++ b/matcher/api.py @@ -232,6 +232,10 @@ def get_item_tags(item): skip_isa.add(41176) # building (Q41176) seen = set(isa_list) | skip_isa + stop = { + "Q11799049", # public institution + "Q7075", # library + } while isa_items: isa, isa_path = isa_items.pop() if not isa: @@ -244,6 +248,10 @@ def get_item_tags(item): for i in osm: osm_list[i].append(isa_path[:]) + if isa.qid in stop: + # item is specific enough, no need to keep walking the item hierarchy + continue + subclass_of = {v["numeric-id"] for v in (isa.get_claim("P279") or []) if v} religion = {v["numeric-id"] for v in (isa.get_claim("P140") or []) if v} sport = {v["numeric-id"] for v in (isa.get_claim("P641") or []) if v}