forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathje_for_openrefine.rq
55 lines (52 loc) · 1.6 KB
/
je_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
# Create a table of je entries for OpenRefine
# (je = Alte HWWA Sachklassifikation)
#
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
PREFIX schema: <http://schema.org/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX gndo: <https://d-nb.info/standards/elementset/gnd#>
#
select distinct ?id ?notationLong ?notation ?labelDe ?labelEn (str(count(distinct ?pm20)) as ?cnt)
where {
graph <http://zbw.eu/beta/subject/ng> {
?s skos:prefLabel ?labelLangDe ;
skos:notation ?notation ;
zbwext:notationLong ?notationLong ;
dct:identifier ?id .
# restrict to subset of 2nd level entries
#filter(strlen(?notationLong) = 4 || strlen(?notationLong) =5)
filter(lang(?labelLangDe) = 'de')
bind(str(?labelLangDe) as ?labelDe)
optional {
?s skos:prefLabel ?labelLangEn .
filter(lang(?labelLangEn) = 'en')
bind(str(?labelLangEn) as ?labelEn)
}
#
# gnd for indirect mapping
# optional {
# ?s gndo:gndIdentifier ?gndId .
# }
#
# filter(not exists {
# ?s skos:exactMatch ?wd .
# filter(contains(str(?wd), 'wikidata'))
# }
# )
optional {
?broader skos:narrower ?s ;
skos:prefLabel ?broaderLangDe .
filter(lang(?broaderLangDe) = 'de')
bind(str(?broaderLangDe) as ?broaderDe)
}
optional {
?s skos:note ?note .
filter(!contains(?note, 'folderCount'))
}
}
?pm20 zbwext:subject ?s .
}
group by ?s ?id ?notation ?notationLong ?labelEn ?labelDe
order by ?notationLong ?id