## Description
Overview:
We can greatly reduce the bandwidth and processing needed for calls to [[ https://www.wikifunctions.org/view/en/Z6821 | Z6821/Fetch Wikidata item ]] if we provide parameters allowing those calls to specify
# which content is needed (labels, aliases, descriptions and/or statements)
# which languages are of interest in labels, aliases, and descriptions
# which properties are of interest in statements.
(1) and (2) can be passed through to Wikidata's `wbgetentities` API, which already provides those filters. Filtering for (3) can easily be implemented in the orchestrator.
If and when Wikifunctions can have optional parameters, these could be optional. Alternatively, we could have 2 versions of each fetch function – one with and one without these parameters.
**Benefits of using these parameters:**
- The JSON returned from Wikidata can be far smaller, greatly reducing the bandwidth used for fetches.
- The resulting ZObject can also be much smaller, eliminating some orchestrator processing.
- If the resulting ZObject is passed to another Wikifunction that needs to sift through labels/aliases/descriptions, the much-smaller size of those lists will also help with the performance of that sifting.
- The smaller ZObjects will also mean less processing in WikiLambda for presenting them, and will be somewhat easier to browse in the UI.
**Concerns**
- Getting the benefits requires some user knowledge & effort, in specifying the values of the optimization parameters.
- When a fetch function is called in a composition, and it's desirable to pass these parameters to the fetch function, that might sometimes necessitate adding the parameters to the calling function.
**Background:**
- Wikidata Items typically have labels in many languages, aliases in many languages, and descriptions in many languages.
- Many calls to [[ https://www.wikifunctions.org/view/en/Z6821 | Z6821/Fetch Wikidata item ]] will be made for a specific language-generation purpose, in which the target language is known in advance.
- Similarly, many calls will be made in a context in which the value of a particular statement is needed, and the statement property is known in advance.
- Some known performance problems related to Wikidata fetches (such as the problem underlying T378414) are caused by text snippets in many different languages (such as 90+ glosses in L1).
- In addition to helping with current performance problems, these changes will also provide substantial network & processing savings over time.
We can also consider adding these parameters to the other Wikidata fetch functions; [[ https://www.wikifunctions.org/view/en/Z6821 | Z6821/Fetch Wikidata item ]] is featured here because items tend to have the most labels/aliases/descriptions, and probably the most statements as well.
## Completion checklist
* [ ] Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Back-end_Task/Bug_completion_checklist