Michael created this task.
Michael added projects: Wikidata Query Builder, Wikidata.
TASK DESCRIPTION
We need to adjust the buildQuery method to account for unit values to
produces correct SPARQL
produces correct sparql for the following cases:
[ ] property with value { value: 123, unit: `null` }
[ ] property with value { value: 123, unit: Q123 }
[ ] property without value { value: 123, unit: `null` }
[ ] property without value { value: 123, unit: Q123 }
Note: the sparql examples below illustrate the first two cases. The negated
cases still need their sparql figured out
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
https://w.wiki/34zm
TASK DETAIL
https://phabricator.wikimedia.org/T276938
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