forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
persons_missing_in_wikidata.rq
65 lines (64 loc) · 2.23 KB
/
persons_missing_in_wikidata.rq
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
# Extract information for creating missing gnd person items in Wikidata
#
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX gnd: <https://d-nb.info/gnd/>
PREFIX gndo: <https://d-nb.info/standards/elementset/gnd#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
#
select ?gnd ?gndLabel ?mnm (?mnmId as ?mnmLabel) $gndId
('Q5' as ?classQid) ?occupationQid
# multiple dates will be catched by date syntax check later
(group_concat(distinct ?birth) as ?births) (group_concat(distinct ?death) as ?deaths)
(?occupationEn as ?descrEn)
(group_concat(?info;
separator = '; ') as ?infos)
(concat(?occupationDe, if(bound(?infos), concat(' (', ?infos, ')'), '')) as ?descrDe)
where {
#
# determine for which entries we want to create items
{
# already checked entries of M-n-m catalog
graph ?mnmGraph {
# catalog and state
# (late binding for ?mnmGraph!)
values ( ?catalogId ?maxCheckedId ) {
( '431' '19348270' )
}
bind(uri(concat('http://zbw.eu/beta/mix-n-match-', ?catalogId, '/ng')) as ?mnmGraph)
#
?gnd dc:identifier ?mnmId .
filter(?mnmId < ?maxCheckedId)
bind(uri(concat('https://tools.wmflabs.org/mix-n-match/#/entry/', ?mnmId)) as ?mnm)
bind(strafter(str(?gnd), 'https://d-nb.info/gnd/') as ?gndId)
}
} minus {
# minus all entries which are linked to WD items
service <https://query.wikidata.org/sparql> {
?wd wdt:P227 ?gndId .
}
}
values ( ?gndProfession ?occupationQid ?occupationDe ?occupationEn ) {
( gnd:4066533-1 'Q188094' 'Wirtschaftswissenschaftler' 'economist' )
( gnd:4270482-0 'Q188094' 'Wirtschaftswissenschaftlerin' 'economist' )
# ( gnd:4145078-4 undef 'Betriebswirt' 'business economist' )
}
#
# mandatory fields
?gnd gndo:preferredNameForThePerson ?gndLabel ;
gndo:professionOrOccupation ?gndProfession .
#
# additional info
optional {
?gnd gndo:dateOfBirth ?birth .
}
optional {
?gnd gndo:dateOfDeath ?death .
}
optional {
?gnd gndo:biographicalOrHistoricalInformation ?info .
}
}
group by ?gnd ?gndLabel ?mnm ?mnmId $gndId ?occupationQid ?occupationEn ?occupationDe
order by ?mnmId