Wikifunctions:Status updates/2026-09-10
| ◀ | ▶ |
Your code can now call back to the Wikidata fetch functions
This week we have deployed an initial capability by which a code Implementation (in JavaScript or Python) can call certain other Wikifunctions Functions, get back the result, and have it available for further processing. The primary motivation for this new capability is to provide greater flexibility in the use of code, so that more can be done with them – which allows you to get the benefit of their performance advantages and enables a more streamlined Implementation structure for some Functions.
At present, due to security and performance concerns, only the following built-in Wikidata fetch and search Functions can be called in this way: Z6820 (Fetch Wikidata entities), Z6821 (Fetch Wikidata item), Z6822 (Fetch Wikidata property), Z6824 (Fetch Wikidata lexeme form), Z6825 (Fetch Wikidata lexeme), Z6826 (Fetch Wikidata lexeme sense), Z6830 (Find lexemes for item), and Z6831 (Find lexemes for lexeme sense). This capability is in an initial stage of deployment; we hope to allow calls to a broader range of Functions in the future. We focused on these first as they're impossible in user-written code (due to security lock-downs preventing all network access), rather than just irritating to need to re-implement like calls to other built-in functions or user-written ones would be.
Let’s look at a JavaScript Implementation containing a callback. This fetches an Item from Wikidata, extracts the label of that Item in a given language, and returns the label. The item to fetch is given by argument Z400K1, and the language is given by Z400K2.
function Z400( Z400K1, Z400K2 ) {
const item = Wikifunctions.Call('Z6821', Z400K1);
for (const label of item.Z6001K2.Z12K1) {
if (label.Z11K1.Z60K1 === Z400K2.Z60K1) {
return label.Z11K2;
}
}
return 'NOT FOUND';
}
A callback is made by calling Wikifunctions.Call, as shown in the example. The first argument to Wikifunctions.Call is always the ZID of the Function to be called – in this case, Z6821/Fetch Wikidata item, which takes a single argument. Following that, the arguments to be passed to that Function are listed, separated by commas. Here, that argument, Z400K1, is the same value that was passed to Z400. This is a common pattern of argument passing to callbacks, but their arguments can also be built inline, or obtained in other ways.
The value of Z400K1 would be an instance of Z6091/Wikidata item reference, containing the QID of the item to be fetched. Line 2 of the example calls Z6821 to fetch that item from Wikidata and assigns the resulting ZObject to the const item. The remaining code iterates over the item’s labels until it finds the one matching the language given by Z400K2.
For the example above, we have used Z6821 for simplicity. However, unless an entire entity is truly needed by the Implementation, it is strongly recommended to use Z6820 rather than Z6821 to retrieve Wikidata items, which can be quite large and thus slow to load and transfer. Although a call to Z6820 is a bit more complex, its parameters allow for fetching selected portions of a Wikidata item, which can greatly improve performance, and avoid some errors, by reducing the network bandwidth and processing time that are needed. In the online documentation for callbacks, we show how Z6820 can be used to implement the same Function as above.
Live demo example: We've used the callback feature to provide a new, more streamlined Implementation (Z40967) for the German noun declension table (Z28602). Previously, this Function was only implementable using compositions, and both of the provided compositions were somewhat awkward. (Each of them used repeated calls to helper Functions to fetch and process Wikidata items, causing them to be bulky, somewhat unreadable, and susceptible to performance challenges associated with compositions.) Because callbacks provide the ability to directly fetch Wikidata entities from code Implementations, it's now possible to contain all the processing of German noun declension table within a single code Implementation. (There are still a few details regarding the table headers to be added.) In the passing Test case, the callback-based Implementation takes 0.2s instead of 1.0 and 1.2s the two existing compositions take.
Other things to note:
- Even though code implementations are now able to fetch Wikidata entities, it is recommended that they not be written to return entire entities. This is because of current limitations on the size of the value returned from a code implementation. To fetch an entire entity, it’s better to call the fetch function from a composition.
- Only one callback can execute at a time. For security reasons, it is not possible to use the concurrency features of JavaScript or Python to execute multiple callbacks in parallel.
- There is currently a 3 MiB limit on the size of Wikidata content that can be returned to a code implementation, by a single callback.
Recent Changes in the software
This week, we added a link from fragment error messages on Abstract Wikipedia to run the same call on Wikifunctions, where you may be better able to diagnose and fix the issue (T435712). We also made it easier to navigate longer abstract articles: when you click on an abstract fragment call or result, the other column now scrolls to bring the matching pair into view (T429214). In addition, when prompted with a list of languages, we now show your user language (for example, Igbo) before the “UN 6,” making it easier to add language-related calls on Abstract Wikipedia and Wikifunctions (T435712). Finally, we fixed a problem when showing images on Abstract Wikipedia; sorry for the disruption (T436579).
News in Types: Julian calendar date
A new Type for representing Julian calendar dates has been introduced based on the respective proposal. We already had Gregorian calendar dates for a long time, and now are introducing Julian calendar dates as a second supported calendar system. Structurally, the two are the same, but they are off by up to a dozen days or so.
The type has also been set-up to be connected to the Wikidata fetching code, so that Julian calendar dates from Wikidata are now being imported to Wikifunctions and made available to Abstract Wikipedia. Thanks to the community for being so patient! We are looking forward to seeing how the new Type is being used.
Thanks to Ameisenigel, Feeglgeef, GrounderUK, 99of9, Dv103, and JhowieNitnek for their participation in the proposal. We invite you all to create new and discuss the existing Type proposals so we can keep on creating new Types. We are particularly curious about more calendar models! Thanks to all the community members contributing to the discussion and writing proposals, making it possible to extend Wikifunctions to new domains!
Recording of Volunteer’s Corner from September 7
For this week’s Volunteer’s corner, we only recorded the initial update part, which is available on Commons.
We used the rest of the time for a lively discussion with the volunteers who joined in, but we decided beforehand not to record it. Thanks to the participants!
The next Volunteers’ Corner is planned for Monday, 5 October 2026.
Denny at WikiCon 2026 in Regensburg, Germany
Next weekend is WikiCon 2026 in Regensburg, Germany. Denny will participate, and if you’d like to discuss Abstract Wikipedia, Wikifunctions, or knowledge representation, please get in touch with him.
Fresh Functions weekly: 210 new Functions
This week we had another record in the number of new Functions: 210 new Functions have been created in the last week. Here is an incomplete list of functions with implementations and passing tests to get a taste of what functions have been created. Thanks everybody for contributing!
- fragment for German noun from eight strings (Z40665)
- fragment for German noun from one string (Z40669)
- fragment for German noun from Lexeme reference (Z40673)
- Nth instance of class by creator, Default (Z40677)
- fragment for German noun from Item reference (Z40679)
- Creative work - entity, action, inception, Default (Z40687)
- Creative work - entity, action, period, Default (Z40690)
- German noun from eight forms and gender (Z40693)
- depicts-sentence, Default (Z40695)
- file extensions-sentence, English (Z40702)
- file extensions-sentence, Default (Z40703)
- file extensions-sentence (HTML) (Z40710)
- German noun from lemma and gender (Z40712)
- German noun from Lexeme reference (Z40715)
- German noun from item (Z40728)
- convert network from adjacency Map to edge List (Z40732)
- remove duplicates from list of unordered pairs (Z40739)
- add to or overwrite in Typed map (Z40747)
- headed Typed list (Z40750)
- Year-specific sentence from statement, in Japanese (Z40769)
- display year in Chinese without AD after 99 AD (Z40771)
- Sin, Cos, Tan (string in/out) (Z40780)
- population sentence, Japanese (Z40789)
- display currency quantity, default (Z40792)
- display currency quantity, Japanese (Z40795)
- short name, label or QID of item (Z40797)
- display currency quantity (Z40804)
- Grapheme to String (Z40815)
- are Graphemes the same? (Z40817)
- length (in Codepoints) of Grapheme (Z40819)
- enumerate paths of directed graph from vertex (Z40821)
- format tree (of graph paths) as multi-line String (Z40823)
- influenced by-sentence. Default (Z40833)
- Philippine languages singular direct case marker (Z40836)
- German article as listed HTML (Z40840)
- French noun from Lexeme (Z40842)
- original language of work-sentence (HTML) (Z40858)
- call Function with 0+ arguments read from Strings (Z40860)
- extract display function configured in Type (Z40863)
- reading function or trivial deserialiser for Type (Z40868)
- Wikifunctions object reference from ZID String (Z40869)
- call Function w/ args from Strings and HTML output (Z40872)
- print Object as rich text in Language (Z40876)
- row for summary table for Configuration (Z40883)
- Reference from ZID string (Z869)
- format Configuration branches for function tree (Z40894)
- link to persistent Wikifunctions object with label (Z40895)
- display simplified Gregorian year based on lang (Z40911)
- has parts-sentence in Japanese (Z40920)
- made from materials-sentence, Japanese (Z40926)
- German noun phrase from determiner and noun (Z40934)
- first Function called in Impl. using Reference (Z40939)
- language fallback strategy used for Function (Z40946)
- print language fallback strategy used for Function (Z40954)
- join 2 html lists with space unless empty (Z40958)
- links to view/talk pages for persistent WF object (Z40968)
- display label of referenced Wikifunctions Object (Z40974)
- blockquote (Z40979)
- Superlative definition, in Russian (Z40992)
- named item plural or singular in German? (no lex) (Z40994)
- German noun phrase from named item (Z41002)
- feature from syntactic function by feature name (Z41003)
- feature by feature name from list of features (Z41006)
- same Julian calendar date (Z41012)
- read Wikifunctions object reference (Z41015)
- evaluate phrase function with one argument (Z41030)
- bind single argument on syntactic phrase function (Z41033)
- set feature for syntactic phrase function (Z41036)
- agree phrase on feature from feature (Z41039)
- s-expression from syntactic phrase function (Z41043)
- returning word separator (last) Simple (Z41047)
- infobox for smartphone (Z41063)
- custom infobox row (Z41064)
- indices (1..=N) which will sort a list of Integers (Z41068)
- fallback if HTML fragment is empty (Z41070)
- infobox for island (Z41077)
- infobox archipel (Z41081)
- indices (1..=N) which will sort a list of Strings (Z41092)
- indices (1..=N) which will sort a list of Langs (Z41098)
- does tree contain Object? (Z41102)
- does network contain a cycle? (Z41108)
- German present describing clause from 2 np (Z41123)
- German describing clause from np and noun (Z41129)
- developed in-sentence, Default (Z41133)
- made from materials-sentence, Default (Z41136)
- developed by-sentence, Default (Z41139)
- created by-sentence, Default (Z41143)
- strong (Z41148)
- strong each in list of HTML (Z41150)
- paradigms-sentence, Default (Z41154)
- fragment for Engl adjective from 3 forms & degree (Z41157)
- named after-sentence, Default (Z41159)
- display Roman year and month (Z41163)
- display Gregorian year and month, Japanese (Z41164)
- display Gregorian year and month, English (Z41168)
- display Gregorian year and month, general (Z41172)
- is a member of, sentence in English (Z41182)
- is a member of, sentence (monolingual) (Z41186)
- is a member of sentence (choosing list) (Z41190)
- display Gregorian year in Japanese (Z41192)
- Wikidata proposition (Z41203)
- fragment for Engl adjective from string & degree (Z41204)
- subjects of Wikidata proposition (Z41212)
- property of Wikidata proposition (Z41215)
- values of Wikidata proposition (Z41218)
- depicted by-sentence, Default (Z41221)
- main subject-sentence, Default (Z41224)
- Wikidata proposition has Wikidata item values (Z41228)
- Object as Wikidata item reference list (Z41231)
- relational predicate body (passiv) for WD prop, En (Z41234)
- English relational reduced predicate for Wikidata proposition (Z41241)
- is a member of, sentence default (Z41245)
- fragment for Engl adjective from Lex ref & degree (Z41251)
- area-sentence, en (Z41254)
- manufacturer-sentence, en (Z41256)
- brand-sentence, en (Z41258)
- genre-sentence, en (Z41260)
- operating system-sentence, en (Z41262)
- fragment for English adjective from item & degree (Z41266)
- area-sentence, default (Z41267)
- manufacturer-sentence, default (Z41269)
- brand-sentence, default (Z41271)
- genre-sentence, default (Z41273)
- operating system-sentence, default (Z41275)
- area-sentence (Z41282)
- manufacturer-sentence (Z41284)
- brand-sentence (Z41286)
- genre-sentence (Z41288)
- operating system-sentence (Z41290)
- print Gregorian year limited by precision, Japanes (Z41292)
- area-sentence (HTML) (Z41294)
- manufacturer-sentence (HTML) (Z41296)
- brand-sentence (HTML) (Z41298)
- genre-sentence (HTML) (Z41300)
- operating system-sentence (HTML) (Z41302)
- fragment for Engl adjective from Lexeme & degree (Z41304)
- English positive adjective from lexeme (Z41311)
- approximate quantity (monolingual), Japanese (Z41314)
- repeat object in multiple dimensions (Z41318)
- approximate quantity (monolingual), English (Z41321)
- English positive adjective from item (Z41322)
- check stringified object (Z41325)
- approximate quantity (monolingual), mul fallback (Z41329)
- positive adjective from item (Z41334)
- approximate quantity (monolingual) (Z41341)
- uses-sentence, Default (Z41347)
- has use-sentence, Default (Z41351)
- has characteristic-sentence, Default (Z41354)
- platform-sentence, Default (Z41358)
- quoted reference from ZID (Z41367)
- place is located by body of water, Hindi (Z41373)
- characteristic of-sentence, Default (Z41377)
- depends on software-sentence, Default (Z41380)
- symbolizes-sentence, Default (Z41383)
- Is it a country without a determiner in French? (Z41389)
- add English adjective to English noun (Z41392)
- fetch Wikidata Item by QID String (Z41399)
- English finite active verb for Wikidata proposition (Z41407)
- add adjective to noun (Z41411)
- English finite relational predicate for Wikidata proposition (Z41412)
- Carnot heat engine efficiency (Z41417)
- Wikidata propositions have same subjects (Z41419)
- English coordinated rela. predicates for Wikidata propositions (Z41427)
- Carnot refrigerator coefficient of performance (Z41431)
- Carnot heat-pump coefficient of performance (Z41433)
- display day of Roman year, Hindi (Z41441)
- display Gregorian year, Hindi (Z41447)
- blockquote (simple) (Z41451)
A complete list of all functions sorted by when they were created is available.