query-a569ea6e62061cdc6556029459b98fe2

rq turtle/ttl

title: 最近发生的事件 SELECT ?event ?eventLabel ?date WITH { SELECT DISTINCT ?event ?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). # not in the future, and not more than 31 days ago BIND(NOW() - ?date AS ?distance). FILTER(0 <= ?distance && ?distance < 31). } LIMIT 150 } AS %i WHERE { INCLUDE %i SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . } }

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#>
#title: 最近发生的事件
SELECT ?event ?eventLabel ?date
WHERE {
   {
  SELECT DISTINCT ?event ?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).
    # not in the future, and not more than 31 days ago
    BIND(NOW() - ?date AS ?distance).
    FILTER(0 <= ?distance && ?distance < 31).
  }
  LIMIT 150
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?date"):::projected v4("?distance") v3("?event"):::projected a1((" ")) c10(["bd:serviceParam"]):::iri c6(["wd:Q1190554"]):::iri c12(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal f0[["'0^^xsd:integer' <= ?distance?distance < '31^^xsd:integer'"]] f0 --> v4 f1[["bound(?date)?date = 'xsd:dateTime'"]] f1 --> v2 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P585".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P580".-> v2 end bind2[/"NOW() - ?date"/] v2 --o bind2 bind2 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end