query-222864b7fd89dfce138a871e7da1dc18

rq turtle/ttl

Time of discovery of asteroids

Use at

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 ?asteroid ?asteroidLabel ?date WHERE {
  ?asteroid wdt:P31 wd:Q3863;
            wdt:P575 ?date.

  BIND(YEAR(?date) AS ?year)
  BIND(MONTH(?date) AS ?month)
  BIND(DAY(?date) AS ?day)

  FILTER((?month = 10)||(?month = 11))
  FILTER(IF((?month = 10),(?day > 22)&&(?day <= 31), IF((?month = 11),(?day > 1)&&(?day <= 23), ?day = 1))).

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } 
}
ORDER BY ?year

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?asteroid"):::projected v5("?date"):::projected v6("?day") v6("?month") v6("?year") c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;"]):::literal c8(["wd:Q3863"]):::iri f0[["if(?month = '10^^xsd:integer',?day > '22^^xsd:integer'?day <= '31^^xsd:integer',if(?month = '11^^xsd:integer',?day > '1^^xsd:integer'?day <= '23^^xsd:integer',?day = '1^^xsd:integer'))"]] f0 --> v6 f0 --> v6 f1[["(?month = '10^^xsd:integer' || ?month = '11^^xsd:integer')"]] f1 --> v6 v4 --"wdt:P31"--> c8 v4 --"wdt:P575"--> v5 bind2[/"year-from-dateTime(?date)"/] v5 --o bind2 bind2 --as--o v6 bind3[/"month-from-dateTime(?date)"/] v5 --o bind3 bind3 --as--o v6 bind4[/"day-from-dateTime(?date)"/] v5 --o bind4 bind4 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end