forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeo_wd_mapping.rq
42 lines (41 loc) · 1.25 KB
/
geo_wd_mapping.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
# Mapping of PM20 countries to Wikidata
#
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 dct: <http://purl.org/dc/terms/>
PREFIX wd: <http://www.wikidata.org/entity/>
#
select distinct ?nta ?concept ?conceptLabel ?wd (str(max(?note)) as ?noteDe)
where {
graph <http://zbw.eu/beta/geo/ng> {
?concept skos:prefLabel ?labelLangEn ;
zbwext:notationLong ?ntaLong ;
skos:notation ?nta ;
dct:identifier ?id .
filter(lang(?labelLangEn) = 'en')
bind(str(?labelLangEn) as ?labelEn)
?concept skos:prefLabel ?labelLangDe .
filter(lang(?labelLangDe) = 'de')
bind(str(?labelLangDe) as ?labelDe)
#
optional {
?concept skos:scopeNote ?note .
filter(!contains(?note, 'FolderCount'))
}
}
# existing mappings to Wikidata
optional {
# ?nta is not bound within the service clause!
service <https://query.wikidata.org/sparql> {
select *
where {
?wd wdt:P8483 ?ntaWd .
}
}
filter(?ntaWd = ?nta)
}
bind(concat(str(?labelDe), ' | ', str(?labelEn)) as ?conceptLabel)
}
group by ?concept ?conceptLabel ?id ?labelDe ?labelEn ?wd ?nta ?ntaLong
order by ?ntaLong