forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_wd_federation.rq
41 lines (39 loc) · 1.45 KB
/
example_wd_federation.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
# Folders from 20th Century Press Archives, extended with Wikipedia pages
#
PREFIX dct: <http://purl.org/dc/terms/>
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 *
where {
# Persons of Irish nationality with publicly
# accessible documents
?person skos:prefLabel ?personLabel ;
dct:identifier ?personId ;
schema:nationality "Ireland"@en ;
zbwext:freeDocCount ?freeDocCount .
filter(?freeDocCount > 0)
#
# Include information from the Wikidata Query Service
service <https://query.wikidata.org/sparql> {
# Wikidata items for the persons
?item wdt:P31 wd:Q5 ;
wdt:P4293 ?personId ;
wdt:P214 ?viafId .
#
# Add page links to the English Wikipedia
?page schema:about ?item ;
schema:isPartOf <https://en.wikipedia.org/> .
}
}
order by desc(?freeDocCount)
# Note: Queries with large datasets created before the service clause
# (e.g., asking for German persons instead of Irish) may take very long,
# because the intermediate results may be transmitted step by step to the
# external endpoint (implementation-dependent).
# It sometimes helps to reverse the inovocation order, i.e. to first
# query the external endpoint, and then filter the results with additional
# statements locally.