query-cf5c9ab4539894603cdbd341dceb7e33
Future Events SELECT ?event ?eventLabel ?date WHERE { # find events ?event ?timeproperty ?date. FILTER(BOUND(?date) && DATATYPE(?date) = xsd:dateTime). #?timeproperty wdt:P31 wd:Q18636219 .
# in the future
BIND(NOW() - ?date AS ?distance).
FILTER(0 >= ?distance).
# and get a label as well
OPTIONAL {
?event rdfs:label ?eventLabel.
FILTER(LANG(?eventLabel) = "en").
}
} ORDER BY ?date
limit to 10 results so we don't timeout
LIMIT 10
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
#Future Events
SELECT ?event ?eventLabel ?date
WHERE
{
# find events
?event ?timeproperty ?date.
FILTER(BOUND(?date) && DATATYPE(?date) = xsd:dateTime).
#?timeproperty wdt:P31 wd:Q18636219 .
# in the future
BIND(NOW() - ?date AS ?distance).
FILTER(0 >= ?distance).
# and get a label as well
OPTIONAL {
?event rdfs:label ?eventLabel.
FILTER(LANG(?eventLabel) = "en").
}
}
ORDER BY ?date
# limit to 10 results so we don't timeout
LIMIT 10
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?date"):::projected
v6("?distance")
v4("?event"):::projected
v3("?eventLabel"):::projected
v5("?timeproperty")
f0[["'0^^xsd:integer' >= ?distance"]]
f0 --> v6
f1[["bound(?date)?date = 'xsd:dateTime'"]]
f1 --> v1
v4 -->v5--> v1
bind2[/"NOW() - ?date"/]
v1 --o bind2
bind2 --as--o v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."rdfs:label".-> v3
end