As an editor I want to query for data containing dates in order to find the events. For example: querying with property point in time
Problem:
Right now we do not allow querying for date values
Example:
Querying for point in time with value say 20-01-2021 that would return the inauguration of Joe Biden.
BDD
GIVEN a visual query
WHEN selecting a property having data type time
THEN the editor can enter date value
Acceptance criteria:
- result is displayed when querying for a Property with data type time
Notes:
- At the moment, we do not allow querying for date ranges. This will be handled in T272692: (MS3) Query for specific property with values in a specific range.
- needs Date input component T273002: (MS 6) Create Date input component
- We only support 3 degrees of precision: day, month, year
Query Examples:
Something happened on a day https://w.wiki/34zC:
# day -> precision === 11 SELECT ?item ?itemLabel WHERE { ?item p:P585/psv:P585/wikibase:timeValue "+1789-07-14T00:00:00Z"^^xsd:dateTime. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } }
something happened in a month https://w.wiki/34zD:
# month -> precision === 10 SELECT ?item ?itemLabel WHERE { ?item p:P585/psv:P585 ?timeValue. # has at least the given precision i.e. month ?timeValue wikibase:timePrecision ?precision. hint:Prior hint:rangeSafe true. # important for performance FILTER(?precision >= 10) # month precision # points to the correct month ?timeValue wikibase:timeValue ?dateTime. hint:Prior hint:rangeSafe true. # important for performance FILTER("1789-07-00"^^xsd:dateTime <= ?dateTime && ?dateTime < "1789-08-00"^^xsd:dateTime) # must be manually calculated SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } }
something happened in a year https://w.wiki/34zE:
# year -> precision === 9 SELECT ?item ?itemLabel WHERE { ?item p:P585/psv:P585 ?timeValue. # has at least the given precision i.e. year ?timeValue wikibase:timePrecision ?precision. hint:Prior hint:rangeSafe true. # important for performance FILTER(?precision >= 9) # year precision # points to the correct month ?timeValue wikibase:timeValue ?dateTime. hint:Prior hint:rangeSafe true. # important for performance FILTER("1789-00-00"^^xsd:dateTime <= ?dateTime && ?dateTime < "1790-00-00"^^xsd:dateTime) # must be manually calculated SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } }
TODO:
- how does the query look like for things that did not happen on a given date/month/year?
- this doesn't make sense to query, but it can be built with the query builder so we need to be able to create it as a SPARQL query