query-3d551b3d0169ab1027e5648fe34c3827
Disciplines and eventsNumber of events per discipline for a Games edition:
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#>
SELECT ?sport ?sportLabel ?discipline ?disciplineLabel (COUNT(DISTINCT ?event) AS ?cnt_events) (COUNT(DISTINCT ?cc) AS ?cnt_cc) WHERE {
BIND(wd:Q8613 AS ?games) .
?event wdt:P31 wd:Q18536594; wdt:P361 ?discipline .
?discipline wdt:P31 wd:Q26132862; wdt:P361 ?games .
MINUS { ?event wdt:P31 wd:Q2122052 }
OPTIONAL { ?event wdt:P641 ?sport }
OPTIONAL { ?event wdt:P2094 ?cc }
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} GROUP BY ?sport ?sportLabel ?discipline ?disciplineLabel ORDER BY ASC(?disciplineLabel) ASC(?sportLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?cc"):::projected
v9("?cnt_cc")
v8("?cnt_events")
v5("?discipline"):::projected
v1("?disciplineLabel"):::projected
v4("?event"):::projected
v3("?games")
v6("?sport"):::projected
v2("?sportLabel"):::projected
c5(["wd:Q2122052"]):::iri
c9(["bd:serviceParam"]):::iri
c2(["wd:Q18536594"]):::iri
c11(["en"]):::literal
c4(["wd:Q26132862"]):::iri
bind0[/"'wd:Q8613'"/]
bind0 --as--o v3
v4 --"wdt:P31"--> c2
v4 --"wdt:P361"--> v5
v5 --"wdt:P31"--> c4
v5 --"wdt:P361"--> v3
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v4 --"wdt:P31"--> c5
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P641".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P2094".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind4[/"count(?event)"/]
v4 --o bind4
bind4 --as--o v8
bind5[/"count(?cc)"/]
v7 --o bind5
bind5 --as--o v9