query-58e7d23138e37c7eb14cb7a987e36696
How much are items about rivers used in Wikidata (one country)
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 bd: <http://www.bigdata.com/rdf#>
#title:How much are items about rivers used in Wikidata: river items used as value (sample country: France)
#defaultView:BarChart
# based on query by https://www.wikidata.org/wiki/User:Tagishsimon , 2022-03-05
SELECT (STR(?claims) as ?no_of_incoming_links) (COUNT(?claims) as ?no_of_rivers) (SAMPLE(?river) as ?sample_river)
WHERE
{
{
SELECT ?river (count(?item) as ?items) (count(distinct ?item) as ?claims) WHERE {
{
SELECT distinct ?river WHERE {
?river wdt:P31/wdt:P279* wd:Q55659167.
?river wdt:P17 wd:Q142 . # sample country
}
} OPTIONAL { ?item ?predicate ?river .
?property wikibase:directClaim ?predicate . }
} group by ?river
} # SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,en". }
}
GROUP BY ?claims
ORDER BY DESC(?claims)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?claims"):::projected
v3("?item")
v6("?items")
v7("?no_of_incoming_links")
v8("?no_of_rivers")
v4("?predicate")
v5("?property")
v2("?river"):::projected
v9("?sample_river")
a1((" "))
c3(["wd:Q55659167"]):::iri
c5(["wd:Q142"]):::iri
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v2 --"wdt:P17"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -->v4--> v2
v5 -."wikibase:directClaim".-> v4
end
bind2[/"count(?item)"/]
v3 --o bind2
bind2 --as--o v6
bind3[/"count(?item)"/]
v3 --o bind3
bind3 --as--o v7
bind6[/"str(?claims)"/]
v7 --o bind6
bind6 --as--o v7
bind7[/"count(?claims)"/]
v7 --o bind7
bind7 --as--o v8
bind8[/"sample(?river)"/]
v2 --o bind8
bind8 --as--o v9