forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathag_for_openrefine.rq
51 lines (49 loc) · 1.57 KB
/
ag_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
# Create a table of not-yet mapped ag entries for OpenRefine
# (ag = Historische Länderklassifikation)
#
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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 ?broaderEn ?id (concat('gnd', max(?gndId)) as ?byGnd) ?labelDe ?labelEn (str(max(?note)) as ?noteDe) (group_concat( ?gndId; separator=' | ') as ?gndIds)
where {
graph <http://zbw.eu/beta/geo/ng> {
?s skos:prefLabel ?labelLangEn ;
dct:identifier ?id .
filter(lang(?labelLangEn) = 'en')
bind(str(?labelLangEn) as ?labelEn)
?s skos:prefLabel ?labelLangDe .
filter(lang(?labelLangDe) = 'de')
bind(str(?labelLangDe) as ?labelDe)
#
# gnd for indirect mapping
optional {
?s gndo:gndIdentifier ?gndId .
}
# only entries with folders!
filter(exists {
{ ?s zbwext:shFolderCount [] }
union
{ ?s zbwext:waFolderCount [] }
})
# filter out existing entries in WD
filter(not exists {
?s skos:exactMatch ?wd .
filter(contains(str(?wd), 'wikidata'))
}
)
?broader skos:narrower ?s ;
skos:prefLabel ?broaderLangEn .
filter(lang(?broaderLangEn) = 'en')
bind(str(?broaderLangEn) as ?broaderEn)
optional {
?s skos:scopeNote ?note .
}
}
}
group by ?id ?labelDe ?labelEn
order by ?nta