forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmissing_class_via_pm20.rq
81 lines (80 loc) · 3.33 KB
/
missing_class_via_pm20.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
# Get missing class for WD items from PM20 organizations
#
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX gndo: <https://d-nb.info/standards/elementset/gnd#>
PREFIX hint: <http://www.bigdata.com/queryHints#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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 ?wd ?wdLabel ?orgType ?classQid ?qsStatement
where {
hint:Query hint:optimizer "None" .
#
# all companies from PM20
service <https://zbw.eu/beta/sparql/pm20/query> {
?pm20 a zbwext:CompanyFolder ;
skos:prefLabel ?pm20Label ;
dct:identifier ?pm20Id ;
dc:type ?orgType .
filter(lang(?orgType) = 'de')
}
#
values ( ?orgType ?classQid ?descrEn ) {
( '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' )
}
# all WD items for this subset
?wd wdt:P4293 ?pm20Id .
#
# exclude related matches (which may be of different type)
?wd p:P4293 ?statement .
filter(not exists {
?statement pq:P4390 wd:Q39894604 ;
ps:P4293 ?pm20Id .
}
)
#
# exclude all items which already have a class
filter(not exists {
?wd wdt:P31 [] .
}
)
# get other fields for display and for the statement
bind(strafter(str(?wd), 'http://www.wikidata.org/entity/') as ?wdId)
optional {
?wd rdfs:label ?wdLabelLang .
filter(lang(?wdLabelLang) = 'en')
bind(str(?wdLabelLang) as ?wdLabel)
}
bind(substr(str(now()), 0, 11) as ?today)
bind(concat(?wdId, '|P31|', ?classQid, '|S248|Q36948990|S1810|"', ?pm20Label, '"|S4293|"', ?pm20Id, '"|S813|+', ?today, 'T00:00:00Z/11') as ?qsStatement)
}
order by ?wdLabel