query-c866c291d90bd33ff17071798e4c0df3
Number of disciplines and events at Summer Olympic Games
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 ?games ?gamesLabel ?disciplines ?events WHERE {
{
SELECT ?games (COUNT(distinct ?discipline) as ?disciplines) (COUNT(distinct ?event) AS ?events) WHERE {
?games wdt:P31 wd:Q159821 .
?discipline wdt:P361 ?games .
OPTIONAL {
?event wdt:P361 ?discipline .
?event wdt:P31 wd:Q18536594 .
}
} GROUP BY ?games
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} ORDER BY ASC(?gamesLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?discipline")
v5("?disciplines"):::projected
v4("?event")
v6("?events"):::projected
v2("?games"):::projected
v1("?gamesLabel"):::projected
c6(["bd:serviceParam"]):::iri
c4(["wd:Q18536594"]):::iri
c2(["wd:Q159821"]):::iri
c8(["en"]):::literal
v2 --"wdt:P31"--> c2
v3 --"wdt:P361"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P361".-> v3
v4 --"wdt:P31"--> c4
end
bind2[/"count(?discipline)"/]
v3 --o bind2
bind2 --as--o v5
bind3[/"count(?event)"/]
v4 --o bind3
bind3 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end