query-1a81a0cad8be78cd674ada52a5be2628

rq turtle/ttl

Events for a Games edition (optionally with competition classes):

Use at

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 ?discipline (GROUP_CONCAT(?cc; SEPARATOR=', ') AS ?all_cc) (GROUP_CONCAT(?sport_event; SEPARATOR=', ') AS ?all_sport_event) (GROUP_CONCAT(?sport_discipline; SEPARATOR=', ') AS ?all_sport_discipline) WHERE {
  BIND(wd:Q8613 AS ?games) .
  ?item wdt:P31 wd:Q18536594 .
  ?item wdt:P361 ?discipline .
  ?discipline wdt:P361 ?games; wdt:P31 wd:Q26132862 .
  MINUS { ?item wdt:P31 wd:Q2122052 } # qualification
  OPTIONAL { ?item wdt:P2094/rdfs:label ?cc . FILTER(LANG(?cc) = 'en') }
  OPTIONAL { ?discipline wdt:P641/rdfs:label ?sport_discipline . FILTER(LANG(?sport_discipline) = 'en') }
  OPTIONAL { ?item wdt:P641/rdfs:label ?sport_event . FILTER(LANG(?sport_event) = 'en') }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} GROUP BY ?item ?itemLabel ?discipline ORDER BY ASC(?all_sport_discipline) ASC(?all_sport_event)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?all_cc") v10("?all_sport_discipline") v10("?all_sport_event") v5("?cc"):::projected v8("?discipline"):::projected v6("?games") v7("?item"):::projected v4("?sport_discipline"):::projected v3("?sport_event"):::projected a1((" ")) a2((" ")) a3((" ")) c6(["wd:Q2122052"]):::iri c11(["bd:serviceParam"]):::iri c3(["wd:Q18536594"]):::iri c1(["en"]):::literal c5(["wd:Q26132862"]):::iri bind0[/"'wd:Q8613'"/] bind0 --as--o v6 v7 --"wdt:P31"--> c3 v7 --"wdt:P361"--> v8 v8 --"wdt:P361"--> v6 v8 --"wdt:P31"--> c5 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v7 --"wdt:P31"--> c6 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P2094".-> a1 a1 --"rdfs:label"--> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v8 -."wdt:P641".-> a2 a2 --"rdfs:label"--> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v7 -."wdt:P641".-> a3 a3 --"rdfs:label"--> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c1 end bind5[/"?cc"/] v5 --o bind5 bind5 --as--o v9 bind6[/"?sport_event"/] v3 --o bind6 bind6 --as--o v10 bind7[/"?sport_discipline"/] v4 --o bind7 bind7 --as--o v10