query-f17daece19dc1a8d598c378222f8c3c9
title: Wikidata items used as "stated in" references for items on focus list select distinct ?ref ?refLabel (group_concat(distinct ?typeLabel; separator="; ") as ?refType) (count(distinct ?item) as ?num_items) where { ?item wdt:P5008 wd:Q108040915; ?propertyRel ?statement. ?statement prov:wasDerivedFrom ?refnode. ?refnode pr:P248 ?ref. ?ref wdt:P31 ?type. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?ref rdfs:label ?refLabel. ?type rdfs:label ?typeLabel} } group by ?ref ?refLabel order by desc(?num_items)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Wikidata items used as "stated in" references for items on focus list
select distinct ?ref ?refLabel
(group_concat(distinct ?typeLabel; separator="; ") as ?refType)
(count(distinct ?item) as ?num_items)
where {
?item wdt:P5008 wd:Q108040915;
?propertyRel ?statement.
?statement prov:wasDerivedFrom ?refnode.
?refnode pr:P248 ?ref.
?ref wdt:P31 ?type.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?ref rdfs:label ?refLabel.
?type rdfs:label ?typeLabel}
} group by ?ref ?refLabel
order by desc(?num_items)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v11("?num_items")
v3("?propertyRel")
v6("?ref"):::projected
v8("?refLabel"):::projected
v10("?refType")
v5("?refnode")
v4("?statement")
v7("?type")
v9("?typeLabel"):::projected
c7(["bd:serviceParam"]):::iri
c2(["wd:Q108040915"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wdt:P5008"--> c2
v2 -->v3--> v4
v4 --"prov:wasDerivedFrom"--> v5
v5 --"pr:P248"--> v6
v6 --"wdt:P31"--> v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
v6 --"rdfs:label"--> v8
v7 --"rdfs:label"--> v9
end
bind2[/"?typeLabel"/]
v9 --o bind2
bind2 --as--o v10
bind3[/"count(?item)"/]
v2 --o bind3
bind3 --as--o v11