From 75f34a916879bb3a9fb1cbe0a088262989a3a4fb Mon Sep 17 00:00:00 2001 From: csae8092 Date: Mon, 3 Jun 2024 20:22:19 +0200 Subject: [PATCH] removes entities with wikidata-ids from no wikidata collection --- dumper/management/commands/wikidata_minter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dumper/management/commands/wikidata_minter.py b/dumper/management/commands/wikidata_minter.py index 795aca9..d2de2fc 100644 --- a/dumper/management/commands/wikidata_minter.py +++ b/dumper/management/commands/wikidata_minter.py @@ -16,9 +16,15 @@ class Command(BaseCommand): help = "mint WikiData IDs for GND-URIs" def handle(self, *args, **kwargs): - LIMIT = 100 + LIMIT = 2 USER_AGENT_PMB = "pmb (https://pmb.acdh.oeaw.ac.at)" col, _ = Collection.objects.get_or_create(name="No WikiData-ID found") + ents = TempEntityClass.objects.filter(uri__uri__icontains="wikidata").filter(collection=col) + print(f"found {ents.count()} entities with wikidata-ids but related to {col}") + if ents: + print(f"remove relation to {col}") + for x in tqdm(ents, total=ents.count()): + x.collection.remove(col) types = ["d-nb.info", "geonames"] for uri_type in types: print(f"processing URIS with type: {uri_type}")