forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathip_for_openrefine.rq
57 lines (56 loc) · 1.75 KB
/
ip_for_openrefine.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
# Create a table of ip entries for OpenRefine
# (ip = Alte HWWA Warenklassifikation)
#
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX gndo: <https://d-nb.info/standards/elementset/gnd#>
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 distinct (str(?s) as ?descriptor)
(sample(?byGndX) as ?byGnd) ?byLabelsDe ?byLabelsEn
('' as ?rel) ?broaderDe ?notation (str(?note) as ?noteDe) ?id (max(?gndIdentifier) as ?gndId) ?s
where {
graph <http://zbw.eu/beta/film/ng> {
?section a zbwext:Pm20FilmItem ;
zbwext:ware ?s .
filter contains(str(?section), '/h1/')
}
graph <http://zbw.eu/beta/ware/ng> {
?s skos:prefLabel ?labelLangDe ;
skos:notation ?notation ;
dct:identifier ?id .
filter(lang(?labelLangDe) = 'de')
bind(str(?labelLangDe) as ?byLabelsDe)
optional {
?s skos:prefLabel ?labelLangEn .
filter(lang(?labelLangEn) = 'en')
bind(str(?labelLangEn) as ?byLabelsEn)
}
#
# gnd for indirect mapping
optional {
?s gndo:gndIdentifier ?gndIdentifier .
}
bind(if(bound(?gndIdentifier), 'some gnd', '') as ?byGndX)
#
optional {
?broader skos:narrower ?s ;
skos:prefLabel ?broaderLangDe .
filter(lang(?broaderLangDe) = 'de')
bind(str(?broaderLangDe) as ?broaderDe)
}
optional {
?s skos:scopeNote ?note .
filter(!contains(?note, 'folderCount'))
}
} minus {
service <https://query.wikidata.org/sparql> {
?wd wdt:P10890 ?id .
}
}
}
group by ?s ?broaderDe ?id ?notation ?byLabelsEn ?byLabelsDe ?note
order by ?notation ?id