query-f37cba602db2365b2f855eefb1a71f7f
Propertiesinstance of (P31)part of (P361)start time (P580)end time (P582)point in time (P585)
Use at
- https://query.wikidata.org/sparql
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(?end >= (NOW() - "P1D"^^xsd:duration))
FILTER((NOW()) >= ?date)
}
ORDER BY ?date
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?comp")
v5("?competition"):::projected
v8("?date"):::projected
v2("?end"):::projected
v4("?pointInTime")
v7("?segment")
v3("?start")
c10(["bd:serviceParam"]):::iri
c3(["wd:Q2990963"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c4(["wd:Q16510064"]):::iri
f0[["NOW() >= ?date"]]
f0 --> v8
f1[["?end >= NOW() - 'P1D^^xsd:duration'"]]
f1 --> v2
f2[["(bound(?start) || bound(?pointInTime))"]]
f2 --> v3
f2 --> v4
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;
v5 --"wdt:P361"--> v7
v7 --"wdt:P31"--> c4
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P31"--> c4
v5 --"wdt:P361"--> v6
v6 --"wdt:P31"--> c3
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v5 --"wdt:P31"--> c3
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P580".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P582".-> v2
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P585".-> v4
end
bind3[/"?start?pointInTime"/]
v3 --o bind3
v4 --o bind3
bind3 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end