query-caa6129c965cc5a184983bbe0bd5afff

rq turtle/ttl

Propertiesinstance of (P31)country (P17)flag image (P41)sports season of league or competition (P3450)part of (P361)has part(s) (P527)

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#>
#defaultView:Tree
SELECT ?country ?countryLabel ?countryFlag ?championship ?championshipLabel ?year ?yearLabel ?race ?raceLabel
WHERE {
  #BIND(wd:Q38 as ?country)
  ?championship wdt:P31 wd:Q2306612;
                wdt:P17 ?country.
  ?country wdt:P41 ?countryFlag.

  {
    ?year wdt:P31 ?championship.
  } UNION {
    ?year wdt:P31 wd:Q27020041.
    { 
      ?year wdt:P3450 ?championship.
#     } UNION {
#       ?year rdfs:label ?itLabel.
#       FILTER(LANG(?itLabel) = "it" && STRSTARTS(?itLabel, "Campionato italiano di ciclismo su strada")).
    }
  }

  OPTIONAL { { ?race wdt:P361 ?year. } UNION { ?year wdt:P527 ?race. } }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr". }
}
ORDER BY ?countryLabel ?championshipLabel ?yearLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?championship"):::projected v2("?championshipLabel"):::projected v5("?country"):::projected v6("?countryFlag"):::projected v1("?countryLabel"):::projected v8("?race"):::projected v7("?year"):::projected v3("?yearLabel"):::projected c5(["wd:Q27020041"]):::iri c10(["bd:serviceParam"]):::iri c2(["wd:Q2306612"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en,fr"]):::literal v4 --"wdt:P31"--> c2 v4 --"wdt:P17"--> v5 v5 --"wdt:P41"--> v6 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v7 --"wdt:P31"--> c5 v7 --"wdt:P3450"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v7 --"wdt:P31"--> v4 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v7 -."wdt:P527".-> v8 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v8 --"wdt:P361"--> v7 end union1r <== or ==> union1l end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end