As an editor I want to query for data involving quantity values.
Problem:
We currently don't allow querying for values of Properties with datatype quantity. We should.
Example:
- people with an Erdős number of 1
Error messages:
value empty
Copy: Please enter a number
value is NaN
Copy: Please enter a number
invalid unit selected
Copy: Please select a valid unit or remove input
error in value and unit
Copy: Please enter a number and select a valid unit or remove input
BDD
GIVEN a visual query
WHEN selecting a Property of datatype quantity
THEN the value input accepts quality values
AND the query result contains only results including an exact match for the given value
Acceptance criteria:
- queries with Properties of datatype quantity are possible
- quantity values incl. and excl. units are possible
Needed components:
Notes:
- We do not handle less than/more than etc. in this ticket, only exact matches. Ranges are handled in T272692.
- Not dealing with precision at all
The query that we're going to produce should look something like the following:
SELECT ?person ?Erdos WHERE { ?person p:P2021/psv:P2021/wikibase:quantityAmount ?Erdos . FILTER( ?Erdos = 1) } LIMIT 3
https://w.wiki/34zj
The query if the user provides a unit:
# convert kilometer into meter and then query SELECT * WHERE { BIND(4 AS ?userQuantity) BIND(wd:Q828224 AS ?userUnit) ?userUnit p:P2370/psv:P2370 [ wikibase:quantityAmount ?conversionFactor; wikibase:quantityUnit ?coherentUnit ]. BIND(?userQuantity * ?conversionFactor AS ?coherentQuantity) ?mountain p:P2044/psn:P2044 [ wikibase:quantityAmount ?elevation; wikibase:quantityUnit ?coherentUnit ]. FILTER(?elevation >= ?coherentQuantity) BIND(?elevation / ?conversionFactor AS ?userElevation) } LIMIT 10