forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompanies_missing_in_wikidata.rq
105 lines (102 loc) · 4.12 KB
/
companies_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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Extract information for creating missing company items in Wikidata
#
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX frapo: <http://purl.org/cerif/frapo/>
PREFIX gndo: <https://d-nb.info/standards/elementset/gnd#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX schema: <http://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
#
select ?pm20 ?pm20Label ?adjustedLabel ?incepted ?abandoned ?gndId
?pm20Id ?docCount
(group_concat(distinct ?classQid; separator='|') as ?classQids)
(group_concat(distinct ?typeDe; separator='; ') as ?descrDe)
(group_concat(distinct ?typeEn; separator='; ') as ?descrEn)
(group_concat(distinct ?altLabel; separator='|') as ?altLabels)
where {
# organization type mappings
values ( ?orgType ?classQid ?typeEn ) {
( 'Unternehmen'@de 'Q4830453' 'business' )
( 'Kolonialgesellschaft'@de 'Q1700154' 'colonial society' )
( 'Verein'@de 'Q988108' 'association' )
( 'Körperschaft des öffentlichen Rechts'@de 'Q15734684' 'Körperschaft des öffentlichen Rechts' )
( 'Konzern'@de 'Q206361' 'concern' )
( 'Dachgesellschaft'@de 'Q219577' 'holding company' )
( 'Zentralbank'@de 'Q66344' 'central bank' )
( 'Kammern, Verbände'@de 'Q15911314' 'chamber, association' )
( 'Ausseruniversitäre Forschungseinrichtungen'@de 'Q31855' 'research institute' )
( 'Fachgesellschaften und Berufsverbände'@de 'Q1391145' 'professional society' )
( 'Internationale Organisationen'@de 'Q484652' 'international organization' )
( 'Unternehmenskartell'@de 'Q179216' 'cartel' )
( 'Hochschulen und deren Einrichtungen'@de 'Q38723' 'university, university institute' )
( 'Regiebetrieb, Eigenbetrieb'@de 'Q40890107' 'municipal enterprise' )
( 'Tochergesellschaft'@de 'Q658255' 'subsidiary' )
( 'Weitere Institutionen'@de 'Q178706' 'institution' )
( 'Gewerkschaft'@de 'Q178790' 'union' )
( 'Institution'@de 'Q178706' 'institution' )
( 'Bibliotheken und Archive'@de 'Q1030034' 'libraries and archives' )
( 'Stiftung'@de 'Q18631232' 'foundation' )
( 'Verlage und Datenbankanbieter'@de 'Q2085381' 'publisher ' )
( 'Kongresse, Tagungen'@de 'Q625994' 'convention' )
( 'Public Private Partnership'@de 'Q221096' 'public private partnership' )
( 'Arbeitsgemeinschaft'@de 'Q15783838' 'working group' )
}
#
# determine for which entries we want to create items
{
?pm20 a zbwext:CompanyFolder ;
dc:type ?orgType ;
skos:prefLabel ?pm20Label ;
dct:identifier ?pm20Id ;
zbwext:adjustedLabel ?adjustedLabel ;
frapo:hasCountryCode ?country ;
zbwext:totalDocCount ?docCount .
#
# this is the filter for defining the separate mnm catalogs (parts)
bind(
if(?country in ('NL', 'ID', 'AO'), 'nl',
if(?country in ('GB', 'US', 'CA', 'AU', 'ZA', 'IE', 'MY', 'ZW'), 'en',
if(?country in ('FR', 'VN', 'BE', 'CD', 'LU', 'DZ'), 'fr',
if(?country in ('DE', 'AT', 'CH', 'HU', 'TZ', 'PL', 'CZ', 'WS'), 'de',
'und')))) as ?wikiLang)
##filter(?wikiLang = 'und')
}
# minus all entries which are linked to WD items
optional {
service <https://query.wikidata.org/sparql> {
?wd p:P4293 ?statement .
?statement ps:P4293 ?pm20Id .
optional {
?statement pq:P4390 ?relType .
}
# let related matches pass
filter(!bound(?relType) || ?relType!=wd:Q39894604)
}
}
filter(!bound(?wd))
filter(lang(?orgType) = 'de')
bind(str(?orgType) as ?typeDe)
#
# now get further information to add to WD
#
optional {
?pm20 schema:foundingDate ?incepted .
}
optional {
?pm20 schema:dissolutionDate ?abandoned .
}
optional {
?pm20 gndo:gndIdentifier ?gndId .
}
optional {
?pm20 skos:altLabel ?altLabel .
}
}
group by ?docCount ?pm20 ?pm20Label ?adjustedLabel ?incepted ?abandoned ?gndId ?pm20Id
order by desc(?docCount) ?pm20Label