forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstw_dbpedia_mapping.rq
43 lines (40 loc) · 1.34 KB
/
stw_dbpedia_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
# Links STW - DBpedia, derived from Wikidata
# (use only English DBpedia)
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
#
select distinct ?stw ?stwLabel ?skosRelation ?dbpedia ?dbpediaLabel
where {
#add label of stw-id
service <https://zbw.eu/beta/sparql/stw/query> {
?stw skos:prefLabel ?prefLabel .
filter(lang(?prefLabel) = 'en')
bind(str(?prefLabel) as ?stwLabel)
}
#?wd wdt:P3911 ?stwId .
?wd p:P3911 ?statement .
?statement ps:P3911 ?stwId .
filter(isLiteral(?stwId))
bind(uri(concat('http://zbw.eu/stw/descriptor/', ?stwId)) as ?stw)
# skosRelation output
optional {
?statement pq:P4390 ?relation .
?relation wdt:P2888 ?skosRelation .
}
#
optional {
# sitelinks to English Wikipedia
?page schema:about ?wd ;
schema:isPartOf <https://en.wikipedia.org/> .
# DBpedia link is directly derived from Wikipedia link
bind(uri(replace(str(?page), 'https://en.wikipedia.org/wiki', 'http://dbpedia.org/resource')) as ?dbpedia)
# page title
?page schema:name ?name .
bind(str(?name) as ?dbpediaLabel)
}
}