query-93a422899336d5e7c9c3c43aa08d3c9d

rq turtle/ttl

Propertiesinstance of (P31)part of (P361)start time (P580)end time (P582)point in time (P585)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ?competition ?competitionLabel ?date ?end WHERE {
  { ?competition wdt:P31 wd:Q2990963. }
  UNION
  {
    ?competition wdt:P31 wd:Q16510064.
    ?competition wdt:P361 ?comp.
    ?comp wdt:P31 wd:Q2990963.
  }
  UNION
  {
    ?competition wdt:P361 ?segment.
    ?segment wdt:P31 wd:Q16510064.
  }
  OPTIONAL { ?competition wdt:P580 ?start. }
  OPTIONAL { ?competition wdt:P582 ?end. }
  OPTIONAL { ?competition wdt:P585 ?pointInTime. }
  BIND(COALESCE(?start, ?pointInTime) AS ?date)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  FILTER((BOUND(?start)) || (BOUND(?pointInTime)))
  FILTER(?date >= (NOW() - "P1D"^^xsd:duration))
}
ORDER BY ?date

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?comp") v4("?competition"):::projected v8("?date"):::projected v7("?end"):::projected v3("?pointInTime") v6("?segment") v2("?start") c10(["bd:serviceParam"]):::iri c3(["wd:Q2990963"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c4(["wd:Q16510064"]):::iri f0[["?date >= NOW() - 'P1D^^xsd:duration'"]] f0 --> v8 f1[["(bound(?start) || bound(?pointInTime))"]] f1 --> v2 f1 --> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P361"--> v6 v6 --"wdt:P31"--> c4 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P31"--> c4 v4 --"wdt:P361"--> v5 v5 --"wdt:P31"--> c3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P31"--> c3 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P580".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P582".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P585".-> v3 end bind2[/"?start?pointInTime"/] v2 --o bind2 v3 --o bind2 bind2 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end