query-ab35957f0289aa16d2fea214675c968b
Olympic sports discipline event subclasses (with number of instances):
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (GROUP_CONCAT(DISTINCT ?type; SEPARATOR=', ') AS ?types) (GROUP_CONCAT(DISTINCT ?superclass; SEPARATOR=', ') AS ?superclasses) (COUNT(DISTINCT ?backlink) AS ?backlinks) WHERE {
?item wdt:P279+ wd:Q26132862 .
OPTIONAL { ?item wdt:P31/rdfs:label ?type . FILTER(LANG(?type) = 'en') }
OPTIONAL { ?item wdt:P279/rdfs:label ?superclass . FILTER(LANG(?superclass) = 'en') }
OPTIONAL { ?backlink wdt:P31 ?item }
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} GROUP BY ?item ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?backlink"):::projected
v7("?backlinks")
v3("?item"):::projected
v1("?superclass"):::projected
v6("?superclasses")
v2("?type"):::projected
v5("?types")
a1((" "))
a2((" "))
c7(["bd:serviceParam"]):::iri
c1(["en"]):::literal
c3(["wd:Q26132862"]):::iri
v3 --"wdt:P279"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P31".-> a1
a1 --"rdfs:label"--> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P279".-> a2
a2 --"rdfs:label"--> v1
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P31".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c1
end
bind3[/"?type"/]
v2 --o bind3
bind3 --as--o v5
bind4[/"?superclass"/]
v1 --o bind4
bind4 --as--o v6
bind5[/"count(?backlink)"/]
v4 --o bind5
bind5 --as--o v7