Wikifunctions:Status updates/2025-08-22 - Wikifunctions
Jump to content
From Wikifunctions
Wikifunctions:Status updates
Translate this page
Other languages:
Bahasa Indonesia
Wikifunctions Status updates
Recording of Wikimania session: Wikifunctions is coming soon to a wiki near you!
At this year’s
Wikimania
in Nairobi, we presented on the current state of Wikifunctions, highlighting what the community has achieved so far. We discussed the results of our first live deployment to Wikimedia projects, what this means for editors and readers of those wikis, and our plans for further integration with other Wikimedia projects.
The presentation was followed by a tutorial that provided an introduction to Wikifunctions. We gave a high-level overview and then did a set of introductory activities, each of which can be done on our project. These activities included
finding and calling
existing functions;
creating new
and editing existing functions, tests, and implementations; and showing how community members are using these function calls on projects where Wikifunctions has been enabled. We focused on
functions that generate sentences and fragments
in several languages.
Thanks to
James Forrester
for presenting, and to everyone for joining the session, especially the volunteers helping during the tutorial! Thanks to everyone who joined the session either in person or online.
A recording of the session is available on YouTube
Recent Changes in the software
In the past three weeks, we spent most of our time on the bigger pieces of work planned for this Quarter, but we also fixed a number of bugs.
To unblock our Quarterly work to support Wikidata references in embedded Wikifunctions calls, we added a quick wrapper to make Wikibase's tracking nominally compatible with the modern parser (
T398993
). We plan to work with Wikimedia Deutschland to build the proper version of this in the future, to fully support all use cases and other tools than ours (
T397353
). We have added support for default values for Wikidata items when inputs are left blank (
T398733
). We also added some support for using
Natural language (Z60)
references as inputs, as they're often needed when calling Functions related to Wikidata items and particularly Lexemes (
T400165
), and allowed for default values for these being the page's display language (
T400240
). More generally, we extended our integration with the VisualEditor so that it recognises all of these new default values as valid (
T402177
).
As part of our work on Wikidata items support, we have added
Z6007
and associated updates for representing claims on-wiki (
T399423
). The server-side code to fill these went live on Thursday, so the new, expanded content is made available (
T399424
). Also, we've landed a change on-wiki to tweak the calendar options for
Z6063/Calendar model
T391208
). Finally, we'll be adding
Z861
as a helper Function to let you easily create
Z11/Monolingual strings
, mostly to support the Abstract Wikipedia prototyping work and similar efforts; this still needs the server-side code, which will come soon.
Our thanks to
User:SomeRandomDeveloper
, who found and provided a fix for a security issue that made it possible for any sysop on Wikifunctions.org (even if they didn't have edit-interface rights) to run bad code on editors' browsers (
T400500
). Though never abused, this kind of risk is not acceptable for us, so we immediately deployed this fix. Thank you again!
We have updated a few very rare Function-related rights, like changing how many values of true/false the system knew about, that were originally handed out to sysops; they're now more appropriately issued to Function maintainers.
We fixed an issue where malformed language values would try to add an unknown language to the page's HTML (
T400521
). We made a quick fix that might help PHP reason better about how to handle a null case when fetching Objects (
T365728
). We added logging around issues with cached results (
T398410
). Finally, we reduced the noise from logging around failed requests where it might be intended, such as a Test case checking that dividing by zero throws an error (
T397996
).
Our thanks to
User:Zabe
for their work helping all of Wikimedia code, including us, to upgrade to a new version of the database access layer, re-generating our SQL schema to match. We cleaned up some of our code around Objects' storage on, and loading from, the wikis to use dependency injection (
T394839
). We landed another patch from
User:Zabe
as part of Wikimedia-wide work to drop use of a deprecated database field (
T36320
), and another from
User:SomeRandomDeveloper
adjusting a reference we were making to a class that is being moved (
T402038
); thank you both!
We undertook a set of changes around how our code handles nested Functions, because they are error-prone due to confusion from our front-end (
T398457
). First, we changed our canonicalisation code to be consistent between the middleware and back-end rather than sometimes renaming keys, then changing the front-end code to recognise that references in calls are "terminal", and shouldn't expand further, making the UX flow more easily in this rare edge case. Next, we changed how we show this kind of Function call in collapsed mode: showing a blank state instead of "Select …" if something's not been selected yet, except in edit mode, and showing the full call, with a different display if the called Function is defined through argument references. Finally, we added to the editing interface an ability to specify local keys manually when a Function call is dynamic and so can't be automatically completed by the UX.
We fixed a UX bug in the Object selector to show the already-selected option, instead of "no results found" (
T398453
). We've also changed the mode selector for Wikidata entity to also allow adding a Function call and not just an argument reference, which is sometimes needed (
T400990
e.g.
when working with lexeme forms (
T386553
). We've corrected our embedded Wikifunctions calls code to lower the cache time when inserting the day's date as a default value for a time. Finally, we've further expanded our testing for the API that embedded Wikifunctions calls make when a used input Type does not have a reader Function, or the used output Type does not have a display Function.
News in Types: Wikidata geo-coordinate
Recently Wikifunctions started importing Wikidata statements containing values of the new Wikifunctions types
Wikidata quantity
Wikidata geo-coordinate
, and
Wikidata time
. In the last update we described Wikidata quantity; here we give an overview of Wikidata geo-coordinate.
Each instance of Wikidata geo-coordinate (which corresponds directly to the
geo-coordinates datatype
on Wikidata) contains 4 components:
latitude
longitude
precision
(all of type
Rational number
), and
globe
(of type
Wikidata item reference
).
Latitude
and
longitude
are required to be present;
precision
is optional and, when its value is missing from imported Wikidata content, is filled in with
Z24/void
Globe
usually refers to the Wikidata item for Earth (
Q2
), but can also refer to other astronomical bodies.
To support more natural implementations in JavaScript and Python of functions that take or return instances of Wikidata geo-coordinate, there are converter functions to and from each of those languages. Going from ZObject instance
to
JavaScript,
Convert from Wikidata geo-coordinate
, JavaScript converts each Rational number to a BigInt, extracts the Wikidata identifier of the globe from the
Wikidata item reference
, and collects these 4 elements into a single JavaScript Object.
Convert from Wikidata geo-coordinate, Python
provides similar conversions resulting in a Python dictionary. Going in the other direction, the converters
from
those two languages reverse the transformations.
We’d particularly like to highlight the versatile display and read functions, prepared primarily by community member 99of9. The display function builds on the existing Rational number display function to show the latitude and longitude in decimal form (preserving the number of decimal places that appears in Wikidata), and separated by commas. If the
globe
item is anything other than Earth, the display function also presents its label, retrieved from Wikidata. The read function, in addition to reading those two numbers (and accommodating a variety of language-specific number formats), employs a lookup table to recognize the names, in many different languages, of the bodies of our solar system, and map them to the identifier for the corresponding Wikidata item (from which it can reconstruct the original
Wikidata item reference
).
The screenshots show the statements containing the coordinate locations of Hickory, North Carolina (Wikidata item
Q2028564
) and the Tycho crater (Wikidata item
Q631696
) on the moon, including the output of the display function (under the word “value”). These statements show up in this way when the items are fetched using
Fetch Wikidata item
Fresh Functions weekly: 136 new Functions
Since the last update, we had 136 new functions. Here is a partial list of functions with implementations and passing tests to get a taste of what functions have been created. Thanks everybody for contributing!
move Hijri month by N months (
Z26809
is Hijri sacred month? (
Z26817
Indonesian ordinal from natural number (
Z26821
ordinal in chosen language (
Z26829
Get SSHWS category from sustained winds (English) (
Z26830
geo-coordinate of wikidata item location (
Z26838
distance (km) between 2 QIDs (Haversine) (
Z26841
change type of instance of Wikidata enumeration (
Z26853
integer modulo natural, result between 1-M (
Z26858
list of all possible instances of Wikidata enum (
Z26879
instance of Wikidata enum to number (
Z26882
instance at position N of Wikidata enumeration (
Z26887
number of possible values of Wikidata enumeration (
Z26891
advance N from instance of Wikidata enumeration (
Z26895
next instance of Wikidata enumeration (
Z26900
advance N elements (
Z26904
previous instance of Wikidata enumeration (
Z26911
average colour mixing (wikidata item) (
Z26919
label texts for Wikidata items (in one language) (
Z26929
switch on Wikidata enumeration value (
Z26936
is upper bound void? (
Z26946
is lower bound void? (
Z26950
valid Wikidata quantity (
Z26959
quantities have identical lower bounds (
Z26966
quantities have identical upper bounds (
Z26971
multiply rationals maintaining the first precision (
Z26978
equal rational with numerator length (
Z26982
rational with power of 10 denominator (
Z26985
N has number of factors of specified M (
Z26988
is rational a decimal? (
Z26996
apply two-argument function unless void argument (
Z27006
promote indexed objects (
Z27014
opposite instance of Wikidata enumeration (
Z27043
specular instance of Wikidata enumeration (
Z27047
convert digits to lower indexes (subscript) (
Z27053
swap lower and upper bounds of quantity (
Z27064
if true, pass input through function (
Z27068
value string from quantity string (
Z27085
quantity string implies void lower bound (
Z27092
quantity string implies void upper bound (
Z27097
Italian article-ful instantiating sentence (
Z27102
Italian indefinite noun phrase (
Z27107
Italian definite nominal phrase (
Z27115
classifying a class of nouns, Italian (
Z27122
Italian ordinal (
Z27131
indef number of objects phrase (
Z27137
apply two-argument function if not echo (
Z27143
o,a,i,e based on gender (m/f) and number (s/p) (
Z27148
ordinal in Italian with gender and number (
Z27154
replace last character (
Z27159
Describe the class of a class (
Z27173
article-less Italian nominal phrase with adjective (
Z27177
join two strings with space (
Z27182
months between (
Z27190
time between two dates with unit, chosen language (
Z27198
same Wikidata claim (
Z6807
same Wikidata reference (
Z6808
em dash instantiating sentence (
Z27209
State location using entity and class, Italian (
Z27219
divide day in regular intervals (
Z27225
rational from two natural numbers (
Z27232
Simplified Han Chinese "是" sentence (
Z27244
German instantiating sentence with article (
Z27249
Simplified Luxembourgish Eifel rule (
Z27254
Esperanto instantiating sentence (
Z27259
location from entity and class (Indonesian) (
Z27267
lexeme sense referring to item (
Z27292
Arabic definite article (
Z27298
Breton indefinite article with mutation (
Z27305
add definite article to Breton lexeme (
Z27308
is Breton masculine agent noun (
Z27315
Arabic article-less instantiating sentence (
Z27324
best lexeme for Wikidata item (
Z27327
best lexeme from list of lexemes (
Z27332
lexeme sense has specific statement? (
Z27340
Italian place phrase (
Z27347
preposition for place in Italian (
Z27354
Unlabelled (
Z27360
Unlabelled (
Z27366
Gray code to natural number (
Z27376
enclose string (
Z27385
French article-ful instantiating fragment (
Z27396
Italian simple preposition in string (
Z27406
better matching representation string from lexeme (
Z27410
word mutates with definite article in Breton? (
Z27417
first lemma of lexeme (
Z27423
object has particular value of key? (
Z27430
equation of time (minutes) (
Z27450
English classifying a class of nouns fragment (
Z27454
Value statements from Wikidata item (
Z27460
convert hour angle (float) to time (
Z27461
declination of the sun (radians) (
Z27469
solar longitude (radians) from date (
Z27475
Gregorian date and time from (rational) JD (
Z27478
Luxembourgish article-less instantiating sentence (
Z27490
grammatical person of lexeme form (
Z27499
Bangla 'একধরনের' sentence for two classes (
Z27502
is Wikidata item reference a grammatical person? (
Z27506
replace suffix "o" with "a" (
Z27517
replace suffix "o" with "as" (
Z27522
replace suffix "m" with "ns" (
Z27525
add suffix "as" (
Z27528
add suffix "es" (
Z27529
replace suffix "ão" with "ões" (
Z27534
replace suffix "ês" with "eses" (
Z27535
replace suffix "ês" with "esa" (
Z27536
replace suffix "ês" with "esas" (
Z27537
replace suffix "l" with "is" (
Z27546
complete list of all functions sorted by when they were created
is available.
Retrieved from "
Category
Status updates
Wikifunctions
Status updates/2025-08-22
Add topic
US