Michael created this task. Michael added projects: Wikidata, Wikidata Query Builder. Restricted Application added a subscriber: Aklapper.
TASK DESCRIPTION if `buildQuery` is called with a `QueryRepresentation` that includes a date condition, it produces the correct SPARQL depending on the precision. IMPORTANT: The queries for month and year precision need to have the end part of their time interval calculated. For months this may include wrapping around the 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" } } TASK DETAIL https://phabricator.wikimedia.org/T277039 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Michael Cc: Aklapper, Michael, maantietaja, Akuckartz, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, abian, Wikidata-bugs, aude, Mbch331
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
