Page MenuHomePhabricator

Provide a way to access qualifier-specific values on Wikidata
Closed, DeclinedPublic

Description

Right now, the property parser function allows one to fetch the corresponding value of a claim/statement on Wikidata. However, this is not enough for cases like accessing qualifier-specific data (e.g. metropolitan and rural population of a location).

Considering this item on Wikidata, that would be good to have a new parser function to fetch different population figures, so

{{#property:P1082|from=Q2674064|q1=P585|v1=2014|q2=P518|v2=rural area}}

would yield the value 12877.

Event Timeline

Superyetkin added a project: ParserFunctions.
matej_suchanek raised the priority of this task from Medium to Needs Triage.May 22 2016, 4:59 PM
hoo subscribed.

The parser function is only supposed for simple straight-forward data access. Complex selectors like this should be expressed in Lua.

I am not sure the desired functionality can be achieved via Lua. What would be the steps to take for implementing such a module?

@Superyetkin With Lua ([[https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua#mw.wikibase.getEntity|mw.wikibase.getEntity]]) you can load a [[https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua#mw.wikibase.entity|mw.wikibase.entity]] table (with a structure as described on mw:Wikibase/DataModel/JSON). That table contains the full entity, including all qualifiers, which can be programmatically extracted and filtered.