forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpm20_references.rq
38 lines (36 loc) · 1.28 KB
/
pm20_references.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
# Properties with reference from PM20
#
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX hint: <http://www.bigdata.com/queryHints#>
#
select ?prop ?propLabel (str(count(?item)) as ?countLabel)
(uri(concat('http://zbw.eu/beta/sparql-lab/?endpoint=https://query.wikidata.org/sparql',
'&queryRef=https://api.github.com/repos/zbw/sparql-queries/contents/wikidata/pm20_references_for_property.rq',
'&pid="', ?pid, '"')) as ?count)
where
{
hint:Query hint:optimizer "None" .
# stated in 20th century press archives and/or
# references a certain PM20 folder
{
?provenance pr:P248 wd:Q36948990 .
} union {
?provenance pr:P4293 [] .
}
?object prov:wasDerivedFrom ?provenance .
?item ?property ?object .
# q&d
bind(strafter(str(?property), 'http://www.wikidata.org/prop/') as ?pid)
bind(uri(concat('http://www.wikidata.org/entity/', ?pid)) as ?prop)
?prop rdfs:label ?propLabelEn .
filter(lang(?propLabelEn) = 'en')
bind(str( ?propLabelEn) as ?propLabel)
#
}
group by ?pid ?prop ?propLabel
order by desc(count(?item))