forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwd_p31.rq
71 lines (70 loc) · 2.86 KB
/
wd_p31.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
# Add org type to item
#
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
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 distinct ?pm20Id ?pm20Label ?name (?wdId as ?qid) (?classQid as ?classQids) ?qs
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' )
}
#
# get items missing a class
service <https://query.wikidata.org/sparql> {
?wd p:P4293 ?statement .
?statement ps:P4293 ?pm20Id .
optional {
?statement pq:P4390 ?relType .
}
filter(!bound(?relType))
filter(strstarts(?pm20Id, 'co/'))
bind(strafter(str(?wd), str(wd:)) as ?wdId)
#
# exclude items with class set
optional {
?wd wdt:P31 ?class .
}
filter(!bound(?class))
}
# query restricts result to folders with documents
?pm20 a zbwext:CompanyFolder ;
dct:identifier ?pm20Id ;
skos:prefLabel ?pm20Label ;
zbwext:adjustedLabel ?name ;
dc:type ?orgType .
#
# create qs links
##bind(concat(?wdId, '|P31|', ?classQid) as ?qs)
}
order by ?orgType