-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert-kommunen-daenemark-typofix.pl
65 lines (50 loc) · 2.49 KB
/
convert-kommunen-daenemark-typofix.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl
use strict;
#################
# Korrigiere Tippfehler mit Quickstatements
# https://www.wikidata.org/w/index.php?title=Q897597&diff=prev&oldid=1567559385
# * ALT: ehemalige Kommunge in Dänemark
# * NEU: ehemalige Kommune in Dänemark
#################
# https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fitem%20%3Flabel%20%3FitemDescription%0AWHERE%0A%7B%0A%20%20SERVICE%20wikibase%3Amwapi%0A%20%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Aendpoint%20%22www.wikidata.org%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20wikibase%3Aapi%20%22Generator%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mwapi%3Agenerator%20%22search%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mwapi%3Agsrsearch%20%22%27ehemalige%20Kommunge%20in%20D%C3%A4nemark%27%22%40de%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mwapi%3Alanguage%20%22de%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mwapi%3Agsrlimit%20%22max%22.%0A%20%20%20%20%3Fitem%20wikibase%3AapiOutputItem%20mwapi%3Atitle.%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cde%22.%20%7D%0A%20%20%7D
# Mittels
# <syntaxhighlight lang="sparql">
# SELECT DISTINCT ?item ?label ?itemDescription
# WHERE
# {
# SERVICE wikibase:mwapi
# {
# bd:serviceParam wikibase:endpoint "www.wikidata.org";
# wikibase:api "Generator";
# mwapi:generator "search";
# mwapi:gsrsearch "'ehemalige Kommunge in Dänemark'"@de;
# mwapi:language "de";
# mwapi:gsrlimit "max".
# ?item wikibase:apiOutputItem mwapi:title.
# }
# SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de". }
# }
# </syntaxhighlight>
#
# https://w.wiki/4jTh
#
# wurden 353 betroffene Einträge ermittelt.
my $INFILE = '/home/m2k/Downloads/query.csv';
open ( IN, "< $INFILE") || die("cannot open $INFILE: $! \n");
my $count =0 ;
my $QID = 0;
while(<IN>)
{
chop;
my $line = $_;
my ($QID,$dummy,$beschreibung) = split (/\,/,$line);
$QID =~ s/http:\/\/www.wikidata.org\/entity\/Q//og;
# print "QID:$QID:BESCHR:$beschreibung:\n";
if ($beschreibung =~ /ehemalige Kommunge/i) {
$beschreibung =~ s/Kommunge/Kommune/og;
}
if (($beschreibung ne "") && ($QID > 0)) {
print "Q".$QID."\tDde\t\"$beschreibung\"\n"; # description de - beschreibung
}
}
close(IN);