query-1e3d37c61126619807fbd5b93807f684

rq turtle/ttl

Future Events SELECT DISTINCT ?event ?eventLabel ?date WHERE { # find events ?event wdt:P31/wdt:P279* wd:Q1190554. # with a point in time or start date OPTIONAL { ?event wdt:P585 ?date. } OPTIONAL { ?event wdt:P580 ?date. } # but at least one of those FILTER(BOUND(?date) && DATATYPE(?date) = xsd:dateTime). # 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"). } }

limit to 100 results so we don't timeout

LIMIT 100

Use at

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 DISTINCT ?event ?eventLabel ?date
WHERE
{
    # find events
    ?event wdt:P31/wdt:P279* wd:Q1190554.
    # with a point in time or start date
    OPTIONAL { ?event wdt:P585 ?date. }
    OPTIONAL { ?event wdt:P580 ?date. }
    # but at least one of those
    FILTER(BOUND(?date) && DATATYPE(?date) = xsd:dateTime).
    # 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").
    }
}
# limit to 100 results so we don't timeout
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?date"):::projected v5("?distance") v4("?event"):::projected v3("?eventLabel"):::projected a1((" ")) c6(["wd:Q1190554"]):::iri f0[["'0^^xsd:integer' >= ?distance"]] f0 --> v5 f1[["bound(?date)?date = 'xsd:dateTime'"]] f1 --> v2 v4 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P585".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P580".-> v2 end bind2[/"NOW() - ?date"/] v2 --o bind2 bind2 --as--o v5 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v4 -."rdfs:label".-> v3 end