query-3ae6a9ac756fa262012c05f2ff1b6942
title: Topics of works within scope of WikiProject Invasion Biology SELECT ?count ?topic ?topicLabel ?example_work ?example_workLabel WITH { SELECT DISTINCT ?topic (SAMPLE(?work) AS ?example_work) (COUNT(?work) AS ?count) WHERE { # Find works for the specific queried topic ?work wdt:P6104 wd:Q56241615 .
# Find co-occuring topics
?work wdt:P921 ?topic .
} GROUP BY ?topic } AS %result WHERE { # Label the results INCLUDE %result SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh" . } } ORDER BY DESC(?count) LIMIT 200
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: Topics of works within scope of WikiProject Invasion Biology
SELECT ?count ?topic ?topicLabel ?example_work ?example_workLabel
WHERE {
# Label the results
{
SELECT DISTINCT ?topic (SAMPLE(?work) AS ?example_work) (COUNT(?work) AS ?count) WHERE {
# Find works for the specific queried topic
?work wdt:P6104 wd:Q56241615 .
# Find co-occuring topics
?work wdt:P921 ?topic .
}
GROUP BY ?topic
} SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,de,es,fr,jp,nl,no,ru,sv,zh" . }
}
ORDER BY DESC(?count)
LIMIT 200
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?count"):::projected
v4("?example_work"):::projected
v3("?topic"):::projected
v2("?work")
c7(["en,da,de,es,fr,jp,nl,no,ru,sv,zh"]):::literal
c5(["bd:serviceParam"]):::iri
c2(["wd:Q56241615"]):::iri
v2 --"wdt:P6104"--> c2
v2 --"wdt:P921"--> v3
bind2[/"sample(?work)"/]
v2 --o bind2
bind2 --as--o v4
bind3[/"count(?work)"/]
v2 --o bind3
bind3 --as--o v5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end