Wikifunctions wikifunctionswiki https://www.wikifunctions.org/wiki/Wikifunctions:Main_Page MediaWiki 1.47.0-wmf.3 first-letter Media Special Talk User User talk Wikifunctions Wikifunctions talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk TimedText TimedText talk Module Module talk Translations Translations talk Event Event talk Wikifunctions:How to create implementations 4 1180 276436 240081 2026-05-20T05:55:00Z YoshiRulz 10156 /* Returning the right outputs */ Mention list of lists limitation 276436 wikitext text/x-wiki <languages/> <translate> <!--T:1--> This page provides a more detailed guide to '''creating implementations''', beyond the overview at <tvar name="1">{{ll|Wikifunctions:Introduction}}</tvar>. == Types of Implementations == <!--T:47--> <!--T:48--> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. <!--T:49--> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. <!--T:50--> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"<tvar name="1">{{int|wikilambda-implementation-selector-none}}</tvar>"'' == Practice Test-Driven Development == <!--T:51--> <!--T:52--> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. <!--T:53--> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. <!--T:54--> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <translate> <!--T:55--> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. <!--T:56--> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <translate> <!--T:57--> or ... </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <translate> <!--T:58--> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". == Code implementations == <!--T:59--> </translate> [[File:Code implementation.png|thumb|alt=<translate><!--T:60--> Wikifunctions code editor initialized with a function template</translate>|<translate><!--T:61--> When adding a new code implementation, the function template is initialized with the function and argument names</translate>]] <translate> <!--T:62--> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. === Using input types in your code === <!--T:63--> <!--T:64--> Wikifunctions types <tvar name="1">{{Z|Z6}}</tvar> and <tvar name="2">{{Z|Z40}}</tvar> can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. <!--T:65--> For example, let's say we want to write some Python code that handles an input of type <tvar name="1">{{Z|Z20420}}</tvar>. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter <tvar name="2">{{Z|Z20424}}</tvar> will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </translate> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <translate> <!--T:66--> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <tvar name="1"><code>Z30000</code></tvar> has one input <tvar name="2"><code>Z30000K1</code></tvar> of type <tvar name="3">{{Z|Z11}}</tvar>. This type has two keys: <tvar name="4"><code>Z11K1</code></tvar> for the language (itself an object of type <tvar name="5">{{Z|Z60}}</tvar>), and <tvar name="6"><code>Z11K2</code></tvar> for the string value. Similarly, the language object has a key <tvar name="7"><code>Z60K1</code></tvar> for the language code. So, to get a string with the language code and the text, you can write: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // <translate nowrap><!--T:308--> e.g. "en: some text"</translate> return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <translate> <!--T:67--> For a quick reference of the available type conversions visit [[<tvar name="1">Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion</tvar>|the default type conversion table]]. === Returning the right outputs === <!--T:68--> <!--T:69--> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions <tvar name="1">{{Z|Z6}}</tvar> object and any native boolean returned by your implementation will be converted into a Wikifunctions <tvar name="2">{{Z|Z40}}</tvar> object. <!--T:70--> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of <tvar name="1">{{Z|Z20420}}</tvar>, the <tvar name="2">{{Z|Z20443}}</tvar> will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. <!--T:71--> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <tvar name="1"><code>Z30000</code></tvar> takes two string inputs: language code and text, and should return a <tvar name="2">{{Z|Z11}}</tvar> object. You can do this in Python by using the <tvar name="3"><code>ZObject</code></tvar> constructor: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <translate> <!--T:72--> Or in JavaScript: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <translate> <!--T:73--> You can learn more about the <tvar name="1"><code>ZObject</code></tvar> class and other useful constructors in <tvar name="2">{{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}}</tvar> </translate>{{phab|T392750}}<translate> As of 2026-05, trying to return a list of lists will fail, so you're not able to implement such functions in code. === Code in Python === <!--T:74--> <!--T:3--> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. <!--T:5--> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <translate> <!--T:75--> As we described before, we know that the arguments (<tvar name="1"><code>Z30000K1</code></tvar> and <tvar name="2"><code>Z30000K2</code></tvar>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:9--> Since this is Python, do not forget to indent this line. <!--T:76--> If you have followed our advice to [[<tvar name="1">#Practice Test-Driven Development</tvar>|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. <!--T:11--> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on <tvar name="1">[[Wikifunctions:Python implementations]]</tvar>. === Code in JavaScript === <!--T:77--> <!--T:13--> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <tvar name="1"><code>Z30000</code></tvar>. <!--T:15--> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <tvar name="1"><code>Z30000</code></tvar> with its two arguments, the function template should look like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <translate> <!--T:78--> We know that the arguments (<tvar name="1"><code>Z30000K1</code></tvar> and <tvar name="2"><code>Z30000K2</code></tvar>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:79--> If you have tests as recommended in the [[<tvar name="1">#Practice Test-Driven Development</tvar>|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. <!--T:21--> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on <tvar name="1">[[Wikifunctions:JavaScript implementations]]</tvar>. == Compositions == <!--T:22--> <!--T:23--> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <tvar name="1"><code>Z30000</code></tvar>. <!--T:24--> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. <!--T:25--> For example, for the given Function, we could use the existing Function <tvar name="1">{{Z|Z10000}}</tvar>. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </translate> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <translate> <!--T:80--> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </translate> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <translate> <!--T:81--> An alternative implementation could also use the existing Function <tvar name="1">{{Z|Z15175}}</tvar>, so your composition could be: </translate> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <translate> <!--T:82--> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the <tvar name="1">{{ll|Wikifunctions:Catalogue}}</tvar>. <!--T:83--> Let's try to create the second example, <tvar name="1"><code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code></tvar>. <!--T:84--> In order to create this: </translate> # <translate><!--T:85--> Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</translate> # <translate><!--T:86--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:87--> Click on the "›" icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:88--> Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</translate> # <translate><!--T:89--> You will see two new fields, one for each of the arguments needed for the selected function.</translate> # <translate><!--T:90--> For the first argument, we want to select the first input to our function:</translate> ## <translate><!--T:91--> Next to "first string", click on the "…" button and select "Argument reference".</translate> ## <translate><!--T:92--> Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</translate> # <translate><!--T:93--> For the second argument, we want to use the result of another call to "join two strings":</translate> ## <translate><!--T:94--> Next to "second string", click on the "…" button and select "Function call".</translate> ## <translate><!--T:95--> Under "function", search and select the function you want to call, which is again "join two strings".</translate> ## <translate><!--T:96--> For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</translate> <translate> <!--T:97--> Your composition is now complete! <!--T:98--> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[<tvar name="1">#Practice Test-Driven Development</tvar>|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </translate> [[File:Composition implementation expanded.png|frame|center|alt=<translate><!--T:99--> A Wikifunctions composition implementation in its expanded view</translate>|<translate><!--T:100--> A Wikifunctions composition implementation in its expanded view</translate>]] [[File:Composition implementation collapsed.png|frame|center|alt=<translate><!--T:101--> A Wikifunctions composition implementation in its collapsed view</translate>|<translate><!--T:102--> A Wikifunctions composition implementation in its collapsed view</translate>]] <translate> == Wikifunctions error handling == <!--T:103--> <!--T:104--> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. <!--T:105--> For this purpose, you can use <tvar name="1"><code>Wikifunctions.Error()</code></tvar> from your code implementations or the function <tvar name="2">{{Z|Z851}}</tvar> from your compositions. <!--T:106--> In this section you will learn: </translate> * <translate><!--T:107--> How to throw errors from both code and composition implementations,</translate> * <translate><!--T:108--> how to write tests for error cases, and</translate> * <translate><!--T:109--> how to catch and handle errors thrown by functions that you are using in your compositions.</translate> <translate> === Throwing errors from code implementations === <!--T:110--> <!--T:111--> When writing code, both from JavaScript and Python, you can use <tvar name="1"><code>Wikifunctions.Error()</code></tvar> to end the execution with a wanted error. <!--T:112--> <tvar name="1"><code>Wikifunctions.Error()</code></tvar> has two parameters: </translate> # <translate><!--T:113--> Error type: a string containing the ZID of the error type you want to return.</translate> # <translate><!--T:114--> Error arguments: a list of string arguments to build the error.</translate> <translate> <!--T:115--> Let's go one by one: ==== Error type ==== <!--T:116--> <!--T:117--> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[<tvar name="1">Special:ListObjectsByType/Z50</tvar>|this list]]. <!--T:118--> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </translate> [[File:Error type.png|thumb|alt=<translate><!--T:119--> Error type creation in Wikifunctions</translate>|<translate><!--T:120--> To create new Error type (Z50), edit the label and add the necessary keys.</translate>]] * <translate><!--T:121--> '''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</translate> * <translate><!--T:122--> '''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</translate> <translate> ==== Error arguments ==== <!--T:123--> <!--T:124--> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. ==== Using Wikifunctions.Error() ==== <!--T:125--> <!--T:126--> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <tvar name="1"><code>Z30005</code></tvar>. Your error type has two string keys: </translate> * <translate><!--T:127--> Input key: contains the key of the failing input</translate> * <translate><!--T:128--> Input value: contains the current value of the failing input</translate> <translate> <!--T:129--> To raise an error in your JavaScript implementation you should do something like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // <translate nowrap><!--T:309--> If the first input is empty, raise error <tvar name="1">Z30005</tvar></translate> // <translate nowrap><!--T:310--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // <translate nowrap><!--T:311--> If the second input is empty, raise error <tvar name="1">Z30005</tvar></translate> // <translate nowrap><!--T:312--> with two string args: [ second input key, second input value ]</translate> Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:130--> To raise an error in your Python implementation you should do something like this: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # <translate nowrap><!--T:313--> If the first input is empty, raise error <tvar name="1">Z30005</tvar></translate> # <translate nowrap><!--T:314--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # <translate nowrap><!--T:315--> If the second input is empty, raise error <tvar name="1">Z30005</tvar></translate> # <translate nowrap><!--T:316--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:131--> Remember that calling <tvar name="1"><code>Wikifunctions.Error()</code></tvar> ends the execution! === Throwing errors from compositions === <!--T:132--> <!--T:133--> If you are creating a composition implementation, you can throw an error by calling the special function <tvar name="1">{{Z|Z851}}</tvar>. ==== Throw Error function (Z851) ==== <!--T:134--> <!--T:135--> The <tvar name="1">{{Z|Z851}}</tvar> function is similar to the <tvar name="2"><code>Wikifunctions.Error()</code></tvar> method and takes two arguments: </translate> * <translate><!--T:136--> '''Error type''' – A reference to the Error type you want to raise</translate> * <translate><!--T:137--> '''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</translate> <translate> ==== Using Throw Error ==== <!--T:138--> <!--T:139--> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </translate> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <translate> <!--T:140--> To do this, you need to create conditional paths, for which you can use the <tvar name="1">{{Z|Z802}}</tvar> function. Think of it like this: </translate> * <translate><!--T:141--> If the first argument is empty, throw an error for the first argument</translate> * <translate><!--T:142--> Else, proceed to check the second argument</translate> * <translate><!--T:143--> If the second argument is empty, throw an error for the second argument</translate> * <translate><!--T:144--> Else, proceed with the success path and return the joint strings with the space separator</translate> <translate> <!--T:145--> Or in functional pseudo code: </translate> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <translate> <!--T:146--> Let's create this step by step: </translate> # <translate><!--T:147--> Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</translate> # <translate><!--T:148--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:149--> Click on the "›” icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:150--> Under "function" search and select the outermost function you want to use, which in this case is "if".</translate> # <translate><!--T:151--> Check the validity of the first argument:</translate> ## <translate><!--T:152--> Next to "condition", click on the "…" button and select "function call"</translate> ## <translate><!--T:153--> Under "function", search and select the function "is empty string"</translate> ## <translate><!--T:154--> Next to "input", click on the "…" button and select "argument reference"</translate> ## <translate><!--T:155--> Under "key id", select the first input (e.g. "first string")</translate> ## <translate><!--T:156--> You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</translate> # <translate><!--T:157--> Throw error if the condition is true:</translate> ## <translate><!--T:158--> Next to "then", click on the "…" button and select "function call"</translate> ## <translate><!--T:159--> Under "function", search and select the function "Throw Error"</translate> ## <translate><!--T:160--> Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</translate> ## <translate><!--T:161--> Under "error parameters", add two items by clicking on the "+" button</translate> ## <translate><!--T:162--> For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</translate> ## <translate><!--T:163--> For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</translate> ## <translate><!--T:164--> Under "key id", select the first input (e.g. "first string")</translate> ## <translate><!--T:165--> You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</translate> # <translate><!--T:166--> Continue to check the second argument if the first was good:</translate> ## <translate><!--T:167--> Next to "else", click on the "…" button and select "function call"</translate> ## <translate><!--T:168--> Under "function", search and select the function "if"</translate> ## <translate><!--T:169--> Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</translate> ## <translate><!--T:170--> Set up "then" to throw an error for the second argument by following the same process as described in step 6.</translate> # <translate><!--T:171--> Finally, set up the success path:</translate> ## <translate><!--T:172--> Next to the nested "else", click on the "…" button and select "function call"</translate> ## <translate><!--T:173--> Under "function", search and select the successful function, which in this case can be "join strings with separator"</translate> ## <translate><!--T:174--> Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</translate> ## <translate><!--T:175--> Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</translate> ## <translate><!--T:176--> Under "separator" add a space into the text field</translate> <translate> <!--T:177--> The resulting function call should look like this: </translate> [[File:Throw error expanded.png|frame|center|alt=<translate><!--T:178--> Wikifunctions composition using Throw Error function</translate>|<translate><!--T:179--> Wikifunctions composition using Throw Error function</translate>]] [[File:Throw error collapsed.png|frame|center|alt=<translate><!--T:180--> Wikifunctions composition using Throw Error function, in its collapsed view</translate>|<translate><!--T:181--> Wikifunctions composition using Throw Error function, in its collapsed view</translate>]] <translate> === Handling errors in compositions === <!--T:182--> <!--T:183--> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. <!--T:184--> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <tvar name="1"><code>Z30010</code></tvar>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. <!--T:185--> You could create a composition using our example function "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar> to generate the name. If any of the inputs are empty, you know that <tvar name="1"><code>Z30000</code></tvar> will throw an error of type <tvar name="2"><code>Z30005</code></tvar>. Using the function <tvar name="3">{{Z|Z850}}</tvar> as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. ==== Try-Catch function (Z850) ==== <!--T:186--> <!--T:187--> The <tvar name="1">{{Z|Z850}}</tvar> function is built-in with ZID <tvar name="2"><code>Z850</code></tvar> and takes three arguments: </translate> * <translate><!--T:188--> '''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</translate> * <translate><!--T:189--> '''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</translate> * <translate><!--T:190--> '''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</translate> <translate> ==== Using Try-Catch ==== <!--T:191--> <!--T:192--> Once we have all the functions for our composition, we can craft it like this: </translate> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <translate> <!--T:193--> This means that: </translate> * <translate><!--T:194--> The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</translate> * <translate><!--T:195--> If any of the inputs are blank, "Join two strings with a space" with raise an error of type <tvar name="1"><code>Z30005</code></tvar></translate> * <translate><!--T:196--> Our <tvar name="1">{{Z|Z850}}</tvar> will then detect this error and run the <tvar name="2">{{Z|Z801}}</tvar> function to return "Unknown"</translate> <translate> <!--T:197--> Let's create this step by step: </translate> # <translate><!--T:198--> Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</translate> # <translate><!--T:199--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:200--> Click on the "›” icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:201--> Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</translate> # <translate><!--T:202--> Set the main function call:</translate> ## <translate><!--T:203--> Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</translate> ## <translate><!--T:204--> Under "function" search and select the function "join two strings with space"</translate> ## <translate><!--T:205--> Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</translate> ## <translate><!--T:206--> Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</translate> # <translate><!--T:207--> Select the error to catch:</translate> ## <translate><!--T:208--> Under "error type", search and select "bad string input" – you can search directly by its ZID <tvar name="1"><code>Z30005</code></tvar></translate> # <translate><!--T:209--> Set the error handler function call:</translate> ## <translate><!--T:210--> Next to "error handler", click on the "…" button and select "function call"</translate> ## <translate><!--T:211--> Under "function", search and select the function "echo"</translate> ## <translate><!--T:212--> Under "input" and "type", search and select the type "String"</translate> ## <translate><!--T:213--> Now, under "input", type "Unknown" in the text field</translate> <translate> <!--T:214--> The resulting function should look like this: </translate> [[File:Try catch expanded.png|frame|center|alt=<translate><!--T:215--> Wikifunctions composition using Try-catch function, in expanded mode</translate>|<translate><!--T:216--> Wikifunctions composition using Try-catch function, in expanded mode</translate>]] [[File:Try catch collapsed.png|frame|center|alt=<translate><!--T:217--> Wikifunctions composition using Try-catch function, in collapsed mode</translate>|<translate><!--T:218--> Wikifunctions composition using Try-catch function, in collapsed mode</translate>]] <translate> === Testing your failure use cases === <!--T:219--> <!--T:220--> As we introduced in the above section about [[<tvar name="1">#Practice Test-Driven Development</tvar>|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. <!--T:221--> To do that, you will need other two system functions: ==== Is error type (Z852) ==== <!--T:222--> <!--T:223--> The <tvar name="1">{{Z|Z852}}</tvar> function is built-in with ZID <tvar name="2"><code>Z852</code></tvar> and takes two arguments: </translate> * <translate><!--T:224--> '''Error''' – An <tvar name="1">{{Z|Z5}}</tvar> object, which can be thrown by a failing call. An error instance has a type and a value.</translate> * <translate><!--T:225--> '''Error type''' – A reference to an <tvar name="1">{{Z|Z50}}</tvar> which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</translate> <translate> ==== Get error thrown by function call (Z853) ==== <!--T:226--> <!--T:227--> The <tvar name="1">{{Z|Z853}}</tvar> function is built-in with ZID <tvar name="2"><code>Z853</code></tvar> and takes one argument: </translate> * <translate><!--T:228--> '''Function call''' – A function call which can either return a successful value of any type, or throw an error.</translate> <translate> <!--T:229--> This function returns a <tvar name="1">{{Z|Z882}}</tvar> with a <tvar name="2">{{Z|Z40}}</tvar> in first place and an <tvar name="3">{{Z|Z1}}</tvar> in the second: </translate> * <translate><!--T:230--> If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</translate> * <translate><!--T:231--> If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</translate> <translate> <!--T:232--> To use this function in your compositions, you might need to use the additional functions: </translate> * <translate><!--T:233--> <tvar name="1">{{Z|Z821}}</tvar>, and</translate> * {{Z|Z822}} <translate> ==== Testing errors ==== <!--T:234--> <!--T:235--> Say our target function, "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar>, throws an error of type <tvar name="2"><code>Z30005</code></tvar> and we want to test this behavior. To do that we need to: </translate> * <translate><!--T:236--> Throw a failing function call</translate> * <translate><!--T:237--> Get the error using the function <tvar name="1">{{Z|Z853}}</tvar></translate> * <translate><!--T:238--> Check that the error is the right type with <tvar name="1">{{Z|Z852}}</tvar></translate> <translate> <!--T:239--> Tests have two fields: </translate> * <translate><!--T:240--> '''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</translate> * <translate><!--T:241--> '''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</translate> <translate> <!--T:242--> For step-by-step instructions on how to create tests, see <tvar name="1">{{ll|Wikifunctions:Introduction#Create_tests}}</tvar>. <!--T:243--> In our example, we can structure it like this — but this is not the only way! <!--T:244--> The call, which will return an <tvar name="1">{{Z|Z5}}</tvar> object: </translate> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <translate> <!--T:245--> And the result validation, which will take the <tvar name="1">{{Z|Z5}}</tvar> object as its first argument: </translate> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <translate> <!--T:246--> Let's do this step by step: </translate> # <translate><!--T:247--> Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</translate> # <translate><!--T:248--> First, let's set the call:</translate> ## <translate><!--T:249--> Under "call", click the "›" chevron button to expand the function call.</translate> ## <translate><!--T:250--> Under "function", edit the field and search and select the function "Get second element of a typed pair"</translate> ## <translate><!--T:251--> Once selected, next to "Typed pair", click on the "…" button and select "function call"</translate> ## <translate><!--T:252--> Under "function", search and select the function "Get error thrown by function call"</translate> ## <translate><!--T:253--> Next to "function call", click on the "…" button and select "function call"</translate> ## <translate><!--T:254--> Under "function", search and select the function "Join two strings with a space" (or by ZID <tvar name="1"><code>Z30000</code></tvar>)</translate> ## <translate><!--T:255--> Now set the inputs so that they cause a failure: at least one of them should be empty.</translate> ## <translate><!--T:256--> You can now collapse your "call" by clicking again on the down-chevron button if you want!</translate> # <translate><!--T:257--> Next, let's set the result validation:</translate> ## <translate><!--T:258--> Under "result validation", click the "›" chevron button to expand the function call.</translate> ## <translate><!--T:259--> Under "function", edit the field and search and select the function "Is error type"</translate> ## <translate><!--T:260--> Now you will only be asked to configure the second argument. Under "error type", search and select your <tvar name="1"><code>Z30005</code></tvar> error type.</translate> # <translate><!--T:261--> And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</translate> <translate> <!--T:262--> If everything went right, you can now save your test. It should look like this: </translate> [[File:Get error expanded.png|frame|center|alt=<translate><!--T:263--> Testing a failure using Get error and Is error type functions, in expanded mode</translate>|<translate><!--T:264--> Testing a failure using Get error and Is error type functions, in expanded mode</translate>]] [[File:Get error collapsed.png|frame|center|alt=<translate><!--T:265--> Testing a failure using Get error and Is error type functions, in collapsed mode</translate>|<translate><!--T:266--> Testing a failure using Get error and Is error type functions, in collapsed mode</translate>]] <translate> == Debugging your implementations == <!--T:267--> <!--T:268--> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. <!--T:269--> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> from your code implementations or the function <tvar name="2">{{Z|Z854}}</tvar> from your compositions. <!--T:270--> In this section you will learn: </translate> * <translate><!--T:271--> How to add debug messages from both code and composition implementations,</translate> * <translate><!--T:272--> how to inspect the metadata manually or via the UI to inspect these logs.</translate> <translate> === Debugging your code implementations === <!--T:273--> <!--T:274--> When writing code, both from JavaScript and Python3, you can use <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> to add a message to your debugging log and continue the execution. <!--T:275--> <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. <!--T:276--> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </translate> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:277--> And the same in your Python3 implementation will be: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:278--> This way, no matter what happens, we will be adding one message to your debugging logs: </translate> * <translate><!--T:279--> If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</translate> * <translate><!--T:280--> If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</translate> <translate> === Debugging your compositions === <!--T:281--> <!--T:282--> To support debugging compositions, Wikifunctions provides the built-in function <tvar name="1">{{Z|Z854}}</tvar>. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <tvar name="2"><code>executorDebugLogs</code></tvar> key. ==== Add debug log to function call (Z854) ==== <!--T:283--> <!--T:284--> The <tvar name="1">{{Z|Z854}}</tvar> function is built-in with ZID <tvar name="2"><code>Z854</code></tvar> and takes two arguments: </translate> * <translate><!--T:285--> '''Function call''' – Any composition you want to execute.</translate> * <translate><!--T:286--> '''Debug log''' – A string message that will be recorded if the given function call is evaluated.</translate> <translate> <!--T:287--> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. <!--T:288--> You will benefit from this built-in if you want to observe: </translate> * <translate><!--T:289--> Which branch of a conditional was executed, or</translate> * <translate><!--T:290--> the order of evaluation in a composition.</translate> <translate> ==== Using Add debug log to function call ==== <!--T:291--> <!--T:292--> Say that you want to add debug logs to our example function "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </translate> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <translate> <!--T:293--> This way, </translate> * <translate><!--T:294--> when called with an empty first input, the function will return a failed response, and the metadata will contain an <tvar name="1"><code>executorDebugLogs</code></tvar> entry with the "failed on first input" log.</translate> * <translate><!--T:295--> When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</translate> * <translate><!--T:296--> When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <tvar name="1"><code>executorDebugLogs</code></tvar> key.</translate> <translate> <!--T:297--> This is the way this composition would look: </translate> [[File:Add debug log expanded.png|frame|center|alt=<translate><!--T:298--> Composition implementation using Add debug logs to log all possible execution paths</translate>|<translate><!--T:299--> Composition implementation using Add debug logs to log all possible execution paths</translate>]] <translate> === Accessing execution debug logs === <!--T:300--> <!--T:301--> Whether your execution logs are added via <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> or via the <tvar name="2">{{Z|Z854}}</tvar> built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. <!--T:302--> The error and debug information will appear at the top of the "Details" dialog. <!--T:303--> This is what you would see when running the composition from our previous example with valid and invalid inputs: </translate> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<translate><!--T:304--> Function metadata dialog for a successful execution with debug logs</translate>]] | [[File:Execution logs failure.png|frameless|center|alt=<translate><!--T:305--> Function metadata dialog for a failed execution with debug logs</translate>]] |- | <translate><!--T:306--> Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</translate> | <translate><!--T:307--> Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</translate> |} [[Category:How to create implementations| {{#translation:}}]] 1d1h7mey5rkbyfaw3gh501i5bh1ldzd 276438 276436 2026-05-20T05:59:22Z Dv103 11127 Sometimes it is possible: the bug is a bit inconsistent 276438 wikitext text/x-wiki <languages/> <translate> <!--T:1--> This page provides a more detailed guide to '''creating implementations''', beyond the overview at <tvar name="1">{{ll|Wikifunctions:Introduction}}</tvar>. == Types of Implementations == <!--T:47--> <!--T:48--> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. <!--T:49--> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. <!--T:50--> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"<tvar name="1">{{int|wikilambda-implementation-selector-none}}</tvar>"'' == Practice Test-Driven Development == <!--T:51--> <!--T:52--> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. <!--T:53--> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. <!--T:54--> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <translate> <!--T:55--> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. <!--T:56--> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <translate> <!--T:57--> or ... </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <translate> <!--T:58--> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". == Code implementations == <!--T:59--> </translate> [[File:Code implementation.png|thumb|alt=<translate><!--T:60--> Wikifunctions code editor initialized with a function template</translate>|<translate><!--T:61--> When adding a new code implementation, the function template is initialized with the function and argument names</translate>]] <translate> <!--T:62--> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. === Using input types in your code === <!--T:63--> <!--T:64--> Wikifunctions types <tvar name="1">{{Z|Z6}}</tvar> and <tvar name="2">{{Z|Z40}}</tvar> can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. <!--T:65--> For example, let's say we want to write some Python code that handles an input of type <tvar name="1">{{Z|Z20420}}</tvar>. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter <tvar name="2">{{Z|Z20424}}</tvar> will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </translate> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <translate> <!--T:66--> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <tvar name="1"><code>Z30000</code></tvar> has one input <tvar name="2"><code>Z30000K1</code></tvar> of type <tvar name="3">{{Z|Z11}}</tvar>. This type has two keys: <tvar name="4"><code>Z11K1</code></tvar> for the language (itself an object of type <tvar name="5">{{Z|Z60}}</tvar>), and <tvar name="6"><code>Z11K2</code></tvar> for the string value. Similarly, the language object has a key <tvar name="7"><code>Z60K1</code></tvar> for the language code. So, to get a string with the language code and the text, you can write: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // <translate nowrap><!--T:308--> e.g. "en: some text"</translate> return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <translate> <!--T:67--> For a quick reference of the available type conversions visit [[<tvar name="1">Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion</tvar>|the default type conversion table]]. === Returning the right outputs === <!--T:68--> <!--T:69--> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions <tvar name="1">{{Z|Z6}}</tvar> object and any native boolean returned by your implementation will be converted into a Wikifunctions <tvar name="2">{{Z|Z40}}</tvar> object. <!--T:70--> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of <tvar name="1">{{Z|Z20420}}</tvar>, the <tvar name="2">{{Z|Z20443}}</tvar> will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. <!--T:71--> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <tvar name="1"><code>Z30000</code></tvar> takes two string inputs: language code and text, and should return a <tvar name="2">{{Z|Z11}}</tvar> object. You can do this in Python by using the <tvar name="3"><code>ZObject</code></tvar> constructor: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <translate> <!--T:72--> Or in JavaScript: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <translate> <!--T:73--> You can learn more about the <tvar name="1"><code>ZObject</code></tvar> class and other useful constructors in <tvar name="2">{{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}}</tvar> </translate>{{phab|T392750}}<translate> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. === Code in Python === <!--T:74--> <!--T:3--> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. <!--T:5--> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <translate> <!--T:75--> As we described before, we know that the arguments (<tvar name="1"><code>Z30000K1</code></tvar> and <tvar name="2"><code>Z30000K2</code></tvar>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:9--> Since this is Python, do not forget to indent this line. <!--T:76--> If you have followed our advice to [[<tvar name="1">#Practice Test-Driven Development</tvar>|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. <!--T:11--> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on <tvar name="1">[[Wikifunctions:Python implementations]]</tvar>. === Code in JavaScript === <!--T:77--> <!--T:13--> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <tvar name="1"><code>Z30000</code></tvar>. <!--T:15--> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <tvar name="1"><code>Z30000</code></tvar> with its two arguments, the function template should look like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <translate> <!--T:78--> We know that the arguments (<tvar name="1"><code>Z30000K1</code></tvar> and <tvar name="2"><code>Z30000K2</code></tvar>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:79--> If you have tests as recommended in the [[<tvar name="1">#Practice Test-Driven Development</tvar>|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. <!--T:21--> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on <tvar name="1">[[Wikifunctions:JavaScript implementations]]</tvar>. == Compositions == <!--T:22--> <!--T:23--> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <tvar name="1"><code>Z30000</code></tvar>. <!--T:24--> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. <!--T:25--> For example, for the given Function, we could use the existing Function <tvar name="1">{{Z|Z10000}}</tvar>. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </translate> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <translate> <!--T:80--> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </translate> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <translate> <!--T:81--> An alternative implementation could also use the existing Function <tvar name="1">{{Z|Z15175}}</tvar>, so your composition could be: </translate> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <translate> <!--T:82--> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the <tvar name="1">{{ll|Wikifunctions:Catalogue}}</tvar>. <!--T:83--> Let's try to create the second example, <tvar name="1"><code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code></tvar>. <!--T:84--> In order to create this: </translate> # <translate><!--T:85--> Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</translate> # <translate><!--T:86--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:87--> Click on the "›" icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:88--> Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</translate> # <translate><!--T:89--> You will see two new fields, one for each of the arguments needed for the selected function.</translate> # <translate><!--T:90--> For the first argument, we want to select the first input to our function:</translate> ## <translate><!--T:91--> Next to "first string", click on the "…" button and select "Argument reference".</translate> ## <translate><!--T:92--> Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</translate> # <translate><!--T:93--> For the second argument, we want to use the result of another call to "join two strings":</translate> ## <translate><!--T:94--> Next to "second string", click on the "…" button and select "Function call".</translate> ## <translate><!--T:95--> Under "function", search and select the function you want to call, which is again "join two strings".</translate> ## <translate><!--T:96--> For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</translate> <translate> <!--T:97--> Your composition is now complete! <!--T:98--> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[<tvar name="1">#Practice Test-Driven Development</tvar>|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </translate> [[File:Composition implementation expanded.png|frame|center|alt=<translate><!--T:99--> A Wikifunctions composition implementation in its expanded view</translate>|<translate><!--T:100--> A Wikifunctions composition implementation in its expanded view</translate>]] [[File:Composition implementation collapsed.png|frame|center|alt=<translate><!--T:101--> A Wikifunctions composition implementation in its collapsed view</translate>|<translate><!--T:102--> A Wikifunctions composition implementation in its collapsed view</translate>]] <translate> == Wikifunctions error handling == <!--T:103--> <!--T:104--> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. <!--T:105--> For this purpose, you can use <tvar name="1"><code>Wikifunctions.Error()</code></tvar> from your code implementations or the function <tvar name="2">{{Z|Z851}}</tvar> from your compositions. <!--T:106--> In this section you will learn: </translate> * <translate><!--T:107--> How to throw errors from both code and composition implementations,</translate> * <translate><!--T:108--> how to write tests for error cases, and</translate> * <translate><!--T:109--> how to catch and handle errors thrown by functions that you are using in your compositions.</translate> <translate> === Throwing errors from code implementations === <!--T:110--> <!--T:111--> When writing code, both from JavaScript and Python, you can use <tvar name="1"><code>Wikifunctions.Error()</code></tvar> to end the execution with a wanted error. <!--T:112--> <tvar name="1"><code>Wikifunctions.Error()</code></tvar> has two parameters: </translate> # <translate><!--T:113--> Error type: a string containing the ZID of the error type you want to return.</translate> # <translate><!--T:114--> Error arguments: a list of string arguments to build the error.</translate> <translate> <!--T:115--> Let's go one by one: ==== Error type ==== <!--T:116--> <!--T:117--> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[<tvar name="1">Special:ListObjectsByType/Z50</tvar>|this list]]. <!--T:118--> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </translate> [[File:Error type.png|thumb|alt=<translate><!--T:119--> Error type creation in Wikifunctions</translate>|<translate><!--T:120--> To create new Error type (Z50), edit the label and add the necessary keys.</translate>]] * <translate><!--T:121--> '''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</translate> * <translate><!--T:122--> '''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</translate> <translate> ==== Error arguments ==== <!--T:123--> <!--T:124--> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. ==== Using Wikifunctions.Error() ==== <!--T:125--> <!--T:126--> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <tvar name="1"><code>Z30005</code></tvar>. Your error type has two string keys: </translate> * <translate><!--T:127--> Input key: contains the key of the failing input</translate> * <translate><!--T:128--> Input value: contains the current value of the failing input</translate> <translate> <!--T:129--> To raise an error in your JavaScript implementation you should do something like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // <translate nowrap><!--T:309--> If the first input is empty, raise error <tvar name="1">Z30005</tvar></translate> // <translate nowrap><!--T:310--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // <translate nowrap><!--T:311--> If the second input is empty, raise error <tvar name="1">Z30005</tvar></translate> // <translate nowrap><!--T:312--> with two string args: [ second input key, second input value ]</translate> Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:130--> To raise an error in your Python implementation you should do something like this: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # <translate nowrap><!--T:313--> If the first input is empty, raise error <tvar name="1">Z30005</tvar></translate> # <translate nowrap><!--T:314--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # <translate nowrap><!--T:315--> If the second input is empty, raise error <tvar name="1">Z30005</tvar></translate> # <translate nowrap><!--T:316--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:131--> Remember that calling <tvar name="1"><code>Wikifunctions.Error()</code></tvar> ends the execution! === Throwing errors from compositions === <!--T:132--> <!--T:133--> If you are creating a composition implementation, you can throw an error by calling the special function <tvar name="1">{{Z|Z851}}</tvar>. ==== Throw Error function (Z851) ==== <!--T:134--> <!--T:135--> The <tvar name="1">{{Z|Z851}}</tvar> function is similar to the <tvar name="2"><code>Wikifunctions.Error()</code></tvar> method and takes two arguments: </translate> * <translate><!--T:136--> '''Error type''' – A reference to the Error type you want to raise</translate> * <translate><!--T:137--> '''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</translate> <translate> ==== Using Throw Error ==== <!--T:138--> <!--T:139--> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </translate> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <translate> <!--T:140--> To do this, you need to create conditional paths, for which you can use the <tvar name="1">{{Z|Z802}}</tvar> function. Think of it like this: </translate> * <translate><!--T:141--> If the first argument is empty, throw an error for the first argument</translate> * <translate><!--T:142--> Else, proceed to check the second argument</translate> * <translate><!--T:143--> If the second argument is empty, throw an error for the second argument</translate> * <translate><!--T:144--> Else, proceed with the success path and return the joint strings with the space separator</translate> <translate> <!--T:145--> Or in functional pseudo code: </translate> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <translate> <!--T:146--> Let's create this step by step: </translate> # <translate><!--T:147--> Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</translate> # <translate><!--T:148--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:149--> Click on the "›” icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:150--> Under "function" search and select the outermost function you want to use, which in this case is "if".</translate> # <translate><!--T:151--> Check the validity of the first argument:</translate> ## <translate><!--T:152--> Next to "condition", click on the "…" button and select "function call"</translate> ## <translate><!--T:153--> Under "function", search and select the function "is empty string"</translate> ## <translate><!--T:154--> Next to "input", click on the "…" button and select "argument reference"</translate> ## <translate><!--T:155--> Under "key id", select the first input (e.g. "first string")</translate> ## <translate><!--T:156--> You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</translate> # <translate><!--T:157--> Throw error if the condition is true:</translate> ## <translate><!--T:158--> Next to "then", click on the "…" button and select "function call"</translate> ## <translate><!--T:159--> Under "function", search and select the function "Throw Error"</translate> ## <translate><!--T:160--> Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</translate> ## <translate><!--T:161--> Under "error parameters", add two items by clicking on the "+" button</translate> ## <translate><!--T:162--> For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</translate> ## <translate><!--T:163--> For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</translate> ## <translate><!--T:164--> Under "key id", select the first input (e.g. "first string")</translate> ## <translate><!--T:165--> You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</translate> # <translate><!--T:166--> Continue to check the second argument if the first was good:</translate> ## <translate><!--T:167--> Next to "else", click on the "…" button and select "function call"</translate> ## <translate><!--T:168--> Under "function", search and select the function "if"</translate> ## <translate><!--T:169--> Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</translate> ## <translate><!--T:170--> Set up "then" to throw an error for the second argument by following the same process as described in step 6.</translate> # <translate><!--T:171--> Finally, set up the success path:</translate> ## <translate><!--T:172--> Next to the nested "else", click on the "…" button and select "function call"</translate> ## <translate><!--T:173--> Under "function", search and select the successful function, which in this case can be "join strings with separator"</translate> ## <translate><!--T:174--> Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</translate> ## <translate><!--T:175--> Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</translate> ## <translate><!--T:176--> Under "separator" add a space into the text field</translate> <translate> <!--T:177--> The resulting function call should look like this: </translate> [[File:Throw error expanded.png|frame|center|alt=<translate><!--T:178--> Wikifunctions composition using Throw Error function</translate>|<translate><!--T:179--> Wikifunctions composition using Throw Error function</translate>]] [[File:Throw error collapsed.png|frame|center|alt=<translate><!--T:180--> Wikifunctions composition using Throw Error function, in its collapsed view</translate>|<translate><!--T:181--> Wikifunctions composition using Throw Error function, in its collapsed view</translate>]] <translate> === Handling errors in compositions === <!--T:182--> <!--T:183--> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. <!--T:184--> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <tvar name="1"><code>Z30010</code></tvar>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. <!--T:185--> You could create a composition using our example function "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar> to generate the name. If any of the inputs are empty, you know that <tvar name="1"><code>Z30000</code></tvar> will throw an error of type <tvar name="2"><code>Z30005</code></tvar>. Using the function <tvar name="3">{{Z|Z850}}</tvar> as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. ==== Try-Catch function (Z850) ==== <!--T:186--> <!--T:187--> The <tvar name="1">{{Z|Z850}}</tvar> function is built-in with ZID <tvar name="2"><code>Z850</code></tvar> and takes three arguments: </translate> * <translate><!--T:188--> '''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</translate> * <translate><!--T:189--> '''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</translate> * <translate><!--T:190--> '''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</translate> <translate> ==== Using Try-Catch ==== <!--T:191--> <!--T:192--> Once we have all the functions for our composition, we can craft it like this: </translate> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <translate> <!--T:193--> This means that: </translate> * <translate><!--T:194--> The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</translate> * <translate><!--T:195--> If any of the inputs are blank, "Join two strings with a space" with raise an error of type <tvar name="1"><code>Z30005</code></tvar></translate> * <translate><!--T:196--> Our <tvar name="1">{{Z|Z850}}</tvar> will then detect this error and run the <tvar name="2">{{Z|Z801}}</tvar> function to return "Unknown"</translate> <translate> <!--T:197--> Let's create this step by step: </translate> # <translate><!--T:198--> Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</translate> # <translate><!--T:199--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:200--> Click on the "›” icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:201--> Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</translate> # <translate><!--T:202--> Set the main function call:</translate> ## <translate><!--T:203--> Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</translate> ## <translate><!--T:204--> Under "function" search and select the function "join two strings with space"</translate> ## <translate><!--T:205--> Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</translate> ## <translate><!--T:206--> Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</translate> # <translate><!--T:207--> Select the error to catch:</translate> ## <translate><!--T:208--> Under "error type", search and select "bad string input" – you can search directly by its ZID <tvar name="1"><code>Z30005</code></tvar></translate> # <translate><!--T:209--> Set the error handler function call:</translate> ## <translate><!--T:210--> Next to "error handler", click on the "…" button and select "function call"</translate> ## <translate><!--T:211--> Under "function", search and select the function "echo"</translate> ## <translate><!--T:212--> Under "input" and "type", search and select the type "String"</translate> ## <translate><!--T:213--> Now, under "input", type "Unknown" in the text field</translate> <translate> <!--T:214--> The resulting function should look like this: </translate> [[File:Try catch expanded.png|frame|center|alt=<translate><!--T:215--> Wikifunctions composition using Try-catch function, in expanded mode</translate>|<translate><!--T:216--> Wikifunctions composition using Try-catch function, in expanded mode</translate>]] [[File:Try catch collapsed.png|frame|center|alt=<translate><!--T:217--> Wikifunctions composition using Try-catch function, in collapsed mode</translate>|<translate><!--T:218--> Wikifunctions composition using Try-catch function, in collapsed mode</translate>]] <translate> === Testing your failure use cases === <!--T:219--> <!--T:220--> As we introduced in the above section about [[<tvar name="1">#Practice Test-Driven Development</tvar>|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. <!--T:221--> To do that, you will need other two system functions: ==== Is error type (Z852) ==== <!--T:222--> <!--T:223--> The <tvar name="1">{{Z|Z852}}</tvar> function is built-in with ZID <tvar name="2"><code>Z852</code></tvar> and takes two arguments: </translate> * <translate><!--T:224--> '''Error''' – An <tvar name="1">{{Z|Z5}}</tvar> object, which can be thrown by a failing call. An error instance has a type and a value.</translate> * <translate><!--T:225--> '''Error type''' – A reference to an <tvar name="1">{{Z|Z50}}</tvar> which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</translate> <translate> ==== Get error thrown by function call (Z853) ==== <!--T:226--> <!--T:227--> The <tvar name="1">{{Z|Z853}}</tvar> function is built-in with ZID <tvar name="2"><code>Z853</code></tvar> and takes one argument: </translate> * <translate><!--T:228--> '''Function call''' – A function call which can either return a successful value of any type, or throw an error.</translate> <translate> <!--T:229--> This function returns a <tvar name="1">{{Z|Z882}}</tvar> with a <tvar name="2">{{Z|Z40}}</tvar> in first place and an <tvar name="3">{{Z|Z1}}</tvar> in the second: </translate> * <translate><!--T:230--> If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</translate> * <translate><!--T:231--> If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</translate> <translate> <!--T:232--> To use this function in your compositions, you might need to use the additional functions: </translate> * <translate><!--T:233--> <tvar name="1">{{Z|Z821}}</tvar>, and</translate> * {{Z|Z822}} <translate> ==== Testing errors ==== <!--T:234--> <!--T:235--> Say our target function, "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar>, throws an error of type <tvar name="2"><code>Z30005</code></tvar> and we want to test this behavior. To do that we need to: </translate> * <translate><!--T:236--> Throw a failing function call</translate> * <translate><!--T:237--> Get the error using the function <tvar name="1">{{Z|Z853}}</tvar></translate> * <translate><!--T:238--> Check that the error is the right type with <tvar name="1">{{Z|Z852}}</tvar></translate> <translate> <!--T:239--> Tests have two fields: </translate> * <translate><!--T:240--> '''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</translate> * <translate><!--T:241--> '''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</translate> <translate> <!--T:242--> For step-by-step instructions on how to create tests, see <tvar name="1">{{ll|Wikifunctions:Introduction#Create_tests}}</tvar>. <!--T:243--> In our example, we can structure it like this — but this is not the only way! <!--T:244--> The call, which will return an <tvar name="1">{{Z|Z5}}</tvar> object: </translate> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <translate> <!--T:245--> And the result validation, which will take the <tvar name="1">{{Z|Z5}}</tvar> object as its first argument: </translate> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <translate> <!--T:246--> Let's do this step by step: </translate> # <translate><!--T:247--> Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</translate> # <translate><!--T:248--> First, let's set the call:</translate> ## <translate><!--T:249--> Under "call", click the "›" chevron button to expand the function call.</translate> ## <translate><!--T:250--> Under "function", edit the field and search and select the function "Get second element of a typed pair"</translate> ## <translate><!--T:251--> Once selected, next to "Typed pair", click on the "…" button and select "function call"</translate> ## <translate><!--T:252--> Under "function", search and select the function "Get error thrown by function call"</translate> ## <translate><!--T:253--> Next to "function call", click on the "…" button and select "function call"</translate> ## <translate><!--T:254--> Under "function", search and select the function "Join two strings with a space" (or by ZID <tvar name="1"><code>Z30000</code></tvar>)</translate> ## <translate><!--T:255--> Now set the inputs so that they cause a failure: at least one of them should be empty.</translate> ## <translate><!--T:256--> You can now collapse your "call" by clicking again on the down-chevron button if you want!</translate> # <translate><!--T:257--> Next, let's set the result validation:</translate> ## <translate><!--T:258--> Under "result validation", click the "›" chevron button to expand the function call.</translate> ## <translate><!--T:259--> Under "function", edit the field and search and select the function "Is error type"</translate> ## <translate><!--T:260--> Now you will only be asked to configure the second argument. Under "error type", search and select your <tvar name="1"><code>Z30005</code></tvar> error type.</translate> # <translate><!--T:261--> And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</translate> <translate> <!--T:262--> If everything went right, you can now save your test. It should look like this: </translate> [[File:Get error expanded.png|frame|center|alt=<translate><!--T:263--> Testing a failure using Get error and Is error type functions, in expanded mode</translate>|<translate><!--T:264--> Testing a failure using Get error and Is error type functions, in expanded mode</translate>]] [[File:Get error collapsed.png|frame|center|alt=<translate><!--T:265--> Testing a failure using Get error and Is error type functions, in collapsed mode</translate>|<translate><!--T:266--> Testing a failure using Get error and Is error type functions, in collapsed mode</translate>]] <translate> == Debugging your implementations == <!--T:267--> <!--T:268--> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. <!--T:269--> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> from your code implementations or the function <tvar name="2">{{Z|Z854}}</tvar> from your compositions. <!--T:270--> In this section you will learn: </translate> * <translate><!--T:271--> How to add debug messages from both code and composition implementations,</translate> * <translate><!--T:272--> how to inspect the metadata manually or via the UI to inspect these logs.</translate> <translate> === Debugging your code implementations === <!--T:273--> <!--T:274--> When writing code, both from JavaScript and Python3, you can use <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> to add a message to your debugging log and continue the execution. <!--T:275--> <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. <!--T:276--> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </translate> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:277--> And the same in your Python3 implementation will be: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:278--> This way, no matter what happens, we will be adding one message to your debugging logs: </translate> * <translate><!--T:279--> If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</translate> * <translate><!--T:280--> If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</translate> <translate> === Debugging your compositions === <!--T:281--> <!--T:282--> To support debugging compositions, Wikifunctions provides the built-in function <tvar name="1">{{Z|Z854}}</tvar>. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <tvar name="2"><code>executorDebugLogs</code></tvar> key. ==== Add debug log to function call (Z854) ==== <!--T:283--> <!--T:284--> The <tvar name="1">{{Z|Z854}}</tvar> function is built-in with ZID <tvar name="2"><code>Z854</code></tvar> and takes two arguments: </translate> * <translate><!--T:285--> '''Function call''' – Any composition you want to execute.</translate> * <translate><!--T:286--> '''Debug log''' – A string message that will be recorded if the given function call is evaluated.</translate> <translate> <!--T:287--> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. <!--T:288--> You will benefit from this built-in if you want to observe: </translate> * <translate><!--T:289--> Which branch of a conditional was executed, or</translate> * <translate><!--T:290--> the order of evaluation in a composition.</translate> <translate> ==== Using Add debug log to function call ==== <!--T:291--> <!--T:292--> Say that you want to add debug logs to our example function "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </translate> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <translate> <!--T:293--> This way, </translate> * <translate><!--T:294--> when called with an empty first input, the function will return a failed response, and the metadata will contain an <tvar name="1"><code>executorDebugLogs</code></tvar> entry with the "failed on first input" log.</translate> * <translate><!--T:295--> When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</translate> * <translate><!--T:296--> When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <tvar name="1"><code>executorDebugLogs</code></tvar> key.</translate> <translate> <!--T:297--> This is the way this composition would look: </translate> [[File:Add debug log expanded.png|frame|center|alt=<translate><!--T:298--> Composition implementation using Add debug logs to log all possible execution paths</translate>|<translate><!--T:299--> Composition implementation using Add debug logs to log all possible execution paths</translate>]] <translate> === Accessing execution debug logs === <!--T:300--> <!--T:301--> Whether your execution logs are added via <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> or via the <tvar name="2">{{Z|Z854}}</tvar> built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. <!--T:302--> The error and debug information will appear at the top of the "Details" dialog. <!--T:303--> This is what you would see when running the composition from our previous example with valid and invalid inputs: </translate> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<translate><!--T:304--> Function metadata dialog for a successful execution with debug logs</translate>]] | [[File:Execution logs failure.png|frameless|center|alt=<translate><!--T:305--> Function metadata dialog for a failed execution with debug logs</translate>]] |- | <translate><!--T:306--> Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</translate> | <translate><!--T:307--> Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</translate> |} [[Category:How to create implementations| {{#translation:}}]] 5cje53ko09k0f75c1le692h902j3cny 276443 276438 2026-05-20T06:15:24Z Ameisenigel 44 Marked this version for translation 276443 wikitext text/x-wiki <languages/> <translate> <!--T:1--> This page provides a more detailed guide to '''creating implementations''', beyond the overview at <tvar name="1">{{ll|Wikifunctions:Introduction}}</tvar>. == Types of Implementations == <!--T:47--> <!--T:48--> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. <!--T:49--> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. <!--T:50--> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"<tvar name="1">{{int|wikilambda-implementation-selector-none}}</tvar>"'' == Practice Test-Driven Development == <!--T:51--> <!--T:52--> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. <!--T:53--> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. <!--T:54--> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <translate> <!--T:55--> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. <!--T:56--> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <translate> <!--T:57--> or ... </translate> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <translate> <!--T:58--> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". == Code implementations == <!--T:59--> </translate> [[File:Code implementation.png|thumb|alt=<translate><!--T:60--> Wikifunctions code editor initialized with a function template</translate>|<translate><!--T:61--> When adding a new code implementation, the function template is initialized with the function and argument names</translate>]] <translate> <!--T:62--> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. === Using input types in your code === <!--T:63--> <!--T:64--> Wikifunctions types <tvar name="1">{{Z|Z6}}</tvar> and <tvar name="2">{{Z|Z40}}</tvar> can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. <!--T:65--> For example, let's say we want to write some Python code that handles an input of type <tvar name="1">{{Z|Z20420}}</tvar>. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter <tvar name="2">{{Z|Z20424}}</tvar> will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </translate> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <translate> <!--T:66--> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <tvar name="1"><code>Z30000</code></tvar> has one input <tvar name="2"><code>Z30000K1</code></tvar> of type <tvar name="3">{{Z|Z11}}</tvar>. This type has two keys: <tvar name="4"><code>Z11K1</code></tvar> for the language (itself an object of type <tvar name="5">{{Z|Z60}}</tvar>), and <tvar name="6"><code>Z11K2</code></tvar> for the string value. Similarly, the language object has a key <tvar name="7"><code>Z60K1</code></tvar> for the language code. So, to get a string with the language code and the text, you can write: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // <translate nowrap><!--T:308--> e.g. "en: some text"</translate> return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <translate> <!--T:67--> For a quick reference of the available type conversions visit [[<tvar name="1">Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion</tvar>|the default type conversion table]]. === Returning the right outputs === <!--T:68--> <!--T:69--> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions <tvar name="1">{{Z|Z6}}</tvar> object and any native boolean returned by your implementation will be converted into a Wikifunctions <tvar name="2">{{Z|Z40}}</tvar> object. <!--T:70--> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of <tvar name="1">{{Z|Z20420}}</tvar>, the <tvar name="2">{{Z|Z20443}}</tvar> will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. <!--T:71--> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <tvar name="1"><code>Z30000</code></tvar> takes two string inputs: language code and text, and should return a <tvar name="2">{{Z|Z11}}</tvar> object. You can do this in Python by using the <tvar name="3"><code>ZObject</code></tvar> constructor: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <translate> <!--T:72--> Or in JavaScript: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <translate> <!--T:73--> You can learn more about the <tvar name="1"><code>ZObject</code></tvar> class and other useful constructors in <tvar name="2">{{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}}</tvar> </translate>{{phab|T392750}}<translate> <!--T:317--> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. === Code in Python === <!--T:74--> <!--T:3--> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. <!--T:5--> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <translate> <!--T:75--> As we described before, we know that the arguments (<tvar name="1"><code>Z30000K1</code></tvar> and <tvar name="2"><code>Z30000K2</code></tvar>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:9--> Since this is Python, do not forget to indent this line. <!--T:76--> If you have followed our advice to [[<tvar name="1">#Practice Test-Driven Development</tvar>|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. <!--T:11--> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on <tvar name="1">[[Wikifunctions:Python implementations]]</tvar>. === Code in JavaScript === <!--T:77--> <!--T:13--> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <tvar name="1"><code>Z30000</code></tvar>. <!--T:15--> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <tvar name="1"><code>Z30000</code></tvar> with its two arguments, the function template should look like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <translate> <!--T:78--> We know that the arguments (<tvar name="1"><code>Z30000K1</code></tvar> and <tvar name="2"><code>Z30000K2</code></tvar>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:79--> If you have tests as recommended in the [[<tvar name="1">#Practice Test-Driven Development</tvar>|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. <!--T:21--> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on <tvar name="1">[[Wikifunctions:JavaScript implementations]]</tvar>. == Compositions == <!--T:22--> <!--T:23--> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <tvar name="1"><code>Z30000</code></tvar>. <!--T:24--> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. <!--T:25--> For example, for the given Function, we could use the existing Function <tvar name="1">{{Z|Z10000}}</tvar>. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </translate> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <translate> <!--T:80--> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </translate> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <translate> <!--T:81--> An alternative implementation could also use the existing Function <tvar name="1">{{Z|Z15175}}</tvar>, so your composition could be: </translate> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <translate> <!--T:82--> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the <tvar name="1">{{ll|Wikifunctions:Catalogue}}</tvar>. <!--T:83--> Let's try to create the second example, <tvar name="1"><code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code></tvar>. <!--T:84--> In order to create this: </translate> # <translate><!--T:85--> Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</translate> # <translate><!--T:86--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:87--> Click on the "›" icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:88--> Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</translate> # <translate><!--T:89--> You will see two new fields, one for each of the arguments needed for the selected function.</translate> # <translate><!--T:90--> For the first argument, we want to select the first input to our function:</translate> ## <translate><!--T:91--> Next to "first string", click on the "…" button and select "Argument reference".</translate> ## <translate><!--T:92--> Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</translate> # <translate><!--T:93--> For the second argument, we want to use the result of another call to "join two strings":</translate> ## <translate><!--T:94--> Next to "second string", click on the "…" button and select "Function call".</translate> ## <translate><!--T:95--> Under "function", search and select the function you want to call, which is again "join two strings".</translate> ## <translate><!--T:96--> For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</translate> <translate> <!--T:97--> Your composition is now complete! <!--T:98--> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[<tvar name="1">#Practice Test-Driven Development</tvar>|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </translate> [[File:Composition implementation expanded.png|frame|center|alt=<translate><!--T:99--> A Wikifunctions composition implementation in its expanded view</translate>|<translate><!--T:100--> A Wikifunctions composition implementation in its expanded view</translate>]] [[File:Composition implementation collapsed.png|frame|center|alt=<translate><!--T:101--> A Wikifunctions composition implementation in its collapsed view</translate>|<translate><!--T:102--> A Wikifunctions composition implementation in its collapsed view</translate>]] <translate> == Wikifunctions error handling == <!--T:103--> <!--T:104--> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. <!--T:105--> For this purpose, you can use <tvar name="1"><code>Wikifunctions.Error()</code></tvar> from your code implementations or the function <tvar name="2">{{Z|Z851}}</tvar> from your compositions. <!--T:106--> In this section you will learn: </translate> * <translate><!--T:107--> How to throw errors from both code and composition implementations,</translate> * <translate><!--T:108--> how to write tests for error cases, and</translate> * <translate><!--T:109--> how to catch and handle errors thrown by functions that you are using in your compositions.</translate> <translate> === Throwing errors from code implementations === <!--T:110--> <!--T:111--> When writing code, both from JavaScript and Python, you can use <tvar name="1"><code>Wikifunctions.Error()</code></tvar> to end the execution with a wanted error. <!--T:112--> <tvar name="1"><code>Wikifunctions.Error()</code></tvar> has two parameters: </translate> # <translate><!--T:113--> Error type: a string containing the ZID of the error type you want to return.</translate> # <translate><!--T:114--> Error arguments: a list of string arguments to build the error.</translate> <translate> <!--T:115--> Let's go one by one: ==== Error type ==== <!--T:116--> <!--T:117--> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[<tvar name="1">Special:ListObjectsByType/Z50</tvar>|this list]]. <!--T:118--> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </translate> [[File:Error type.png|thumb|alt=<translate><!--T:119--> Error type creation in Wikifunctions</translate>|<translate><!--T:120--> To create new Error type (Z50), edit the label and add the necessary keys.</translate>]] * <translate><!--T:121--> '''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</translate> * <translate><!--T:122--> '''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</translate> <translate> ==== Error arguments ==== <!--T:123--> <!--T:124--> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. ==== Using Wikifunctions.Error() ==== <!--T:125--> <!--T:126--> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <tvar name="1"><code>Z30005</code></tvar>. Your error type has two string keys: </translate> * <translate><!--T:127--> Input key: contains the key of the failing input</translate> * <translate><!--T:128--> Input value: contains the current value of the failing input</translate> <translate> <!--T:129--> To raise an error in your JavaScript implementation you should do something like this: </translate> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // <translate nowrap><!--T:309--> If the first input is empty, raise error <tvar name="1">Z30005</tvar></translate> // <translate nowrap><!--T:310--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // <translate nowrap><!--T:311--> If the second input is empty, raise error <tvar name="1">Z30005</tvar></translate> // <translate nowrap><!--T:312--> with two string args: [ second input key, second input value ]</translate> Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:130--> To raise an error in your Python implementation you should do something like this: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # <translate nowrap><!--T:313--> If the first input is empty, raise error <tvar name="1">Z30005</tvar></translate> # <translate nowrap><!--T:314--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # <translate nowrap><!--T:315--> If the second input is empty, raise error <tvar name="1">Z30005</tvar></translate> # <translate nowrap><!--T:316--> with two string args: [ first input key, first input value ]</translate> Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:131--> Remember that calling <tvar name="1"><code>Wikifunctions.Error()</code></tvar> ends the execution! === Throwing errors from compositions === <!--T:132--> <!--T:133--> If you are creating a composition implementation, you can throw an error by calling the special function <tvar name="1">{{Z|Z851}}</tvar>. ==== Throw Error function (Z851) ==== <!--T:134--> <!--T:135--> The <tvar name="1">{{Z|Z851}}</tvar> function is similar to the <tvar name="2"><code>Wikifunctions.Error()</code></tvar> method and takes two arguments: </translate> * <translate><!--T:136--> '''Error type''' – A reference to the Error type you want to raise</translate> * <translate><!--T:137--> '''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</translate> <translate> ==== Using Throw Error ==== <!--T:138--> <!--T:139--> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </translate> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <translate> <!--T:140--> To do this, you need to create conditional paths, for which you can use the <tvar name="1">{{Z|Z802}}</tvar> function. Think of it like this: </translate> * <translate><!--T:141--> If the first argument is empty, throw an error for the first argument</translate> * <translate><!--T:142--> Else, proceed to check the second argument</translate> * <translate><!--T:143--> If the second argument is empty, throw an error for the second argument</translate> * <translate><!--T:144--> Else, proceed with the success path and return the joint strings with the space separator</translate> <translate> <!--T:145--> Or in functional pseudo code: </translate> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <translate> <!--T:146--> Let's create this step by step: </translate> # <translate><!--T:147--> Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</translate> # <translate><!--T:148--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:149--> Click on the "›” icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:150--> Under "function" search and select the outermost function you want to use, which in this case is "if".</translate> # <translate><!--T:151--> Check the validity of the first argument:</translate> ## <translate><!--T:152--> Next to "condition", click on the "…" button and select "function call"</translate> ## <translate><!--T:153--> Under "function", search and select the function "is empty string"</translate> ## <translate><!--T:154--> Next to "input", click on the "…" button and select "argument reference"</translate> ## <translate><!--T:155--> Under "key id", select the first input (e.g. "first string")</translate> ## <translate><!--T:156--> You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</translate> # <translate><!--T:157--> Throw error if the condition is true:</translate> ## <translate><!--T:158--> Next to "then", click on the "…" button and select "function call"</translate> ## <translate><!--T:159--> Under "function", search and select the function "Throw Error"</translate> ## <translate><!--T:160--> Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</translate> ## <translate><!--T:161--> Under "error parameters", add two items by clicking on the "+" button</translate> ## <translate><!--T:162--> For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</translate> ## <translate><!--T:163--> For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</translate> ## <translate><!--T:164--> Under "key id", select the first input (e.g. "first string")</translate> ## <translate><!--T:165--> You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</translate> # <translate><!--T:166--> Continue to check the second argument if the first was good:</translate> ## <translate><!--T:167--> Next to "else", click on the "…" button and select "function call"</translate> ## <translate><!--T:168--> Under "function", search and select the function "if"</translate> ## <translate><!--T:169--> Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</translate> ## <translate><!--T:170--> Set up "then" to throw an error for the second argument by following the same process as described in step 6.</translate> # <translate><!--T:171--> Finally, set up the success path:</translate> ## <translate><!--T:172--> Next to the nested "else", click on the "…" button and select "function call"</translate> ## <translate><!--T:173--> Under "function", search and select the successful function, which in this case can be "join strings with separator"</translate> ## <translate><!--T:174--> Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</translate> ## <translate><!--T:175--> Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</translate> ## <translate><!--T:176--> Under "separator" add a space into the text field</translate> <translate> <!--T:177--> The resulting function call should look like this: </translate> [[File:Throw error expanded.png|frame|center|alt=<translate><!--T:178--> Wikifunctions composition using Throw Error function</translate>|<translate><!--T:179--> Wikifunctions composition using Throw Error function</translate>]] [[File:Throw error collapsed.png|frame|center|alt=<translate><!--T:180--> Wikifunctions composition using Throw Error function, in its collapsed view</translate>|<translate><!--T:181--> Wikifunctions composition using Throw Error function, in its collapsed view</translate>]] <translate> === Handling errors in compositions === <!--T:182--> <!--T:183--> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. <!--T:184--> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <tvar name="1"><code>Z30010</code></tvar>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. <!--T:185--> You could create a composition using our example function "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar> to generate the name. If any of the inputs are empty, you know that <tvar name="1"><code>Z30000</code></tvar> will throw an error of type <tvar name="2"><code>Z30005</code></tvar>. Using the function <tvar name="3">{{Z|Z850}}</tvar> as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. ==== Try-Catch function (Z850) ==== <!--T:186--> <!--T:187--> The <tvar name="1">{{Z|Z850}}</tvar> function is built-in with ZID <tvar name="2"><code>Z850</code></tvar> and takes three arguments: </translate> * <translate><!--T:188--> '''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</translate> * <translate><!--T:189--> '''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</translate> * <translate><!--T:190--> '''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</translate> <translate> ==== Using Try-Catch ==== <!--T:191--> <!--T:192--> Once we have all the functions for our composition, we can craft it like this: </translate> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <translate> <!--T:193--> This means that: </translate> * <translate><!--T:194--> The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</translate> * <translate><!--T:195--> If any of the inputs are blank, "Join two strings with a space" with raise an error of type <tvar name="1"><code>Z30005</code></tvar></translate> * <translate><!--T:196--> Our <tvar name="1">{{Z|Z850}}</tvar> will then detect this error and run the <tvar name="2">{{Z|Z801}}</tvar> function to return "Unknown"</translate> <translate> <!--T:197--> Let's create this step by step: </translate> # <translate><!--T:198--> Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</translate> # <translate><!--T:199--> Make sure that the option "composition" under "Implementation" is selected.</translate> # <translate><!--T:200--> Click on the "›” icon or click the "Select Function" link to expand the function details.</translate> # <translate><!--T:201--> Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</translate> # <translate><!--T:202--> Set the main function call:</translate> ## <translate><!--T:203--> Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</translate> ## <translate><!--T:204--> Under "function" search and select the function "join two strings with space"</translate> ## <translate><!--T:205--> Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</translate> ## <translate><!--T:206--> Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</translate> # <translate><!--T:207--> Select the error to catch:</translate> ## <translate><!--T:208--> Under "error type", search and select "bad string input" – you can search directly by its ZID <tvar name="1"><code>Z30005</code></tvar></translate> # <translate><!--T:209--> Set the error handler function call:</translate> ## <translate><!--T:210--> Next to "error handler", click on the "…" button and select "function call"</translate> ## <translate><!--T:211--> Under "function", search and select the function "echo"</translate> ## <translate><!--T:212--> Under "input" and "type", search and select the type "String"</translate> ## <translate><!--T:213--> Now, under "input", type "Unknown" in the text field</translate> <translate> <!--T:214--> The resulting function should look like this: </translate> [[File:Try catch expanded.png|frame|center|alt=<translate><!--T:215--> Wikifunctions composition using Try-catch function, in expanded mode</translate>|<translate><!--T:216--> Wikifunctions composition using Try-catch function, in expanded mode</translate>]] [[File:Try catch collapsed.png|frame|center|alt=<translate><!--T:217--> Wikifunctions composition using Try-catch function, in collapsed mode</translate>|<translate><!--T:218--> Wikifunctions composition using Try-catch function, in collapsed mode</translate>]] <translate> === Testing your failure use cases === <!--T:219--> <!--T:220--> As we introduced in the above section about [[<tvar name="1">#Practice Test-Driven Development</tvar>|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. <!--T:221--> To do that, you will need other two system functions: ==== Is error type (Z852) ==== <!--T:222--> <!--T:223--> The <tvar name="1">{{Z|Z852}}</tvar> function is built-in with ZID <tvar name="2"><code>Z852</code></tvar> and takes two arguments: </translate> * <translate><!--T:224--> '''Error''' – An <tvar name="1">{{Z|Z5}}</tvar> object, which can be thrown by a failing call. An error instance has a type and a value.</translate> * <translate><!--T:225--> '''Error type''' – A reference to an <tvar name="1">{{Z|Z50}}</tvar> which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</translate> <translate> ==== Get error thrown by function call (Z853) ==== <!--T:226--> <!--T:227--> The <tvar name="1">{{Z|Z853}}</tvar> function is built-in with ZID <tvar name="2"><code>Z853</code></tvar> and takes one argument: </translate> * <translate><!--T:228--> '''Function call''' – A function call which can either return a successful value of any type, or throw an error.</translate> <translate> <!--T:229--> This function returns a <tvar name="1">{{Z|Z882}}</tvar> with a <tvar name="2">{{Z|Z40}}</tvar> in first place and an <tvar name="3">{{Z|Z1}}</tvar> in the second: </translate> * <translate><!--T:230--> If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</translate> * <translate><!--T:231--> If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</translate> <translate> <!--T:232--> To use this function in your compositions, you might need to use the additional functions: </translate> * <translate><!--T:233--> <tvar name="1">{{Z|Z821}}</tvar>, and</translate> * {{Z|Z822}} <translate> ==== Testing errors ==== <!--T:234--> <!--T:235--> Say our target function, "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar>, throws an error of type <tvar name="2"><code>Z30005</code></tvar> and we want to test this behavior. To do that we need to: </translate> * <translate><!--T:236--> Throw a failing function call</translate> * <translate><!--T:237--> Get the error using the function <tvar name="1">{{Z|Z853}}</tvar></translate> * <translate><!--T:238--> Check that the error is the right type with <tvar name="1">{{Z|Z852}}</tvar></translate> <translate> <!--T:239--> Tests have two fields: </translate> * <translate><!--T:240--> '''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</translate> * <translate><!--T:241--> '''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</translate> <translate> <!--T:242--> For step-by-step instructions on how to create tests, see <tvar name="1">{{ll|Wikifunctions:Introduction#Create_tests}}</tvar>. <!--T:243--> In our example, we can structure it like this — but this is not the only way! <!--T:244--> The call, which will return an <tvar name="1">{{Z|Z5}}</tvar> object: </translate> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <translate> <!--T:245--> And the result validation, which will take the <tvar name="1">{{Z|Z5}}</tvar> object as its first argument: </translate> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <translate> <!--T:246--> Let's do this step by step: </translate> # <translate><!--T:247--> Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</translate> # <translate><!--T:248--> First, let's set the call:</translate> ## <translate><!--T:249--> Under "call", click the "›" chevron button to expand the function call.</translate> ## <translate><!--T:250--> Under "function", edit the field and search and select the function "Get second element of a typed pair"</translate> ## <translate><!--T:251--> Once selected, next to "Typed pair", click on the "…" button and select "function call"</translate> ## <translate><!--T:252--> Under "function", search and select the function "Get error thrown by function call"</translate> ## <translate><!--T:253--> Next to "function call", click on the "…" button and select "function call"</translate> ## <translate><!--T:254--> Under "function", search and select the function "Join two strings with a space" (or by ZID <tvar name="1"><code>Z30000</code></tvar>)</translate> ## <translate><!--T:255--> Now set the inputs so that they cause a failure: at least one of them should be empty.</translate> ## <translate><!--T:256--> You can now collapse your "call" by clicking again on the down-chevron button if you want!</translate> # <translate><!--T:257--> Next, let's set the result validation:</translate> ## <translate><!--T:258--> Under "result validation", click the "›" chevron button to expand the function call.</translate> ## <translate><!--T:259--> Under "function", edit the field and search and select the function "Is error type"</translate> ## <translate><!--T:260--> Now you will only be asked to configure the second argument. Under "error type", search and select your <tvar name="1"><code>Z30005</code></tvar> error type.</translate> # <translate><!--T:261--> And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</translate> <translate> <!--T:262--> If everything went right, you can now save your test. It should look like this: </translate> [[File:Get error expanded.png|frame|center|alt=<translate><!--T:263--> Testing a failure using Get error and Is error type functions, in expanded mode</translate>|<translate><!--T:264--> Testing a failure using Get error and Is error type functions, in expanded mode</translate>]] [[File:Get error collapsed.png|frame|center|alt=<translate><!--T:265--> Testing a failure using Get error and Is error type functions, in collapsed mode</translate>|<translate><!--T:266--> Testing a failure using Get error and Is error type functions, in collapsed mode</translate>]] <translate> == Debugging your implementations == <!--T:267--> <!--T:268--> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. <!--T:269--> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> from your code implementations or the function <tvar name="2">{{Z|Z854}}</tvar> from your compositions. <!--T:270--> In this section you will learn: </translate> * <translate><!--T:271--> How to add debug messages from both code and composition implementations,</translate> * <translate><!--T:272--> how to inspect the metadata manually or via the UI to inspect these logs.</translate> <translate> === Debugging your code implementations === <!--T:273--> <!--T:274--> When writing code, both from JavaScript and Python3, you can use <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> to add a message to your debugging log and continue the execution. <!--T:275--> <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. <!--T:276--> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </translate> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <translate> <!--T:277--> And the same in your Python3 implementation will be: </translate> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <translate> <!--T:278--> This way, no matter what happens, we will be adding one message to your debugging logs: </translate> * <translate><!--T:279--> If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</translate> * <translate><!--T:280--> If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</translate> <translate> === Debugging your compositions === <!--T:281--> <!--T:282--> To support debugging compositions, Wikifunctions provides the built-in function <tvar name="1">{{Z|Z854}}</tvar>. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <tvar name="2"><code>executorDebugLogs</code></tvar> key. ==== Add debug log to function call (Z854) ==== <!--T:283--> <!--T:284--> The <tvar name="1">{{Z|Z854}}</tvar> function is built-in with ZID <tvar name="2"><code>Z854</code></tvar> and takes two arguments: </translate> * <translate><!--T:285--> '''Function call''' – Any composition you want to execute.</translate> * <translate><!--T:286--> '''Debug log''' – A string message that will be recorded if the given function call is evaluated.</translate> <translate> <!--T:287--> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. <!--T:288--> You will benefit from this built-in if you want to observe: </translate> * <translate><!--T:289--> Which branch of a conditional was executed, or</translate> * <translate><!--T:290--> the order of evaluation in a composition.</translate> <translate> ==== Using Add debug log to function call ==== <!--T:291--> <!--T:292--> Say that you want to add debug logs to our example function "Join two strings with a space" or <tvar name="1"><code>Z30000</code></tvar>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </translate> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <translate> <!--T:293--> This way, </translate> * <translate><!--T:294--> when called with an empty first input, the function will return a failed response, and the metadata will contain an <tvar name="1"><code>executorDebugLogs</code></tvar> entry with the "failed on first input" log.</translate> * <translate><!--T:295--> When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</translate> * <translate><!--T:296--> When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <tvar name="1"><code>executorDebugLogs</code></tvar> key.</translate> <translate> <!--T:297--> This is the way this composition would look: </translate> [[File:Add debug log expanded.png|frame|center|alt=<translate><!--T:298--> Composition implementation using Add debug logs to log all possible execution paths</translate>|<translate><!--T:299--> Composition implementation using Add debug logs to log all possible execution paths</translate>]] <translate> === Accessing execution debug logs === <!--T:300--> <!--T:301--> Whether your execution logs are added via <tvar name="1"><code>Wikifunctions.Debug()</code></tvar> or via the <tvar name="2">{{Z|Z854}}</tvar> built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. <!--T:302--> The error and debug information will appear at the top of the "Details" dialog. <!--T:303--> This is what you would see when running the composition from our previous example with valid and invalid inputs: </translate> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<translate><!--T:304--> Function metadata dialog for a successful execution with debug logs</translate>]] | [[File:Execution logs failure.png|frameless|center|alt=<translate><!--T:305--> Function metadata dialog for a failed execution with debug logs</translate>]] |- | <translate><!--T:306--> Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</translate> | <translate><!--T:307--> Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</translate> |} [[Category:How to create implementations| {{#translation:}}]] 4if9rizxwo4q0t2b4kkjbee9aa8bdz9 Wikifunctions:Project chat 4 1184 276398 276138 2026-05-20T03:22:57Z Theki 2389 /* Z35298 */ re 276398 wikitext text/x-wiki {{shortcut|[[WF:CHAT]]|[[WF:PC]]|[[WF:VP]]}} __NEWSECTIONLINK__ [[Category:Help]] <!-- please do not remove this line --> Welcome to the Project chat, a place to discuss any and all aspects of Wikifunctions: the project itself, policy and proposals, individual data items, technical issues, etc. Other places to find help: * [[Wikifunctions:Administrators' noticeboard]] * [[Wikifunctions:Report a technical problem]] * [[Wikifunctions:FAQ]] {{Autoarchive resolved section |age = 1 |archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) |timeout=30 }} {{Archives|{{#tag:div|<br />{{Flatlist|{{Special:PrefixIndex/WF:Project chat/Archive/|stripprefix=1|hideredirects=1}} |class=mw-collapsible-content|style=font-size:92%;}}|class="mw-collapsible mw-collapsible-toggle mw-collapsed"}} |prefix=WF:Project chat/Archive/ }} == "language" argument for certain functions == Hello. I am relatively new to Wikifunctions. Recently, I tried to create functions for Chinese translation of {{Z|Z26570}} and {{Z|Z26095}} (which became [[Z32788]] and [[Z32900]]). During the creation of these functions, I was trying to take {{Z|Z32212}} as reference. And I realized that the defining role sentence function is taking <code>language</code> as an argument (and the test case of the Chinese-language function already contains two varieties of Chinese). This makes it possible to output monolingual text in <code>zh-hant</code>, <code>zh-hans</code>, <code>zh-tw</code>, or any varieties of the language. I think for this reason, it is better to have <code>language</code> as arguments for the implementation of Z26570 and Z26095, and potentially more functions that require {{Z|Z14294}}, since it would output the varieties code instead of just saying <code>zh</code> for <code>zh-hant</code>, <code>zh-hans</code>, <code>zh-tw</code> in the output of type {{Z|Z11}}. I am not sure how the fallback mechanism works if one of the language (varieties) do not have a labels/lexemes, but to me, it is reasonable to have a <code>language</code> argument. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 09:38, 31 March 2026 (UTC) :The functions you mention do have a language argument. For Wikifunctions, the {{Z|Z60}} can be at a higher or lower level; whether a {{Z|Z11}} is for a language or a variant is determined by the function that constructs it. Please see {{Z|Z26565}} for an example and feel free to add test cases in Chinese. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 17:54, 11 April 2026 (UTC) ::Hello @[[User:GrounderUK|GrounderUK]], thanks for the answer. I understand that whether {{Z|Z11}} is for a language or a variant depends on the function. But that is exactly what I am asking for. It is true that [[Z26570]] and [[Z26095]] takes [[Z60]] as argument, but the language-specific functions in {{Z|Z29843}} and {{Z|Z26096}} don't. ::Let me give you an example: INPUT to [[Z26570]]: <code>entity</code>: Tokyo, <code>class</code>: city, <code>location</code>: Japan, <code>language</code>: zh-cn, the config would select [[Z33030]] (created after my previous comment by elseone) as the implementation, and it would RETURN 东京是日本的一个城市。(zh-hans), which is not zh-cn as requested in the INPUT. It would also be using the term not for the variant (when it is different) because it is hardcoded to use the term in zh-hans. However, if we have the implementation like [[Z32790]] (which was created by me but a natural language argument was added by elseone) or [[Z32213]] (that works in the defining role sentence function because of the extra argument), it could cater for different variant. ::If we don't have the language argument in the language-specific function, the desire for article creation on Abstract Wikipedia would be to create a function for every variant. Is it then better to create functions for every variant? [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:18, 11 April 2026 (UTC) :::I forgot to mention that there are some hardcoding in {{Z|Z32790}} as well, but I cannot fix it because it is a connected function and I am not a functioneer. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:31, 11 April 2026 (UTC) ::::Okay, I think it’s safe to disconnect this one as the function is not yet configured for use on Abstract Wikipedia. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 19:04, 11 April 2026 (UTC) :::Ah, sorry… I misunderstood you. I agree that the called function should be able to accept the original language argument. That is simpler in theory than in practice, because the configured functions all have to have the same argument types, as I understand it. I’m not sure which the best approach is, really, but we probably want to avoid two levels of configuration. That suggests that all language-specific functions would need to accept the additional argument, which is unrewarding work for someone. @[[User:99of9|99of9]], @[[User:Jdforrester (WMF)|Jdforrester (WMF)]], @[[User:DVrandecic (WMF)|DVrandecic (WMF)]] Any thoughts? [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 18:57, 11 April 2026 (UTC) ::::I mean, we would need to modify all the functions in each language, which could take some time. But we are still in an early stage. If we don't fix it now and we want to fix it later, it would be a disaster. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 19:25, 11 April 2026 (UTC) :::::Agreed. And we probably want them converted to HTML too, with separate language spans for text in different languages. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 19:35, 11 April 2026 (UTC) ::::@[[User:GrounderUK|GrounderUK]]: This sounds like a reasonable change to make. Note that (given these Functions are primarily for use on Abstract Wikipedia), altering/replacing them to return Z89/HTML fragments is already a desired but breaking change, so making a second breaking change at the same time is probably easiest for fixing things swiftly. That said, that's of course a decision for the Abstract Wikipedia and Wikifunctions communities, not me! [[User:Jdforrester (WMF)|Jdforrester (WMF)]] ([[User talk:Jdforrester (WMF)|talk]]) 19:43, 12 April 2026 (UTC) ::::@[[User:GrounderUK|GrounderUK]]@[[User:Sun8908|Sun8908]] to make it a non-breaking change, I've created {{Z|Z34039}} which allows a composition {{Z|Z34043}}. This way you can make functions which either need the specified variant or don't! --[[User:99of9|99of9]] ([[User talk:99of9|talk]]) 05:52, 24 April 2026 (UTC) :I have now created {{Z|Z33465}}, which is an implementation of [[Z26570]]. Maybe we can migrate to use that function when more (language-specific) functions for it are ready? [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:19, 14 April 2026 (UTC) == Actual difference between {{Z|Z26039}} and {{Z|Z26095}} == What is the actual difference between these two functions? I ask, since it seems to me that the current distinction is more or less that the first one doesn't use an indefinite article in English, while the second does. Which is not a good distinction in a project that should be language neutral. This doubt emerged from my use of the first one in [[abstract:Q124441]], which @[[User:Hogü-456|Hogü-456]] made me notice that is probably wrong. My question is: why is it wrong? How could we clarify the difference? [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 19:46, 19 April 2026 (UTC) :I think the difference is if there is an indefinite article like a or an before the subject or not. In German there can be cases where a definite article is necessary before the subject. I looked at the functions and before the object both times an article is mentioned. As it depends on the language and the word what is the correct function to use I hope it will be clarified and it is an example of the necessity to have a human with understanding in a specific language check it. I hope there will be longer functions what generate more content about a specific kind of item. Then it is necessary to write one such function per language and it can be then applied to several items. It still requires checks and so maybe it is better to write down what item category needs what kind of introduction sentence function for what language. [[User:Hogü-456|Hogü-456]] ([[User talk:Hogü-456|talk]]) 20:05, 19 April 2026 (UTC) ::The point of these two functions (and of the entire Abstract Wikipedia project) is that they should be defined in a purely language-independent way, so that the translation to actual language can be done automatically. This is the reason why these functions have been renamed; I think that this attempt was not succesful, since meaning is still unclear. My proposal to clarify them would be to invoke the concept of [[w:specificity (linguistics)|specificity]]: {{Z|Z26039}} should be named "specific subject is instance of (string)", and should be used only when the QID of the subject uniquely identifies a single thing; {{Z|Z26095}} should instead be renamed in "non-specific subject is kind of (Monolingual text)", and should be used when the QID refers to a multitude of real life items, and we are specifying the class that all these item belong to. This clarification would not still be enough, since it doesn't explain how mass nouns are handled (is water a unique thing? Does {{Q|Q7802}} refer to a single piece of bread or to the entirety of bread, like water?). This problem is very tricky, since mass noun are language-specific and blurry the line between these two functions. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 20:58, 19 April 2026 (UTC) :Simply put, one corresponds to P31 and the other to P279. Paris is an {{Q|P31}} a {{Q|Q1549591}} :whereas a {{Q|Q1549591}} is a {{Q|P279}} (alias “kind of”) {{Q|Q515}}. Whether the Wikidata knowledge representation will be sufficient to resolve into fluent natural language representations in all languages is, of course, a crucial question. Where it is not, the Abstract Wikipedia knowledge representation will need to supplement the Wikidata content with additional details about the relation between the participants or the participants themselves, and these details should be language-neutral, to the extent that this is practicable. The item {{Q|Q124441}} has no [[:d:Q124441#P31|P31]] statements; it has only [[:d:Q124441#P279|P279]]s, including one relating it to {{Q|Q212920}}, which suggests {{Z|Z26095}} is the appropriate choice here even if the rendering in some languages is the same. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 22:52, 19 April 2026 (UTC) ::Thanks for explaining it. I think that I'll change the implementation of {{Z|Z26095}}, so that in Italian it produces more or less the same output of {{Z|Z26039}} (both with the definite article). [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 11:24, 20 April 2026 (UTC) == Equivalent of Z6830 for lexemes == Is there an equivalent of {{Z|Z6830}} that enables retrieving all lexemes pointing to a particular lexeme using a specific property? [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 21:06, 20 April 2026 (UTC) :There's {{Z|6831}} but I think that's slightly different again to what you're after. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 12:31, 21 April 2026 (UTC) ::Thanks for sharing that one, I did not know it existed. But you are right, it’s not quite what I am looking for. I want a function that would take a Wikidata property reference (like P5191, which is ‘derived from lexeme’) and a Wikidata lexeme reference, and return a list of lexemes that reference that lexeme using that property. [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 13:23, 21 April 2026 (UTC) == Storing huge datasets == It is not a necessity I suppose, but an idea came to me earlier to write a function that would give the corresponding [[en:Shavian alphabet|Shavian alphabet representation]] of an English word written with the Latin alphabet, or perhaps apply that operation to an entire sentence. However, just trying to guess as to what the IPA pronunciation of each word passed into it could be is is both not ideal (pronunciations obviously can and will vary widely between accents) and infeasible <s>(Wikidata lexemes don't really seem to account for pronunciation)</s>. It happens, though, that a comprehensive Shavian dictionary exists named the [https://readlex.pythonanywhere.com/ ''Read Lexicon''], which uses pronunciation and spelling similar to that used by the creator of the alphabet himself. This would be a good dataset to use in performing this translation in the function, but it appears that, all in all, the total size of the dictionary is [https://github.com/Shavian-info/readlex/blob/main/readlex.json ''nearly 26MB''] when formatted as JSON, which would certainly be larger when converted into a typed list. I am wondering if this will ever be feasible or admissible, or if there is really a way around this if importing such a large set of data is deemed impractical. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 22:30, 20 April 2026 (UTC) :{{re|Theki}} "Wikidata lexemes don't really seem to account for pronunciation"" is patently untrue; not only does every Bokmål lexeme form have IPA attached to it (thanks to Jon Harald Søby), but there are lots of languages--including English--that have pronunciation information, whether through IPA or otherwise, indicated on their forms. The big issue of course is that adding this data is not always possible to perform efficiently--for instance, I'd love to have Yiddish pronunciation respellings from Paul Abelson's dictionary on as many English forms as possible, but this dictionary not being previously processed makes this difficult. The data set you have brought up, if a suitable reading of [[:m:Wikilegal/Lexicographical_Data]] allows it, could be added as {{P|7243}} statements on various English forms. [[User:Mahir256|Mahir256]] ([[User talk:Mahir256|talk]]) 23:20, 20 April 2026 (UTC) ::Well, sorry... I haven't witnessed these pronunciation statements before, I wasn't aware of their existence until you pointed it out. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 15:02, 21 April 2026 (UTC) :I got 1,900,000 characters into [[Z33875]] before the UI gave up on me. I'm not sure what the limit is. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:21, 21 April 2026 (UTC) == Could not serialize input JS object: Number <small><small>[insert tested number here]</small></small> == I'm not one to throw my problems at others, but I have no idea how to fix this. Am implementing {{Z|Z24602}} in JavaScript, which requires returning a typed map. It now works for every type of value except numbers. Tried explicitly converting the numbers to float64, but either way it throws the error above. Would appreciate it if anyone could diagnose or fix the problem, as my knowledge of Wikifunctions is amateur at best. Thank you. [[User:Some helpful person|Some helpful person]] ([[User talk:Some helpful person|talk]]) 00:32, 23 April 2026 (UTC) :The quick answer is that like some list-related functions, code implementations returning typed maps are not possible unless the type of the objects in the map is specified in the function signature (e.g. if it was a map from Strings to Natural numbers only). So unfortunately, I think you've chosen a function that is not really possible at the moment. There are a few ideas of how we might address this, but for the moment, work on something else. Sorry! --[[User:99of9|99of9]] ([[User talk:99of9|talk]]) 13:21, 23 April 2026 (UTC) :Maybe explicitly using [[Z13518|natural numbers]] would work? I would try using <code>{ "Z1K1": "Z13518", "Z13518K1": "[number]" }</code> to represent numbers, perhaps, and seeing if that works. Of course, you would also probably have to adapt this for other types that cannot be serialized, and I'm not sure how easy that would be to generalize (assuming [[w:Don't repeat yourself|DRYness]] is desired). &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:39, 23 April 2026 (UTC) == Help with creating a function for Abstract Wikipedia == Hello! I was inspired by {{Z|Z26570}} to create {{Z|Z33975}}, however I'm not sure how I add specific language implementations here. Can anybody help me? [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 10:41, 23 April 2026 (UTC) : I think I figured it out, I created a new object with the language config type, added {{Z|Z14310}} to my implementation, and added a new function for English... At least I think that's how it works... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 13:16, 23 April 2026 (UTC) ::You have the right idea, as far as I know. I went ahead and connected the implementations you created as they appear to work fine for English, and added a test for {{Z|Z33975}} (which passes [[File:Twemoji 1f601.svg|24px]]). I also corrected an error you made on the config object where you appear to have accidentally connected English to {{Z|Z33975}} instead of {{Z|Z33977}}. Thank you for contributing! &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 13:45, 23 April 2026 (UTC) ::: {{re|Theki}} Thank you so much for you help! Could you please kindly also connect the implementations for {{Z|Z33986}} which I just made, which is going to be used for the Hebrew implementation of {{Z|Z33975}}. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 14:11, 23 April 2026 (UTC) ::::You seem to be returning the wrong type in both implementations. Functioneers should not connect implementations that don't work for non-functioneers. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:13, 23 April 2026 (UTC) ::::: {{re|Feeglgeef}} Oh thank you for pointing that out! I am still a bit new to this project and confused, so I need to read up some more about this. How do I return a monolingual text object? [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 14:17, 23 April 2026 (UTC) ::::::I'm trying to fix it for you, the construction of ZObjects in code implementations is a bit difficult right now. Since the State origin using entity and class function will (presumably) be composition, perhaps {{Z|33975}} can be adjusted to return a string, using {{Z|26107}} and {{Z|26107}}? [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:21, 23 April 2026 (UTC) :::::I did not notice any discrepancies from looking at the functions by themselves, and it seemed to work fine on my end. Is it bad practice for NLG functions to return the monolingual text type? I had assumed it was logical. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:24, 23 April 2026 (UTC) ::::::Both implementations are failing all three tests on my end. No consensus has been established as to whether monolingual texts or strings should be used, so it's like the [[w:War of the currents|war of the currents]] but for Wikifunctions. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:27, 23 April 2026 (UTC) :::::::Oh, you were referring to {{Z|Z33986}}. I assumed you were stating that something was wrong in the earlier English functions that I missed; I apologize for the misunderstanding. Has there been any centralized discussion on this string vs. monolingual text issue? &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:31, 23 April 2026 (UTC) ::::::::Not that I'm aware of, I've brought it up on the telegram twice before, though. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:49, 23 April 2026 (UTC) ::::::::The centralised discussion is at [[WT:Abstract Wikipedia/2025 fragment experiments#Proposed recommendation: Fragments should return Z11/monolingual strings]]. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 07:19, 24 April 2026 (UTC) ::::::: {{re|Theki|Feeglgeef}} Can only functioneers test implementations? For me I can't test it at all... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 14:32, 23 April 2026 (UTC) ::::::::AFAIK, test cases are only immediately testable during editing of a function if they are connected. This is one of my personal pain points with Wikifunctions, iterating on functions without exhaustive connected test cases makes debugging practically impossible for non-functioneers working on newly-created functions... I (or Feeglgeef) can quickly connect the tests you need for you if you want, although if they are not well-formed they may need to be disconnected again afterwards. Additionally, I could temporarily connect the implementation you are writing so that you can test it on the sidebar as you work, but I'm not sure if this is advisable. That functionality is also something that unfortunately only works when not disconnected. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:43, 23 April 2026 (UTC) :::::::::Yup, agree with you on all points, thanks. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:48, 23 April 2026 (UTC) == Please disconnect implementation == I think I've fixed my issue with {{Z|Z33986}}, but I can't edit an actively connected implementations with my rights. I must admit it is an AI-aided fix, I feel very strongly about disclosing that. Courtesy pinging [[User:Theki]] and [[User:Feeglgeef]]. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 18:51, 23 April 2026 (UTC) : Additionally, I think the JS might be working. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 18:52, 23 April 2026 (UTC) : Just to clarify, I mean disconnect the Python implementation please. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 18:53, 23 April 2026 (UTC) :{{Done}} I've disconnected the Python implementation. :I've also added a couple of tests. The rule is a bit more complicated than adding a maqaf before every character that is not a Hebrew letter. Unfortunately, I don't think I'll have time to fix the implementations any time soon. [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 19:03, 23 April 2026 (UTC) :: Thank you! :: Also, for some reason I thought you put a maqaf before all gershayim, so thanks for correcting me. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 19:09, 23 April 2026 (UTC) :::No, that's not the rule. :::The rest of this reply is an [[:wikt:info-dump|infodump]], feel free to ignore it :) :::In [https://hebrew-academy.org.il/topic/hahlatot/punctuation/ the Academy's punctuation rules], the rule for adding a maqaf is written kind of badly: שמים מקף ברצף שיש בו שני סוגי גופנים, כגון אותיות ומספרים ("maqaf is added in a sequence in which there are two types of fonts, such as letters and numerals"). These are not different types of "fonts", but different types of characters, and I should email them about it. It gives the examples <span lang="he" dir="rtl">ה־12</span> and <span lang="he" dir="rtl">ב־DNA</span>. It doesn't say anything explicitly about quotation marks, but in other places on the same page, you have stuff like <span lang="he" dir="rtl">ב"הארץ"</span>, and from that I deduce that a maqaf is not needed before double quotes if there are Hebrew letters inside the double quotes. :::That said, a few people do think that there must be a maqaf before double quotes. I have a somewhat surprising example of somebody who always does it: translators of Scientology materials into Hebrew. At least that's what they did last time I looked at them, about ten years ago. Those people are certainly prolific, and they get points from me for consistency, but this not the prevalent standard. (And if I recall correctly, they use the minus and not the proper Hebrew maqaf, and they don't get any points from me for that!) :::Also, the name of the character is just "double quotes" and not "gershayim". Gershayim are mostly for abbreviations, although most people use the same character for them. I use ״ for gershayim, as do a few other nerds, but we're the minority. [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 19:35, 23 April 2026 (UTC) :::: {{re|Amire80}} Yeah, "font" is a weird choice of wording here by the Academy...<br> I think I'll follow your guidance and not use a maqaf for quotes beginning with Hebrew letters. <br> I should also add more tests for different types of quotes, like straight (", '), curly (“, ”, ‘, ’), gershayim (״, ׳), including single quotes.<br> P.S. gotta deduct points from Scientology for being a cult but that's neither here nor there [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 20:49, 23 April 2026 (UTC) :::: {{re|Amire80}} Courtesy ping because I mistyped your username on the last message. Anyways I'm also gonna do that tomorrow because I'm tired now... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 20:50, 23 April 2026 (UTC) == Connect implementations == Hello! I'm done with the implementations of {{Z|Z33986}} both in JS and Python, and all tests pass. Pinging @[[User:Amire80|Amire80]] to check if all the tests I've added are alright. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 15:24, 24 April 2026 (UTC) :Connected. It's possible that some more changes will be needed, but it looks OK now. :Another little comment: It should be called "clitic" and not "prefix". [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 15:56, 24 April 2026 (UTC) : {{re|Amire80}} Thanks for your comment! Luckily labels are easy to edit, so I'll get to it. : Currently I'm working on Bulgarian {{z|Z34072}} and {{z|Z34084}}, along with other Bulgarian functions. After I'm finished with those I'll take your advice. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 16:01, 24 April 2026 (UTC) == Please connect my Bulgarian implementations == I recently created the following Bulgarian functions: * {{Z|Z34070}} (currently broken, I think because another function I built it upon is unimplemented) * {{Z|Z34088}} * {{Z|Z34105}} * {{Z|Z34072}} * {{Z|Z34084}} Can somebody please connect these functions, and perhaps suggest other functions I could localize? [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 19:03, 24 April 2026 (UTC) : Specifically, [[Z34070]] is based on [[Z34072]] [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 19:05, 24 April 2026 (UTC) :{{done}} for everything that passes, [[Z34070]] still does not work after purging WF's cache, though. For future reference, please request on the [[WF:Community portal|community portal]] instead of the project chat. Thank you for your work! [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 20:03, 24 April 2026 (UTC) :: {{re|Feeglgeef}} Thank you for your help! I will keep in mind to go to the [[project: community portal| community portal]] in future instead for this. :: I still don't understand why {{Z|Z34070}} fails... It's implementation is almost completely identical to [[Z30399]] from {{Z|Z30397}}, unless I messed something up... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 20:11, 24 April 2026 (UTC) :::{{done}} No, it was mostly just timing out. It is better to use selective fetches where possible. One case is failing to match the expected results, but at least it is returning something. For all I know, it might even be acceptable! [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 20:35, 24 April 2026 (UTC) :::: {{re|GrounderUK}} Thank you so much for your help! The one failed case is with a definite article, so I feel like that might be fixed in the future... <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 20:43, 24 April 2026 (UTC) == Editor experience suggestions == I'm a bit frustrated with the editing experience on Wikifunctions, and I have suggestions based on pain points I've had contributing to this project: * Adding a wizard to create functions, implementations, and tests in one flow, somewhat like Wikimedia Commons' upload wizard * A sandbox for experimenting without changing mainspace functions, and maybe letting non-functioneers connect implementations ([[Project: Sandbox]] doesn't seem to fit this) * We could have functions for creation based on the sandbox, like how Wikipedia has articles for creation and edit requests, * Maybe even another test instance of Wikifunctions, like how Wikidata has [[testwikidata:|Test Wikidata]] I really like this project and I don't mean to whine, but it certainly has a lot of pain points both for technical and non-technical people. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 20:41, 24 April 2026 (UTC) : It's also really complicated to localize functions, so maybe we should add another wizard for that, where you can choose a language, and then create the new function with the aforementioned function wizard, and it just automatically adds it to the related language configuration object of the related function. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 20:48, 24 April 2026 (UTC) :# Sounds good to me. :# A sandbox available is [[Z10119]], though an extension-provided sandbox that allows you to manipulate the types, code, and tests easily without interfering with the mainspace would be nice. :# [[WF:Suggest a function|This page]] works to some extent, though it's too messy in my opinion. :# We used to have a "beta cluster" but it [[phab:rOMWC5f625c5846b5f779473fa32c9a02d87e59215dfa|got shut down]] just over a year ago because it was broken. :[[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 21:07, 24 April 2026 (UTC) == Language parameters in language-specific functions == I think that an effort should be made to give the different natural language options corresponding to different English dialects, Chinese scripts, etc. more of a use (I added the test {{Z|Z34119}} to {{Z|Z26095}} and unsurprisingly it fails). There are two main problems with this approach that I can identify: * If you ask the majority of these functions to make a sentence in British English, much of the time it will give you an output with missing words, because it does not fallback to English labels in the case of a British English label for that item missing. The same applies for every other English dialect, British English is just an example here. * Uninformed editors will probably see the presence of a language parameter on these functions, consider it redundant, and remove it. [[Special:Diff/268074|I have made this mistake before]]. In my opinion, in a perfect world, all of these language generation functions would output monolingual text, and if the user asks for American English text, then American English text is what they'll get. If the user asks for Japanese text in hiragana specifically, then that's what they'll get in return. This is not as high-priority as just rendering text in the language plainly in the first place, but it's something that I feel is still worth devoting some effort to. Right now switching functions to use this paradigm is difficult because, on the one hand, I don't know if consensus tends towards this direction being ideal or advisable, and I don't want to make changes like this without at least notifying the wider community. In addition, all tests break once a parameter is added or removed, and the function editor does not recognize the change in number of parameters and therefore you have to remove the function call, re-add it along with all of its parameters it had previously (which is a tedious cut-and-paste job), and then it will work again. This is something that you can do in five seconds by just adding a few lines of JSON to the test source, but this is not directly editable from the Web browser. This tedium is largely what's preventing me from doing this on a larger scale, besides asking for comments first. If anyone has any insights or comments on this, then that would be appreciated. If a reference of functions with and without the support for language variants is needed, of course [[WF:NLG]] can be perused, but I've also my own list cataloged at [[User:Theki/functions#language]]... Of course, this thread has many similarities to [[#"language" argument for certain functions|the one above]], but this concerns me going out and making this consistent across these NLG functions. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 21:09, 24 April 2026 (UTC) :I've created {{Z|Z34122}} as an extension to {{Z|Z34039}} for larger functions. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 21:34, 24 April 2026 (UTC) :Just to confirm that I, for one, support a Natural language parameter for all natural-language functions. The concern about getting them all aligned is just that we haven’t finally settled on {{Z|Z11}} being preferred to {{Z|Z89}} or some other type that conserves the text’s provenance, so we risk having to change them all again. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 10:07, 25 April 2026 (UTC) == “Key not found ()”? == What am I doing wrong in {{Z|Z34137}}? [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 00:39, 25 April 2026 (UTC) :You were passing a [[Z6091]] to {{Z|32290}}, but it takes a [[Z6001]]. Fixed. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 07:10, 26 April 2026 (UTC) ::{{done|Thank you}}! [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 14:13, 26 April 2026 (UTC) == Why is my test failing? == Hello! I recently made {{Z|Z34139}} based on [[wikt:Module:bg-translit]], and the test case {{Z|Z34141}} is failing on both implementations, despite the expected output and actual output being the same as far as I can tell. I tried looking at the Unicode codepoints of the output, but those are also identical. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 06:21, 25 April 2026 (UTC) :Yes, it’s a tricky one. I’ve added a normalize step to the result validation in {{Z|Z34141}}, which confirms it is a normalization issue. It looks like it is in the code but I don’t know whether simply normalizing the result is the way to go. Logically, you would normalize both the input and the result. The implementations of {{Z|Z10384}} show you how to do this. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 09:41, 25 April 2026 (UTC) == Edit request == Hello! I have an edit request for {{Z|Z23752}} and {{Z|Z23414}}. Please replace all the "an/a" logic with <code>Z21739(Argument reference)</code>, both for readability and for more accuracy ("a university is an institution") <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 09:50, 25 April 2026 (UTC) :{{D}} [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 12:24, 25 April 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #245 is out: The Foundation's search for the perfect language == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-04-25|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we present an academic paper about Abstract Wikipedia, we discuss our latest Type created, and we take a look at the newest created functions. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 09:54, 25 April 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30325620 --> :@[[User:Sannita (WMF)|Sannita (WMF)]], @[[User:DVrandecic (WMF)|DVrandecic (WMF)]], technical meta-question: the newsletter quotes the article: ::the only way to contest its algorithm is to click 👍 or 👎 (Crawford and Gillespie 2016) :This quotation sounds sensible, but the article's [https://link.springer.com/article/10.1007/s00146-026-02899-w web version], and the PDF that is downloadable from the same page doesn't actually show the emojis. It rather shows text that looks lacking: ::the only way to contest its algorithm is to click or (Crawford and Gillespie [https://link.springer.com/article/10.1007/s00146-026-02899-w#ref-CR14 2016]) :Where did you get the emojis? Is it your (probably correct) guess or is there a version somewhere that actually shows the emojis? [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 15:16, 25 April 2026 (UTC) ::Scratch that. I've found a version with correct emojis: https://wikihistories.github.io/wikilambda-the-ultimate/ [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 15:37, 25 April 2026 (UTC) == Requested deletion of test == Please delete {{Z|Z34143}}. this was never valid Bulgarian, I messed up. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:19, 25 April 2026 (UTC) :[[WF:RFD]] please. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 16:40, 25 April 2026 (UTC) == Request for comment (global AI policy) == <bdi lang="en" dir="ltr" class="mw-content-ltr"> A [[:m:Requests for comment/Artificial intelligence policy|request for comment]] is currently being held to decide on a global AI policy. {{int:Feedback-thanks-title}} [[User:MediaWiki message delivery|MediaWiki message delivery]] ([[User talk:MediaWiki message delivery|talk]]) 00:57, 26 April 2026 (UTC) </bdi> <!-- Message sent by User:Codename Noreste@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Distribution_list/Global_message_delivery&oldid=30424282 --> == Is it OK to connect the implementation? == Hello! I recently applied for functioneer on [[WF:RFG]], and I was wondering whether I could connect the implementation for {{Z|Z34165}} despite its dependency {{Z|Z34149}} being currently unimplemented. That is <em>if</em> I get accepted. I am planning on implementing it based on [[wikt:module:bg-nominal]], but am still having trouble figuring it out for now. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 09:04, 26 April 2026 (UTC) == Past tense function == Is there a function like {{Z|Z26039}}, but for the past tense (e.g. "Leo Tolstoy <em>was</em> a writer.")? If not, I will create it myself, I just want to make sure there's not a duplicate. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:10, 26 April 2026 (UTC) : {{Done}} with {{Z|Z34224}}, but I have a few kinks to work out with it. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:35, 26 April 2026 (UTC) :: I need to create some other similar functions for the past tense, I have some ideas: ::* {{Z|Z26095}} ::* {{Z|Z32643}} ::* {{Z|Z28016}} ::* {{Z|Z26570}} ::* {{Z|Z33975}} ::* {{Z|Z27243}} ::* <ins>{{Z|Z26627}}</ins> ::* <ins>{{Z|Z27627}}</ins> ::* <ins>{{Z|Z27173}}</ins> ::* <ins>{{Z|Z29591}}</ins> :: :: Are there any I have missed? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:57, 26 April 2026 (UTC) :I think that here we are starting to walk on dangerous waters: what does past mean? Is it a recent o a far past? Does it have ripercussions on the present or not? Is it just a thing that happened once, many times or for a continuative period of time? :Consider that various languages distinguish between many different types of past. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 12:38, 26 April 2026 (UTC) :: {{re|Dv103}} That is a fair point... :: How do we go about solving this problem though? I don't think having every sentence on Abstract Wikipedia be "X is a Y" is a very good idea. :: Maybe we have different functions for all these variations of past you mentioned that just map into "X was a Y." in English? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 13:31, 26 April 2026 (UTC) :::To properly solve this problem, we should use a more complete abstract content representation model, like for example the proposal of [[Wikifunctions:Type proposals/Semantic unit|Semantic units]] (look at [[Wikifunctions:Type proposals/Semantic unit/Douglas Adams|the example]] to see how times could be handled). For now, since we're still stuck with single fragment generation functions (that I hope will be slowly replaced with the complete represenation model, when available), we could just restrict your function to a very specific meaning, like "subject was an instance of, for most of its existence" (which means for example that it could be used to say "Douglas Adams was a writer", but not "Abraham Lincoln was a president", since he only was a president for 4 years). Probably my definition is still too vague, and this is why we need to go beyond these fragment generating functions. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 19:47, 26 April 2026 (UTC) ::Nitpick... I don't like that it outputs a string instead of monolingual text. With {{Z|Z26039}} it's used so much that I think it's unfixable in that case beyond deprecating it if people care that much, but {{Z|Z34224}} doesn't even have any connected implementations yet. Consider it, maybe? ::Nitpick 2... {{Z|Z34227}} is missing a language parameter. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 16:08, 26 April 2026 (UTC) ::: I will consider that! ::: I just did that because that's what {{Z|Z26039}} does, so I assumed I should follow suit with it. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 16:48, 26 April 2026 (UTC) == Legacy functions == If and when more robust methods of abstractly representing and generating linguistic content come around, and more efficient ways of creating abstract content are devised and implemented, I suspect that our current methods will require some form of deprecation. This is a significant source of concern for me in relation to WF and AW, questioning how prone our current methods of doing things are and eventually will be prone to obsolescence, and how it will be worked around when it comes. We have over 1 250 articles on AW presently, and these are rather all over the place. I suspect the maintenance burden from keeping these articles up to code will eventually, err, creep up on us, I suppose, and some kind of major refactoring will be necessary. We are definitely in a period of experimentation and whatnot right now but eventually, like with enwiki, some sort of structure and rigor will form and I suspect it will start to become rather boring for me... I, for one, very much enjoy experimenting with new and better ways to do things here. I don't personally mind changing things to use a new and better paradigm if need be, that sort of thing highly excites me, but of course there will be things that are left behind, and I suspect maybe bots will be employed to deal with this? A lot of Wikipedia sister sites seem to do that, e.g. going and fixing up use of deprecated templates. Considering the nature of Wikifunctions and Abstract Wikipedia I suspect certain maintenance tasks will be made simpler or even trivial by the typical uniformity of our implementations. I guess I am just concerned if Wikifunctions or Abstract Wikipedia will ever accrue its own kind of "technical debt" with how we are plowing through things presently, and if there is a plan for how we will eventually seek to mitigate that. Maybe too early to ask this question, but I am a notoriously anxious person, so I thought it wouldn't hurt to raise the question regardless... &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 21:30, 26 April 2026 (UTC) :I very much agree, thank you for expressing my position so well. {{ping|Immanuelle}} has been using an AI-generated tool (well, they haven't edited in a week, perhaps it's a break or perhaps they don't wish to contribute to the project any more) to create a bunch of articles en masse, which I have warned them multiple times is a bad idea (on top of evolving functions, all of the articles are one-sentence-per-paragraph, [[abstract:Q12184|like so]]). That's why I've been avoiding creating articles recently, I'd say I have a good fourth (no data to support, rough guess) of the comments on the wiki, yet less than a percentage of the article count (only three, including the [[abstract:Q319|first article]], though, so perhaps I'm the next [[w:Special:Permalink/908493298|office.bomis.com]]). [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 19:41, 27 April 2026 (UTC) :: I feel that the overwhelming presence of these low-quality articles (which I admit I myself am [[abstract:Q1710970|guilty]]/[[abstract:Q7601858|of]]/[[abstract:Q39338|creating]], usually as testbeds) may incur a large maintenance burden. I do expect them to be easy to detect, however, as searching for the presence of "deprecated" NLG functions is trivial, and it is possible that replacing them with their future ''even abstracter&trade;'' counterparts could be done automatically since they all have the same signatures and can be expected to create the same form of sentence. If it needs to be done manually for a while or for certain delinquent instances, my hope is that it will be fun, at least for a while. :: I just hope that these hypothetical future waves of "this new and versatile way of abstractly representing linguistic content" obsoleting previous methods and requiring refactoring across all articles is only a one-time thing. We should strive to be as robust and flexible as possible from the outset as each brand new paradigm of abstraction is also a brand new maintenance burden for updating old articles. At the end of the day, at least ''some'' of these articles will still render to many different languages even if their methods of creating those sentences of theirs is completely outdated. Ergo, the time it takes for the switchover to be performed across our articles should not be a persistent inconvenience for users (as, of course, they will always still be able to read the content as it was before since these legacy functions aren't being deleted outright), and the increased availability that the new methods will bring about will likely act as motivation for them to join the effort in refactoring (&#x300C;You're telling me that if I rewrite this article in this cool Lisp-looking stuff then I can probably read it in [[abstract:Q9307|Galician]]?? COOL!&#x300D;). &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 20:26, 27 April 2026 (UTC) :::Totally agree. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 02:54, 28 April 2026 (UTC) :::My vague plan is to implement a default function returning an {{Z|Z89}}, for each language-neutral function. A single function would convert any of these to a {{Z|Z11}}, so that a composition of the two can be implemented as the current default until such time as the language-neutral function is ready to return a [[Z89]]. We can already convert a [[Z11]] to a [[Z89]] so, although there is more to be done in this space, existing language-specific functions could be adapted to return a [[Z89]] quite mechanistically. :::Although we certainly could deliver parallel Z89 functions for each existing Z11 function, I don’t think we should assume that particular outcome. Provided the Z89 captures a lang attribute from the Z11’s language tag, the two representations should be largely interchangeable, although I am expecting a Z89 to carry additional attributes at the span level that would be lost on conversion to a Z11 (along with any higher-level tags and attributes). :::When I say there is “more to be done in this space”, I am referring to a new type that would allow HTML fragments to be represented as tractable Wikifunctions objects, but this is currently drafted only in my head! [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 11:21, 29 April 2026 (UTC) == Filtering types of objects == Hello! I have tried to comb through my own edit history several times, but it's really hard to search for specifics because there's no differentiation between different types of objects (functions, implementations, tests, etc.) in the logs as far as I can tell. Am I missing anything? I want it to work sort of like how filtering by namespace works. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 16:48, 27 April 2026 (UTC) :There is differentiation, it's just rather hard to look through. Since all ZObjects are just JSON data at their core, you can search for instances of <code>{ "Z1K1": "Z[type]"</code>. I haven't tried this so I'm not sure how well it would work and I know MediaWiki search syntax treats quotation marks as a special character, but I have seen Wikifunctions pages link to searches using this before. There is also [[Special:ListObjectsByType]] but it is sitewide rather than specific to your edit history in particular. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 18:59, 27 April 2026 (UTC) ::''[It doesn’t help directly here, but please see [[WF:Find]] for more details of how this works.]'' [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 10:24, 29 April 2026 (UTC) :See the feature requests [[phab:T399244]]/[[phab:T373735]]. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 06:06, 28 April 2026 (UTC) :The lack of filtering edits by namespace is exactly the problem that I was trying to solve with the [[User:Amire80/wikifunctionsanalytics]] tool. :I even kind of succeeded, but it has two major problems: :# It doesn't have any real frontend, so you have to know some SQL to use it (or ask other people who know SQL). :# It doesn't get information from the live site, but from the dump, which appears to be updated once a month. :I've made a [https://quarry.wmcloud.org/query/104794 sample query for you]. Unfortunately, it won't do anything at the moment because of the second problem—your edits started in April 2026, which isn't over yet, so the dump for it hasn't been processed. But I hope that early in May you'll be able to use the same query and see something useful. :(I plan to add support for recent edits, but I haven't done it yet. Now that I more or less figured out how to process Wikifunctions edits, I'm focused on trying to understand Abstract Wikipedia edits. Processing up-to-date edits from both sites will possibly be the next thing I work on, but if you know some Python and want to try doing it yourself, don't wait for me—[https://gitlab.wikimedia.org/toolforge-repos/wikifunctions-analytics Patches welcome].) [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 18:51, 28 April 2026 (UTC) ::@[[User:QuickQuokka|QuickQuokka]], I've just updated the data until the end of April. Now the query to which I linked above gives some results. You can also try running other queries if you know SQL. (Or try asking for other queries if you don't.) [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 03:26, 3 May 2026 (UTC) == [[Z34213]] == I'm not quite sure why this implementation is failing. Could someone take a look? [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 02:24, 28 April 2026 (UTC) :I've [https://phabricator.wikimedia.org/T419933#11863997 notified] the team that this is still occurring, the issue was marked as resolved. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 02:52, 28 April 2026 (UTC) :Some useful tips: :* create more testcases: sometimes it is a random error, so try to see how consistent it is between testcases :* your implementation is very inefficient, since it fetches items and lexemes a lot of times. Ideally, each item and each lexeme should be only fetched once in all the execution tree. :[[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 06:06, 28 April 2026 (UTC) ::Caching (''should?'') means that the lexeme and item data are cached, so the call doesn't actually execute multiple times. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 17:51, 28 April 2026 (UTC) :::Are lexemes and items actually cached within the same function execution? Even if they are only partially fetched and/or fetched in bulk? [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 17:54, 28 April 2026 (UTC) ::::I don't have any evidence to prove that it works but that's definitely A. what's supposed to happen and B. the ideal behavior. This happens because the Z680X functions can be cached just like any other. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 18:02, 28 April 2026 (UTC) ::::It is unclear. In general, I believe identical branches are resolved only once in orchestration, but there is also independent caching of Wikidata fetches. ::::According to @[[User:DMartin (WMF)|DMartin (WMF)]] ([https://t.me/Wikifunctions/30374 on Telegram]): ::::<blockquote>Well, no. We have caching of Wikidata entities that have been retrieved, but not of the results of nested function calls. There is a proposal for doing this in the context of the V2 composition language, when it's a bit more mature, and it's regarded as a relatively high priority.</blockquote> ::::It’s hard to tell whether fetches in nested calls are, in fact, cached and available for other nested calls in the same call, since it is not generally the actual fetch that consumes the most resources. Rather (I believe), it is construction and transmission of the result object, which is currently repeated afresh in each nested call (unless it is in an identical branch). ::::I hope that’s clear, and I apologise in advance if it happens to be inaccurate! [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 10:16, 29 April 2026 (UTC) :::::Oh, I should clarify.  There is a lot of caching going on, in several different places.  Lexemes and items ''are'' cached by the orchestrator within the same function execution, even if they are only partially fetched and/or fetched in bulk.  When I said that we don't have caching of the results of nested function calls, I meant that's not happening in general, for all nested function calls in compositions.  But fetching of Wikidata entities gets special treatment, so yes, fetched content from Wikidata is cached, regardless if it was fetched by a top-level call or a nested call. :::::It is also true that the construction of a ZObject from the fetched JSON might happen more than once within the same function execution, depending on how a composition has been structured. However, the construction of the ZObject is actually very fast, compared to the elapsed time of getting the JSON from Wikidata. [[User:DMartin (WMF)|DMartin (WMF)]] ([[User talk:DMartin (WMF)|talk]]) 18:04, 1 May 2026 (UTC) == Question about cardinal numbers == I was about to edit {{Z|Z16435}} to add my function {{Z|Z34308}}, but I noticed that none of the other functions have a gender parameter. Should I create a new wrapper function "Bulgarian cardinal, neuter", or should I just remove the gender parameter and always return neuter? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:39, 28 April 2026 (UTC) :The “cardinal” functions should return the words used for “counting” numbers in the abstract. :We should consider converting them to return a {{Z|Z11}} rather than a {{Z|Z6}}. It may even be appropriate to return a {{Z|Z12}} to cater for language variants. Either way, I think that would be the approach to adopt for inflected forms, unless reference to specific lexeme-forms is required. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 12:52, 28 April 2026 (UTC) ::This. If a native of your language were to count up, which form would they be most likely to use? [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 13:29, 28 April 2026 (UTC) ::: {{re|GrounderUK|Feeglgeef}} Thanks for both your input! ::: I relabeled the aforementioned function to {{Z|Z34308}}, and created a new wrapper function {{Z|Z34457}}. ::: Should I specify that my old function is a monolingual text in parentheses? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 16:26, 28 April 2026 (UTC) ::::You don't have to, unless you think that is something that would require distinction when viewing the function in a list of search results &c. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 16:36, 28 April 2026 (UTC) == Optional/nullable function parameters == Hello! Recently, I was informed that Wikifunctions has no optional/nullable function parameters as of now. Are there any future plans to support this, and/or workarounds? Maybe create a union type system like "{{Z|6}} or {{Z|23}}". <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 17:53, 28 April 2026 (UTC) :What I do for this is use an "is empty" function corresponding to the type of the parameter in an If statement. If it isn't empty, the function works as intended. Otherwise, it does something else. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 17:58, 28 April 2026 (UTC) :Unions are not a thing (yet) on Wikifunctions, but you can always define an argument of type {{Z|Z1}}, which means that all types are allowed (I already did this for {{Z|Z26737}}; note that it is still a ugly workaround, don't use it for high level functions). Also, note that usually on Wikifunctions we use {{Z|Z24}} as the null value. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 18:00, 28 April 2026 (UTC) :: {{re|JJPMaster|Dv103}} Thanks for your help! :: @[[User:Dv103|Dv103]] told me a function call with a missing parameter is treated as an invalid function call, so how does the "is empty" function work with that? :: Also, setting the type to {{Z|1}} seems naive, like setting the type as <code>any</code> in TypeScript... :: Related question: Are there plans to add default values to parameters (outside of "if empty")? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 18:19, 28 April 2026 (UTC) :::Setting the type to {{Z|Z1}} is actually naive, and that's why I advised you to only use it for low-level functions. Currently there is nothing better. Sometimes, type correctness is not actually checked, so it might seem that nullable types are possible. But it is still an hack, and it could broke anytime since it is not intended behavior. :::I don't think that there are current plans to add default values (but correct me if I'm wrong). The closest thing that comes to my mind is that, if you incorporate Wikifunctions into Wikitext, you can leave empty some fields (only of some specific types) and Parsoid will replace them to their default value. This is done only depending on the type, and not on the functions. For example, {{Z|Z6091}} and {{Z|Z6001}} are assigned the QID associated to the page, and {{Z|Z20420}} is assigned the current date. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 18:56, 28 April 2026 (UTC) :::@[[User:QuickQuokka|QuickQuokka]]: At the very least, [[Z10008]] accepts a null input. Maybe that feature is unique to the String type—I am not sure. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 19:10, 28 April 2026 (UTC) ::::I think it's just not checked, but it shouldn't be intended. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 19:20, 28 April 2026 (UTC) ::::Strings and typed lists can be “empty” in the sense that their length can be zero. Typed pairs may also be “empty” in a degenerate sense, but such an object will not be returned from a code implementation. A typed map with no entries will also fail to be returned from code, although it is fine in compositions. ::::For a genuinely optional parameter, I prefer a properly typed list, which at least encourages an argument of the correct type. {{Z|Z813}} is also typically faster than {{Z|Z10008}}. Quite a good example of this approach is {{Z|Z23723}}, where it helps to resolve the type union (using [[Z1]]) for both Z6003K1 and Z6003K3. Of course, there’s nothing to prevent more than one element in the list, but additional elements are easily ignored. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 22:55, 28 April 2026 (UTC) :Pinging {{ping|Jdforrester (WMF)|prefix=|p=}}, I believe there are no current plans. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 19:02, 28 April 2026 (UTC) ::@[[User:QuickQuokka|QuickQuokka]]: I'm afraid there are no current plans to build out optional params, indeed; we would be happy to review this if a compelling case was made, but it'd be a lot of work to re-build the [[Wikifunctions:Function model|function model]] with that support and ensure we don't break (too many) things. [[User:Jdforrester (WMF)|Jdforrester (WMF)]] ([[User talk:Jdforrester (WMF)|talk]]) 19:11, 28 April 2026 (UTC) == Z6830 for Chinese == I was trying to use {{Z|Z6830}} for implementation in the Chinese-language. And turns out most of the Lexeme on Wikidata is using [[d:Q727694]] as the language instead of [[d:Q7850]]. This makes it impossible to use the mentioned function above, since Standard Chinese is not available (or did I miss something?). Is there a way to fetch lexemes with language=[[d:Q727694]] from item? [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:20, 30 April 2026 (UTC) :@[[User:Sun8908|Sun8908]] There is [[Z1006]] for Chinese and it has the language code zh. There is an overview of languages in [[Module:Wikifunctions label]] so you can search there for chinese versions and choose the one you need. [[User:Hogü-456|Hogü-456]] ([[User talk:Hogü-456|talk]]) 20:53, 5 May 2026 (UTC) ::I know that. The problem is when using the function [[Z6830]], it cannot retrieve lexeme with language [[d:Q727694]] (but it is the "Chinese language" with the most current Wikidata lexemes, see [https://ordia.toolforge.org/language/ ordia]). I think it should be a Wikidata problem, I might fix it (possibly by creating the same lexemes with language code zh) on Wikidata. Thanks anyway. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 05:39, 6 May 2026 (UTC) :Could you provide an example of a Chinese lexeme that has a linked Wikidata item, or a Z6830 function call that fails to find such a lexeme where one exists? [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 07:55, 6 May 2026 (UTC) ::Here: [[d:Lexeme:L846083]]. I think that's a primary reason of me trying to look into this problem, as the label in zh for [[d:Q6256]] (country) is not a single phrase (see its talk page on WD for more information). This makes some Abstract Wikipedia articles very weird in Chinese when {{Z|Z26570}} is used, so lexeme could potentially fix that. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 10:33, 6 May 2026 (UTC) :::Thank you. It looks as though {{Z|Z6830}} [https://www.wikifunctions.org/view/en/Z6830?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z6830%22%2C%22Z6830K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q6256%22%7D%2C%22Z6830K2%22%3A%7B%22Z1K1%22%3A%22Z6092%22%2C%22Z6092K1%22%3A%22P5137%22%7D%2C%22Z6830K3%22%3A%7B%22Z1K1%22%3A%22Z60%22%2C%22Z60K1%22%3A%22cmn%22%2C%22Z60K2%22%3A%5B%22Z6%22%5D%7D%7D returns that lexeme for language tag "cmn"]. Perhaps that tag should be added into the helpers for {{Z|Z24144}}? If it is widely used for lexemes, perhaps it should have its own {{Z|Z60}}? In any event, improvements might be considered under [[:phab:T390563]] (or otherwise), including amending [[Z6830]] to also consider "cmn" (and "zho", "chi"…?) when requests are made for "zh-hans" or "zho-hant" (or others?) @[[User:Winston Sung|Winston Sung]] @[[User:DMartin (WMF)|DMartin (WMF)]] [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 17:22, 6 May 2026 (UTC) ::::If you go to [[d:Special:NewLexeme]] and put in [[d:Q727694]] as the language, it is going to tell you it has an unrecognized language code. So I believe "cmn" should not be a {{Z|Z60}} by default? I also started [[d:Wikidata:Project_chat#Lexemes_with_language_Standard_Chinese_(Q727694)|a discussion on WD]] regarding this. I guess we can still use it as a fallback language though if possible. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 03:43, 7 May 2026 (UTC) ::::We don't have a separated <code>cmn</code> BCP 47 language subtag in MediaWiki and Wikidata at the moment. <code>zho</code> and <code>chi</code> are ISO 639 language codes but not BCP 47 language subtags. ::::For Modern Standard Mandarin, please use <code>zh-*</code> language tags for now. -- [[User:Winston Sung|Winston Sung]] ([[User talk:Winston Sung|talk]]) 15:26, 8 May 2026 (UTC) == Key not found error == Is there a reason why I am getting key not found error for this [[Z34677|function]] {{Z|Z34677}}? All the underlying functions run and all the test cases work. The debug information does not give more details. Any pointers? Thanks in advance [[User:Jsamwrites|John Samuel]] 19:24, 1 May 2026 (UTC) :It was passing the [[Z6091]] to {{Z|34641}} when that takes a [[Z6001]]. I've fixed that, but there's some other problem with the logic, so I've left it disconnected. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 19:42, 1 May 2026 (UTC) ::@[[User:YoshiRulz|YoshiRulz]] Thanks a lot. [[User:Jsamwrites|John Samuel]] 20:21, 1 May 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #246 is out: Request for input: what should we count for Abstract Wikipedia == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-05-02|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we ask you what would be the relevant metrics for Abstract Wikipedia, we discuss our latest news on Composition Language v2, and we take a look at the latest software developments. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 12:21, 2 May 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30325620 --> == Any formal process for deletion of pages == Does a formal process exist for the deletion of functions, implementations, and tests that includes a notification system for creators, analogous to Wikidata’s process, explaining the rationale behind the deletion (or proposal for deletion)? [[User:Jsamwrites|John Samuel]] 12:36, 3 May 2026 (UTC) :Does [[Wikifunctions:Requests for deletions]] work? [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 13:00, 3 May 2026 (UTC) :Please see the discussion at [[Wikifunctions talk:Requests for deletions#Should we expect Objects' creators to get pinged on deletion proposals?]]. :As I see it, it is the proposer’s responsibility to consult appropriately before making a request and we expect our administrators to act only when satisfied that appropriate consultation has occurred. In many cases, no consultation is required. Administrators may delete their own contributions without making a request, but this is not a practice I would encourage. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 13:51, 3 May 2026 (UTC) == Implementation of rational number in JS doesn't match in Z19677 (Rational number) and Z28579 (RGBA colour) == In {{Z|19677}} it's <syntaxhighlight lang=js> { "K1": sign * numerator, "K2": denominator } </syntaxhighlight> but in {{Z|28579}} it's <syntaxhighlight lang=js> [ sign * numerator, denominator ] </syntaxhighlight> '''<span style="font-family:Iosevka,monospace">[[User:沈澄心|<span style="color:#9f3526">dring</span>]][[User talk:沈澄心|<span style="color:#534fa3">sim</span>]]</span>''' 05:15, 4 May 2026 (UTC) :I'm guessing this is why [[Z34743]] fails all the tests. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 01:00, 18 May 2026 (UTC) == Nested functions in compositions == I wish it will be easier to a add another function about a specific existing function in a function implementation based on a composition. When I write long functions in spreadsheets I usually stat with a small part and then I try to go further and after important steps I test if the output is as expected. I created [[Z34826]] to get the German gender specific occupation lexeme for a specific person based on their gender. I wanted to add a function around the existing one and it was not successful. It is not very easy to implement as it requires the possibily to move a part to another section but I think it can be helpful if it will be implemented. So far I spend more time as expected on the function. Describing it with words what the function needs to do is much easier than implementing it here in Wikifunctions. So I think there needs to be improvement to make Wikifunctions more accessible. [[User:Hogü-456|Hogü-456]] ([[User talk:Hogü-456|talk]]) 21:10, 5 May 2026 (UTC) :Have you tried to use the copy-paste functionality? It is very useful to move parts of composition arounn. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 07:12, 6 May 2026 (UTC) :I've also found the composition editor to be wholly unsuitable for any expressions more than a few levels deep. (Even with the <code>localStorage</code> clipboard, because of its overzealous type checks.) Compositions naturally grow out from the "leaves", the immediate operations on the inputs, while the interface really wants you to build from the "root". I mostly use the [https://yoshirulz.gitlab.io/WikiLambdaBlockly drag-and-drop block editor] which I made to smooth over some of the site's problems, so if you want to try that out and give me some feedback I'd appreciate it. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 14:36, 6 May 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #247 is out: References from Wikidata now available == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-05-08|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we announce that is now possible to pass references in Wikidata statements, we introduce the [https://abstract-data.toolforge.org/ Abstract Data dashboard], we report you on the presentation about Abstract Wikipedia at WikiCon Australia, and we take a look at the latest software developments. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Also, we remind you that if you have questions or ideas to discuss, the next '''Volunteers' Corner''' will be held on '''[https://zonestamp.toolforge.org/1778520600 May 11, at 17:30 UTC]''' ([https://meet.google.com/xuy-njxh-rkw link to the meeting]). Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 11:16, 8 May 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30325620 --> == RGBA colour, spelling... == Something that has always irked me a little bit is the spelling of [[Z28579|RGBA colour (Z28579)]]. I guess this is not unsurprising for me considering my use of US English but I think there is more to it than preference and I want to try to argue for it being changed to use American spelling. I know that this probably has a snowball's chance in hell of actually garnering any support, so I won't really be miffed if the spelling remains as it is, but I thought it wouldn't hurt to raise this regardless. The main issue I have with it is the spelling of the original proposal. When infernostars raised the [[Wikifunctions:Type proposals/RGBA color|type proposal]], the spelling was 「RGBA color」. Of the comments that mentioned the word 「colo[u]r」, two used British spelling while six used the American spelling as used in the proposal. The only thing that really pointed to the use of ''colour'' was the fact that the catalog page on color functions used that spelling already. For all intents and purposes, the spelling of the original proposal should have been maintained, but it was not; [[User:DVrandecic (WMF)|DVrandecic]], the eventual creator of the type, used a different spelling. It should be noted that there was really no reason for this to occur and while it is an undoubtedly minor issue I still believe it should be rolled back and the type should use the spelling of the original proposal and majority of editor comments. In [[abstract:Q936|OpenStreetMap]], there have been keyvalue proposals that have had the finalized spelling that gets put to use be in British English despite the original proposal being in American English; this has usually occurred with proposals relating to 「X center/centre」 tags. This makes sense on the surface, because OpenStreetMap is maintained by a UK organization, and still has close ties to Europe. The Wikimedia Foundation, however, is an ''American'' company. This is often brought up as a fallible argument when debating article spelling on the English Wikipedia, and I don't bring it up to support that 「RGBA color」 should be used for that exact reason, but rather to state that OpenStreetMap's general policy on tag names need not apply here. It appears to me that, at least initially, the majority of 「core contributors」 to Wikifunctions used British English; I can name YoshiRulz, 99of9, GrounderUK, and VIGNERON.<ref group="color">I'm avoiding linking to these folks because I don't think pinging them about this discussion is all too necessary unless they themselves want to be involved; I don't want to clutter their inboxes just to briefly mention them. I pinged Denny because, well, I'm asking him a question directly, but everyone else I would prefer to join this discussion by their own accord... not that I wish for this decision to be confused as me going 「these people use British English so they will probably oppose my idea, I won't invite them to the discussion because of that」...no, I promise you that is not the reason.</ref> I see (or saw) these people ''everywhere'', so it makes sense that British English has prevailed in some sorts on this website, but I don't think that indicates that it should be the ''preferred'' spelling across the website, at least not to the point where a proposal should have its name changed to match such a "consensus".<ref group="color">It could be argued that the front-and-center ''Function catalogue'' using 「catalogue」 is actually indicative of such a "consensus", but ''catalogue'' is in a similar position to the word ''grey'' where I live (that is, the US) in that it is used just as often as its American counterpart. Also, consider Wiktionary's ''Beer parlour'' project chat.</ref> The unnecessary modification of the original spelling is my main argument for changing it back... but of course, I must obligatorily state that on English Wikipedia, it is [[w:Color|Color]] and [[w:RGBA color model|RGBA color model]]; on Wikidata, it is [[d:Q1075|color]] and [[d:Q2325624|RGBA color space]]; in CSS (which typically uses hexadecimal triplets to specify RGBA values), the properties are <code>color</code>, <code>background-color</code>, etc.; bit of a weak jab, but on Schema.org it is [https://schema.org/color color], [https://schema.org/colorSwatch colorSwatch]; et cetera. {{Z|Z28580}} uses ''color'', so does {{Z|Z28591}} and its Python counterpart. Mr. Vrandečić, I have to ask, I'm rather confused... you created the color type using British English spelling, but you were also responsible for the creation of the equality function which uses the American English spelling. You also seem to be writing in American English for the status updates, judging by your use of -''ize'' over -''ise'' endings and use of ''program'' over ''programme'' in [[Wikifunctions:Status updates/2026-04-16]]. Is there something I'm missing or have you switched your preferred variant somewhere along the way? Anyways, do consider this if you wish... again, I don't suppose this will garner much support, it is the ''non-issuest'' of ''non-issues'', but it has irked me to the point where I want to ask about it to get some answers, if nothing else. I am not arguing for every other color function to have its name changed, just the type itself. <references group="color"></references> &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:04, 8 May 2026 (UTC) :This is a multilingual project; the <code>en</code> label is <code>RGBA colour</code> and the <code>en-us</code> label is <code>RGBA color</code>. Though I'm not able to switch to <code>en-us</code> via the language picker so that would need to be fixed.<!-- --><br>edit after reading your whole comment: The same is true of {{Q|1075}}, there are labels specified for multiple English variants. (In {{Q|2325624}} it's only an alias.) I agree that other websites' choices aren't binding on us, but from that, I conclude that the more widespread British/Commonwealth spellings should be used for the generic <code>en</code>. As for myself, I'm Aussie and I will continue to use the BrE spellings ([[w:en:Oxford_spelling#Language_tag_comparison|+ "routing"]], TIL) if only by muscle memory.<!-- --><br>[[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 17:42, 8 May 2026 (UTC) :: Your lattermost point would normally be fine in a perfect world. Wikipedia's <code>convert</code> function defaults to "international" English, which I don't personally take issue with because it happens that we here in America are actually outliers for saying and spelling things differently... err, or we were for a while at least, nowadays it seems like an even split (plus you have "yield" vs. "give way" which is effectively the logical opposite of US's use of "meter" over "metre"). :: However, this is not a perfect world, and I don't think <code>en</code> should correspond to any particular variant. It is too fragmented across all software at this point to impose such a requirement. The inability to switch to <code>en-us</code> on this website foregoes an easy and simple solution to this problem that makes everyone happy, because the yanks (such as myself) can't be happy because we can't see the labels in American English even if we wanted to, and the other folk can't switch either as far as I'm aware (and the en-CA and en-GB languages in the preferences page seems to be deprecated). My point being, <code>en</code> is abused to mean "en-UK" just as often as it is abused to mean <code>en-US</code>; I think a decision shouldn't be made on such an assumption of one "default". &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:48, 12 May 2026 (UTC) :Hi @[[User:Theki|rae]]! I have no opinion nor preference on this, and given my background, I am just entirely confused about my spelling preferences myself, as you can tell from my inconsistent usage. I learned British English in school and used that for maybe two decades or so, but moved to the US and lived there for more than a decade, enough to be naturalized, but now I am back in Europe and I am technically a professor at King's College London, soooo.... honestly, I do not know. I don't remember having put too much thought into it at the moment I created it. The good thing is that in Wikifunctions, just as in Wikidata, it is easy to change, without messing things up too much (unlike in Wikipedia), so my suggestion is, just make the change, see if anyone complains, and if they do, discuss it more. I don't know if there is a guideline already in Wikifunctions about the variants. I am happy either way, and honestly, I keep forgetting which variant is which most of the time. --[[User:DVrandecic (WMF)|DVrandecic (WMF)]] ([[User talk:DVrandecic (WMF)|talk]]) 18:16, 10 May 2026 (UTC) :: I can definitely understand this, although I am unfortunately rather passionate about any minutiae involving preferential minor differences in ''anything'', of which AmE vs. BrE chiefly is. So I dedicate a lot of headspace to it. More than I should. Not that I wish to imply that the comment above that I have wrote is of an irrational nature, or done out of spite or pure emotion and subjectivity; I do genuinely believe that ''RGBA color'' is beyond just a personal preference and is just logical. I may boldly go and change it, but for some reason I was expecting that changing the English label of a Type would require elevated permissions, and I also didn't want to do it only to get immediately reverted because it ''did'' strike a chord with someone, when I could instead see how apathetic, supportive, or in opposition interested people are beforehand and ''then'' act accordingly. I was not meaning to antagonize you over your spelling habits, I did actually use British English for a few years starting in 2020 before I went back to American English, so I'd be a hypocrite for me to decry you for not always sticking to some arbitrary standard of spelling words over the other. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:55, 12 May 2026 (UTC) :Although I spell it “colour”, I think it makes more sense to use “color” for the type, since that is almost always the required spelling when the string functions as a keyword. :More generally, though, Wikidata’s lexicographic data happens to favour “colour” over “color” and (quite rightly, in my view) lacks a specific representation for "en". This is unusual, in my experience, as "en" is widely misused in place of "en-US", where there are recorded spelling differences. :(I would also say it is standard British English to use “program” in a programming context and “programme” elsewhere. Use of -ize rather than -ise is a matter of personal preference or house style, but regional autocorrect encourages -ise.) [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 11:00, 12 May 2026 (UTC) :: ''Wikidata’s lexicographic data happens to favour “colour” over “color” and (quite rightly, in my view) lacks a specific representation for "en"'' :: Definitely agreeing with you on the latter being a good choice. However, I suspect the favoring of "colour" over "color" may be because, in terms of language codes, when sorted alphabetically <code>en-us</code> actually comes ''after'' <code>en-gb</code>. Although, the frontend seems to be sorting <code>en-ca</code> after <code>en-gb</code>, so I don't actually know how correct that is. :: ''I would also say it is standard British English to use “program” in a programming context and “programme” elsewhere'' :: The context of the spelling was "''No program for the NLG SIG meeting for next Tuesday has been proposed''". In that usage context, I think it makes sense to assume that ''program'' is not being used to refer to a computer program, but to a ''program of events'' or similar, something that you would spell as a ''programme'' in British English. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 15:02, 12 May 2026 (UTC) :{{s}} this. I'm obviously biased but I believe American English is preferable generally, American dominance on the internet (our Department of Defen'''s'''e invented it!) and rapidly-increasing consumption of American media by international English speakers means that more people use American English's conventions, this is clear through for example [http://trends.google.com/explore?q=color%2Ccolour&date=all&geo=Worldwide search trends] (though they aren't particularly reliable). Perhaps this is a bit of a supremacist opinion, but we should have internal consistency, and if we must choose, American English should be our first choice (then Indian and then British English) [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:10, 12 May 2026 (UTC) :: This is rather flawed reasoning, though. I think probably any given British or Indian person would not agree on using that as the reasoning for this, not that you are necessarily ''completely wrong'', but if this is not a good enough reason for English Wikipedia's (admittedly extremely flawed) ''ENGVAR'' policy then I don't think it's likely it will pass here either. :: Although of note is that [https://books.google.com/ngrams/graph?content=color%2Ccolour&year_start=1800&year_end=2022&corpus=en&smoothing=3&case_insensitive=true Google ngrams] agree with you, but "color" vs. "colour" is an eternal holy war that will not be won by demonstrating that more books use US spelling over Commonwealth spelling. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:44, 12 May 2026 (UTC) :::You're probably right that it's not very sound. I'm biased in that other varieties of English irk me, and that's probably mutual for people who are used to other varieties of English when they read what I write! [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:56, 12 May 2026 (UTC) :I've decided to boldly [[Special:Permalink/274271|make the change]]. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:02, 12 May 2026 (UTC) :: Thank you. Considering both you and GrounderUK seem to consider it an okay change, I think this will do for now. :: I should note that the matter of whether to move [[Wikifunctions:Catalogue/Colour functions]] in response to this (however this discussion will ultimately turn out) is a whole other can of worms, in my view. I can't say I have an opinion on that at the moment, but I'm putting it out there regardless. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 15:06, 12 May 2026 (UTC) :::Personally, I'm in favor of moving the page and renaming all of the items on it. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:10, 12 May 2026 (UTC) ::I don't like this (exactly because of the American hegemony you cited), but again, it shouldn't matter because the software is meant to be multilingual. Clearly there's a bug preventing you from picking an English variant/dialect as your display language. But the search bar and Function/Type autocompletion do check the English variants for matches. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 15:15, 12 May 2026 (UTC) == Proposals on the architecture of Abstract Content rendering == Starting from a discussion born on the Telegram chat, I've explained two different proposals on how the NLG on Abstract Wikipedia should be organized in the page [[abstract:User:Dv103/Abstract articles architectures]]. Please come to contribute to the discussion, or to propose alternatives. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 14:31, 11 May 2026 (UTC) :Thank you for dedicating your time to writing this, it is very informative. I will try to add input once I'm not in over my head with finals. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 16:27, 12 May 2026 (UTC) == Display function for HTML fragment == Currently, any collapsed Z89 literal appears as<blockquote>&lt;&gt; [[Z89|HTML fragment]]</blockquote>If I were to create a new Function which returned something like<blockquote>&lt;&gt; 123-byte HTML fragment <q><nowiki><td><span lang=</nowiki>&hellip;</q></blockquote>could that be connected to replace the collapsed form, or would it require changes to the Wikilambda software? [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 16:14, 11 May 2026 (UTC) :It might work, but I doubt it. Those angled brackets suggest that the collapsed form is not simply defaulting to the type’s label. Looking at [[:phab:T410509]], I’ve concluded that enhancements to the collapsed form were never considered, rather than being actively rejected. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 12:12, 12 May 2026 (UTC) ::[[:Phab:T391985]] documents the original design. Note the fifth bullet point under “Acceptance criteria”. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 12:21, 12 May 2026 (UTC) :I'm not sure the byte-size is necessary, but the outer tag (or first outer tag, though generally I'd prefer most fragments use a wrapper tag if it needs multiple like JSX does, but that's a whole different topic) would be nice. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 12:51, 12 May 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #248 is out: A higher meaning == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-05-15|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we discuss functions creating language fragments, we present our latest news in Types, and we take a look at the latest software developments. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 14:36, 15 May 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30536976 --> == [[Z34510]] == This function, which determines if a Wikidata item for a {{q|5}} has an undeprecated {{p|21}} statement of {{q|6581097}}, returns false for {{q|173399}}, a transgender man. This is because his item assigns his P21 statement to {{q|2449503}}, not {{q|6581097}}. I'm not sure how to account for this discrepancy. Should {{z|34510}}: # Include {{q|2449503}} as a value that can lead to a true result, # Not include {{q|2449503}} as a value that can lead to a true result, while another function (e.g., "Q5 is a man?") could return true for either "male" or "trans man", # Not include {{q|2449503}} as a value that can lead to a true result, while another function (e.g., "Q5 is a trans man?") could return true for "trans man", # Not exist at all? [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 16:48, 16 May 2026 (UTC) :I can't think of a single use case where you would need to determine if a person is a cisgender man and nothing else. Functions are good for generalizing across multiple possibilities when they exist, so I think it would be best if trans men were considered a part of the criteria for returning a true value. If asking for specifically {{q|6581097}}s and ''nothing'' else was desired then the function name would be a misnomer as Elliot Page is inarguably a male (at least in the view of most reasonable and intelligent people). &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 19:03, 16 May 2026 (UTC) :You made the function in the first place; what were you planning on using it for? AW? Maybe it should return a {{Z|25501}} which can then be passed on to other NLG functions. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 20:01, 16 May 2026 (UTC) == Lexeme from wikidata label, or "best" lexeme from wikidata item == I was looking into fixing [[Z28028]]. I found that I could add "requires grammatical feature: definite article" to "United Kingdom" (L8558). Now I'm stuck on how to get to that lexeme from {{Q|145}}. There's [[Z23471]], but that for very good reason gives you multiple lexemes with the same sense, and I just want the best one like how the label is always the best string. Is there a function that can do this? There's definitely the case of a Wikidata label that isn't a lexeme (most commonly multiple lexemes) but I'm only considering the case where it is one lexeme here. [[User:Aaron Liu|Aaron Liu]] ([[User talk:Aaron Liu|talk]]) 20:02, 16 May 2026 (UTC) :There is {{Z|Z27327}}, that tries to give the best lexeme through various heuristics. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 22:22, 16 May 2026 (UTC) :: Wonderful! I did stumble upon [[Z33818]] but this is perfect. [[User:Aaron Liu|Aaron Liu]] ([[User talk:Aaron Liu|talk]]) 00:25, 17 May 2026 (UTC) == [[Z29591]] isn't working for me == For instance, trying to manually put in the exact inputs for one of the test cases just returns an empty Monolingual text. See [https://www.wikifunctions.org/wiki/Z29591?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z29591%22%2C%22Z29591K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q3257809%22%7D%2C%22Z29591K2%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q21264361%22%7D%2C%22Z29591K3%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q22006653%22%7D%2C%22Z29591K4%22%3A%22Z1002%22%7D]. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 01:17, 17 May 2026 (UTC) :You used [[:d:Q22006653]] rather than [[:d:Q1075]]. It looks like the [https://www.wikifunctions.org/wiki/Special:RunFunction?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z30784%22%2C%22Z30784K1%22%3A%7B%22Z1K1%22%3A%22Z11%22%2C%22Z11K1%22%3A%22Z1002%22%2C%22Z11K2%22%3A%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z21394%22%2C%22Z21394K1%22%3A%5B%22Z6%22%2C%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z22664%22%2C%22Z22664K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q22006653%22%7D%2C%22Z22664K2%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q21264361%22%7D%2C%22Z22664K3%22%3A%22Z1002%22%7D%5D%7D%7D%7D explanatory error] is suppressed by the [https://www.wikifunctions.org/view/en/Z30009?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z30009%22%2C%22Z30009K1%22%3A%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z30784%22%2C%22Z30784K1%22%3A%7B%22Z1K1%22%3A%22Z11%22%2C%22Z11K1%22%3A%22Z1002%22%2C%22Z11K2%22%3A%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z21394%22%2C%22Z21394K1%22%3A%5B%22Z6%22%2C%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z22664%22%2C%22Z22664K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q22006653%22%7D%2C%22Z22664K2%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q21264361%22%7D%2C%22Z22664K3%22%3A%22Z1002%22%7D%5D%7D%7D%7D%2C%22Z30009K2%22%3A%22Z801%22%7D final transformation]. The returned result is not actually empty; if you expand it, you can see that it is an unresolved function call. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 09:59, 17 May 2026 (UTC) == [[Z35298]] == Does anyone know what the problem with this implementation is? [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 21:14, 18 May 2026 (UTC) :There is a bug that doesn't allow Python implementation to return nested lists. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 05:31, 19 May 2026 (UTC) ::Is there a Phabricator task for this? Searching through them is hell. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 03:22, 20 May 2026 (UTC) kpltpxt0dyx6txu2n7kj5x29s3zt5rs 276435 276398 2026-05-20T05:26:16Z Dv103 11127 /* Z35298 */ Reply 276435 wikitext text/x-wiki {{shortcut|[[WF:CHAT]]|[[WF:PC]]|[[WF:VP]]}} __NEWSECTIONLINK__ [[Category:Help]] <!-- please do not remove this line --> Welcome to the Project chat, a place to discuss any and all aspects of Wikifunctions: the project itself, policy and proposals, individual data items, technical issues, etc. Other places to find help: * [[Wikifunctions:Administrators' noticeboard]] * [[Wikifunctions:Report a technical problem]] * [[Wikifunctions:FAQ]] {{Autoarchive resolved section |age = 1 |archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) |timeout=30 }} {{Archives|{{#tag:div|<br />{{Flatlist|{{Special:PrefixIndex/WF:Project chat/Archive/|stripprefix=1|hideredirects=1}} |class=mw-collapsible-content|style=font-size:92%;}}|class="mw-collapsible mw-collapsible-toggle mw-collapsed"}} |prefix=WF:Project chat/Archive/ }} == "language" argument for certain functions == Hello. I am relatively new to Wikifunctions. Recently, I tried to create functions for Chinese translation of {{Z|Z26570}} and {{Z|Z26095}} (which became [[Z32788]] and [[Z32900]]). During the creation of these functions, I was trying to take {{Z|Z32212}} as reference. And I realized that the defining role sentence function is taking <code>language</code> as an argument (and the test case of the Chinese-language function already contains two varieties of Chinese). This makes it possible to output monolingual text in <code>zh-hant</code>, <code>zh-hans</code>, <code>zh-tw</code>, or any varieties of the language. I think for this reason, it is better to have <code>language</code> as arguments for the implementation of Z26570 and Z26095, and potentially more functions that require {{Z|Z14294}}, since it would output the varieties code instead of just saying <code>zh</code> for <code>zh-hant</code>, <code>zh-hans</code>, <code>zh-tw</code> in the output of type {{Z|Z11}}. I am not sure how the fallback mechanism works if one of the language (varieties) do not have a labels/lexemes, but to me, it is reasonable to have a <code>language</code> argument. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 09:38, 31 March 2026 (UTC) :The functions you mention do have a language argument. For Wikifunctions, the {{Z|Z60}} can be at a higher or lower level; whether a {{Z|Z11}} is for a language or a variant is determined by the function that constructs it. Please see {{Z|Z26565}} for an example and feel free to add test cases in Chinese. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 17:54, 11 April 2026 (UTC) ::Hello @[[User:GrounderUK|GrounderUK]], thanks for the answer. I understand that whether {{Z|Z11}} is for a language or a variant depends on the function. But that is exactly what I am asking for. It is true that [[Z26570]] and [[Z26095]] takes [[Z60]] as argument, but the language-specific functions in {{Z|Z29843}} and {{Z|Z26096}} don't. ::Let me give you an example: INPUT to [[Z26570]]: <code>entity</code>: Tokyo, <code>class</code>: city, <code>location</code>: Japan, <code>language</code>: zh-cn, the config would select [[Z33030]] (created after my previous comment by elseone) as the implementation, and it would RETURN 东京是日本的一个城市。(zh-hans), which is not zh-cn as requested in the INPUT. It would also be using the term not for the variant (when it is different) because it is hardcoded to use the term in zh-hans. However, if we have the implementation like [[Z32790]] (which was created by me but a natural language argument was added by elseone) or [[Z32213]] (that works in the defining role sentence function because of the extra argument), it could cater for different variant. ::If we don't have the language argument in the language-specific function, the desire for article creation on Abstract Wikipedia would be to create a function for every variant. Is it then better to create functions for every variant? [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:18, 11 April 2026 (UTC) :::I forgot to mention that there are some hardcoding in {{Z|Z32790}} as well, but I cannot fix it because it is a connected function and I am not a functioneer. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:31, 11 April 2026 (UTC) ::::Okay, I think it’s safe to disconnect this one as the function is not yet configured for use on Abstract Wikipedia. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 19:04, 11 April 2026 (UTC) :::Ah, sorry… I misunderstood you. I agree that the called function should be able to accept the original language argument. That is simpler in theory than in practice, because the configured functions all have to have the same argument types, as I understand it. I’m not sure which the best approach is, really, but we probably want to avoid two levels of configuration. That suggests that all language-specific functions would need to accept the additional argument, which is unrewarding work for someone. @[[User:99of9|99of9]], @[[User:Jdforrester (WMF)|Jdforrester (WMF)]], @[[User:DVrandecic (WMF)|DVrandecic (WMF)]] Any thoughts? [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 18:57, 11 April 2026 (UTC) ::::I mean, we would need to modify all the functions in each language, which could take some time. But we are still in an early stage. If we don't fix it now and we want to fix it later, it would be a disaster. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 19:25, 11 April 2026 (UTC) :::::Agreed. And we probably want them converted to HTML too, with separate language spans for text in different languages. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 19:35, 11 April 2026 (UTC) ::::@[[User:GrounderUK|GrounderUK]]: This sounds like a reasonable change to make. Note that (given these Functions are primarily for use on Abstract Wikipedia), altering/replacing them to return Z89/HTML fragments is already a desired but breaking change, so making a second breaking change at the same time is probably easiest for fixing things swiftly. That said, that's of course a decision for the Abstract Wikipedia and Wikifunctions communities, not me! [[User:Jdforrester (WMF)|Jdforrester (WMF)]] ([[User talk:Jdforrester (WMF)|talk]]) 19:43, 12 April 2026 (UTC) ::::@[[User:GrounderUK|GrounderUK]]@[[User:Sun8908|Sun8908]] to make it a non-breaking change, I've created {{Z|Z34039}} which allows a composition {{Z|Z34043}}. This way you can make functions which either need the specified variant or don't! --[[User:99of9|99of9]] ([[User talk:99of9|talk]]) 05:52, 24 April 2026 (UTC) :I have now created {{Z|Z33465}}, which is an implementation of [[Z26570]]. Maybe we can migrate to use that function when more (language-specific) functions for it are ready? [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:19, 14 April 2026 (UTC) == Actual difference between {{Z|Z26039}} and {{Z|Z26095}} == What is the actual difference between these two functions? I ask, since it seems to me that the current distinction is more or less that the first one doesn't use an indefinite article in English, while the second does. Which is not a good distinction in a project that should be language neutral. This doubt emerged from my use of the first one in [[abstract:Q124441]], which @[[User:Hogü-456|Hogü-456]] made me notice that is probably wrong. My question is: why is it wrong? How could we clarify the difference? [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 19:46, 19 April 2026 (UTC) :I think the difference is if there is an indefinite article like a or an before the subject or not. In German there can be cases where a definite article is necessary before the subject. I looked at the functions and before the object both times an article is mentioned. As it depends on the language and the word what is the correct function to use I hope it will be clarified and it is an example of the necessity to have a human with understanding in a specific language check it. I hope there will be longer functions what generate more content about a specific kind of item. Then it is necessary to write one such function per language and it can be then applied to several items. It still requires checks and so maybe it is better to write down what item category needs what kind of introduction sentence function for what language. [[User:Hogü-456|Hogü-456]] ([[User talk:Hogü-456|talk]]) 20:05, 19 April 2026 (UTC) ::The point of these two functions (and of the entire Abstract Wikipedia project) is that they should be defined in a purely language-independent way, so that the translation to actual language can be done automatically. This is the reason why these functions have been renamed; I think that this attempt was not succesful, since meaning is still unclear. My proposal to clarify them would be to invoke the concept of [[w:specificity (linguistics)|specificity]]: {{Z|Z26039}} should be named "specific subject is instance of (string)", and should be used only when the QID of the subject uniquely identifies a single thing; {{Z|Z26095}} should instead be renamed in "non-specific subject is kind of (Monolingual text)", and should be used when the QID refers to a multitude of real life items, and we are specifying the class that all these item belong to. This clarification would not still be enough, since it doesn't explain how mass nouns are handled (is water a unique thing? Does {{Q|Q7802}} refer to a single piece of bread or to the entirety of bread, like water?). This problem is very tricky, since mass noun are language-specific and blurry the line between these two functions. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 20:58, 19 April 2026 (UTC) :Simply put, one corresponds to P31 and the other to P279. Paris is an {{Q|P31}} a {{Q|Q1549591}} :whereas a {{Q|Q1549591}} is a {{Q|P279}} (alias “kind of”) {{Q|Q515}}. Whether the Wikidata knowledge representation will be sufficient to resolve into fluent natural language representations in all languages is, of course, a crucial question. Where it is not, the Abstract Wikipedia knowledge representation will need to supplement the Wikidata content with additional details about the relation between the participants or the participants themselves, and these details should be language-neutral, to the extent that this is practicable. The item {{Q|Q124441}} has no [[:d:Q124441#P31|P31]] statements; it has only [[:d:Q124441#P279|P279]]s, including one relating it to {{Q|Q212920}}, which suggests {{Z|Z26095}} is the appropriate choice here even if the rendering in some languages is the same. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 22:52, 19 April 2026 (UTC) ::Thanks for explaining it. I think that I'll change the implementation of {{Z|Z26095}}, so that in Italian it produces more or less the same output of {{Z|Z26039}} (both with the definite article). [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 11:24, 20 April 2026 (UTC) == Equivalent of Z6830 for lexemes == Is there an equivalent of {{Z|Z6830}} that enables retrieving all lexemes pointing to a particular lexeme using a specific property? [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 21:06, 20 April 2026 (UTC) :There's {{Z|6831}} but I think that's slightly different again to what you're after. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 12:31, 21 April 2026 (UTC) ::Thanks for sharing that one, I did not know it existed. But you are right, it’s not quite what I am looking for. I want a function that would take a Wikidata property reference (like P5191, which is ‘derived from lexeme’) and a Wikidata lexeme reference, and return a list of lexemes that reference that lexeme using that property. [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 13:23, 21 April 2026 (UTC) == Storing huge datasets == It is not a necessity I suppose, but an idea came to me earlier to write a function that would give the corresponding [[en:Shavian alphabet|Shavian alphabet representation]] of an English word written with the Latin alphabet, or perhaps apply that operation to an entire sentence. However, just trying to guess as to what the IPA pronunciation of each word passed into it could be is is both not ideal (pronunciations obviously can and will vary widely between accents) and infeasible <s>(Wikidata lexemes don't really seem to account for pronunciation)</s>. It happens, though, that a comprehensive Shavian dictionary exists named the [https://readlex.pythonanywhere.com/ ''Read Lexicon''], which uses pronunciation and spelling similar to that used by the creator of the alphabet himself. This would be a good dataset to use in performing this translation in the function, but it appears that, all in all, the total size of the dictionary is [https://github.com/Shavian-info/readlex/blob/main/readlex.json ''nearly 26MB''] when formatted as JSON, which would certainly be larger when converted into a typed list. I am wondering if this will ever be feasible or admissible, or if there is really a way around this if importing such a large set of data is deemed impractical. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 22:30, 20 April 2026 (UTC) :{{re|Theki}} "Wikidata lexemes don't really seem to account for pronunciation"" is patently untrue; not only does every Bokmål lexeme form have IPA attached to it (thanks to Jon Harald Søby), but there are lots of languages--including English--that have pronunciation information, whether through IPA or otherwise, indicated on their forms. The big issue of course is that adding this data is not always possible to perform efficiently--for instance, I'd love to have Yiddish pronunciation respellings from Paul Abelson's dictionary on as many English forms as possible, but this dictionary not being previously processed makes this difficult. The data set you have brought up, if a suitable reading of [[:m:Wikilegal/Lexicographical_Data]] allows it, could be added as {{P|7243}} statements on various English forms. [[User:Mahir256|Mahir256]] ([[User talk:Mahir256|talk]]) 23:20, 20 April 2026 (UTC) ::Well, sorry... I haven't witnessed these pronunciation statements before, I wasn't aware of their existence until you pointed it out. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 15:02, 21 April 2026 (UTC) :I got 1,900,000 characters into [[Z33875]] before the UI gave up on me. I'm not sure what the limit is. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:21, 21 April 2026 (UTC) == Could not serialize input JS object: Number <small><small>[insert tested number here]</small></small> == I'm not one to throw my problems at others, but I have no idea how to fix this. Am implementing {{Z|Z24602}} in JavaScript, which requires returning a typed map. It now works for every type of value except numbers. Tried explicitly converting the numbers to float64, but either way it throws the error above. Would appreciate it if anyone could diagnose or fix the problem, as my knowledge of Wikifunctions is amateur at best. Thank you. [[User:Some helpful person|Some helpful person]] ([[User talk:Some helpful person|talk]]) 00:32, 23 April 2026 (UTC) :The quick answer is that like some list-related functions, code implementations returning typed maps are not possible unless the type of the objects in the map is specified in the function signature (e.g. if it was a map from Strings to Natural numbers only). So unfortunately, I think you've chosen a function that is not really possible at the moment. There are a few ideas of how we might address this, but for the moment, work on something else. Sorry! --[[User:99of9|99of9]] ([[User talk:99of9|talk]]) 13:21, 23 April 2026 (UTC) :Maybe explicitly using [[Z13518|natural numbers]] would work? I would try using <code>{ "Z1K1": "Z13518", "Z13518K1": "[number]" }</code> to represent numbers, perhaps, and seeing if that works. Of course, you would also probably have to adapt this for other types that cannot be serialized, and I'm not sure how easy that would be to generalize (assuming [[w:Don't repeat yourself|DRYness]] is desired). &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:39, 23 April 2026 (UTC) == Help with creating a function for Abstract Wikipedia == Hello! I was inspired by {{Z|Z26570}} to create {{Z|Z33975}}, however I'm not sure how I add specific language implementations here. Can anybody help me? [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 10:41, 23 April 2026 (UTC) : I think I figured it out, I created a new object with the language config type, added {{Z|Z14310}} to my implementation, and added a new function for English... At least I think that's how it works... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 13:16, 23 April 2026 (UTC) ::You have the right idea, as far as I know. I went ahead and connected the implementations you created as they appear to work fine for English, and added a test for {{Z|Z33975}} (which passes [[File:Twemoji 1f601.svg|24px]]). I also corrected an error you made on the config object where you appear to have accidentally connected English to {{Z|Z33975}} instead of {{Z|Z33977}}. Thank you for contributing! &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 13:45, 23 April 2026 (UTC) ::: {{re|Theki}} Thank you so much for you help! Could you please kindly also connect the implementations for {{Z|Z33986}} which I just made, which is going to be used for the Hebrew implementation of {{Z|Z33975}}. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 14:11, 23 April 2026 (UTC) ::::You seem to be returning the wrong type in both implementations. Functioneers should not connect implementations that don't work for non-functioneers. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:13, 23 April 2026 (UTC) ::::: {{re|Feeglgeef}} Oh thank you for pointing that out! I am still a bit new to this project and confused, so I need to read up some more about this. How do I return a monolingual text object? [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 14:17, 23 April 2026 (UTC) ::::::I'm trying to fix it for you, the construction of ZObjects in code implementations is a bit difficult right now. Since the State origin using entity and class function will (presumably) be composition, perhaps {{Z|33975}} can be adjusted to return a string, using {{Z|26107}} and {{Z|26107}}? [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:21, 23 April 2026 (UTC) :::::I did not notice any discrepancies from looking at the functions by themselves, and it seemed to work fine on my end. Is it bad practice for NLG functions to return the monolingual text type? I had assumed it was logical. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:24, 23 April 2026 (UTC) ::::::Both implementations are failing all three tests on my end. No consensus has been established as to whether monolingual texts or strings should be used, so it's like the [[w:War of the currents|war of the currents]] but for Wikifunctions. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:27, 23 April 2026 (UTC) :::::::Oh, you were referring to {{Z|Z33986}}. I assumed you were stating that something was wrong in the earlier English functions that I missed; I apologize for the misunderstanding. Has there been any centralized discussion on this string vs. monolingual text issue? &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:31, 23 April 2026 (UTC) ::::::::Not that I'm aware of, I've brought it up on the telegram twice before, though. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:49, 23 April 2026 (UTC) ::::::::The centralised discussion is at [[WT:Abstract Wikipedia/2025 fragment experiments#Proposed recommendation: Fragments should return Z11/monolingual strings]]. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 07:19, 24 April 2026 (UTC) ::::::: {{re|Theki|Feeglgeef}} Can only functioneers test implementations? For me I can't test it at all... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 14:32, 23 April 2026 (UTC) ::::::::AFAIK, test cases are only immediately testable during editing of a function if they are connected. This is one of my personal pain points with Wikifunctions, iterating on functions without exhaustive connected test cases makes debugging practically impossible for non-functioneers working on newly-created functions... I (or Feeglgeef) can quickly connect the tests you need for you if you want, although if they are not well-formed they may need to be disconnected again afterwards. Additionally, I could temporarily connect the implementation you are writing so that you can test it on the sidebar as you work, but I'm not sure if this is advisable. That functionality is also something that unfortunately only works when not disconnected. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:43, 23 April 2026 (UTC) :::::::::Yup, agree with you on all points, thanks. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:48, 23 April 2026 (UTC) == Please disconnect implementation == I think I've fixed my issue with {{Z|Z33986}}, but I can't edit an actively connected implementations with my rights. I must admit it is an AI-aided fix, I feel very strongly about disclosing that. Courtesy pinging [[User:Theki]] and [[User:Feeglgeef]]. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 18:51, 23 April 2026 (UTC) : Additionally, I think the JS might be working. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 18:52, 23 April 2026 (UTC) : Just to clarify, I mean disconnect the Python implementation please. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 18:53, 23 April 2026 (UTC) :{{Done}} I've disconnected the Python implementation. :I've also added a couple of tests. The rule is a bit more complicated than adding a maqaf before every character that is not a Hebrew letter. Unfortunately, I don't think I'll have time to fix the implementations any time soon. [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 19:03, 23 April 2026 (UTC) :: Thank you! :: Also, for some reason I thought you put a maqaf before all gershayim, so thanks for correcting me. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 19:09, 23 April 2026 (UTC) :::No, that's not the rule. :::The rest of this reply is an [[:wikt:info-dump|infodump]], feel free to ignore it :) :::In [https://hebrew-academy.org.il/topic/hahlatot/punctuation/ the Academy's punctuation rules], the rule for adding a maqaf is written kind of badly: שמים מקף ברצף שיש בו שני סוגי גופנים, כגון אותיות ומספרים ("maqaf is added in a sequence in which there are two types of fonts, such as letters and numerals"). These are not different types of "fonts", but different types of characters, and I should email them about it. It gives the examples <span lang="he" dir="rtl">ה־12</span> and <span lang="he" dir="rtl">ב־DNA</span>. It doesn't say anything explicitly about quotation marks, but in other places on the same page, you have stuff like <span lang="he" dir="rtl">ב"הארץ"</span>, and from that I deduce that a maqaf is not needed before double quotes if there are Hebrew letters inside the double quotes. :::That said, a few people do think that there must be a maqaf before double quotes. I have a somewhat surprising example of somebody who always does it: translators of Scientology materials into Hebrew. At least that's what they did last time I looked at them, about ten years ago. Those people are certainly prolific, and they get points from me for consistency, but this not the prevalent standard. (And if I recall correctly, they use the minus and not the proper Hebrew maqaf, and they don't get any points from me for that!) :::Also, the name of the character is just "double quotes" and not "gershayim". Gershayim are mostly for abbreviations, although most people use the same character for them. I use ״ for gershayim, as do a few other nerds, but we're the minority. [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 19:35, 23 April 2026 (UTC) :::: {{re|Amire80}} Yeah, "font" is a weird choice of wording here by the Academy...<br> I think I'll follow your guidance and not use a maqaf for quotes beginning with Hebrew letters. <br> I should also add more tests for different types of quotes, like straight (", '), curly (“, ”, ‘, ’), gershayim (״, ׳), including single quotes.<br> P.S. gotta deduct points from Scientology for being a cult but that's neither here nor there [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 20:49, 23 April 2026 (UTC) :::: {{re|Amire80}} Courtesy ping because I mistyped your username on the last message. Anyways I'm also gonna do that tomorrow because I'm tired now... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 20:50, 23 April 2026 (UTC) == Connect implementations == Hello! I'm done with the implementations of {{Z|Z33986}} both in JS and Python, and all tests pass. Pinging @[[User:Amire80|Amire80]] to check if all the tests I've added are alright. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 15:24, 24 April 2026 (UTC) :Connected. It's possible that some more changes will be needed, but it looks OK now. :Another little comment: It should be called "clitic" and not "prefix". [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 15:56, 24 April 2026 (UTC) : {{re|Amire80}} Thanks for your comment! Luckily labels are easy to edit, so I'll get to it. : Currently I'm working on Bulgarian {{z|Z34072}} and {{z|Z34084}}, along with other Bulgarian functions. After I'm finished with those I'll take your advice. [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 16:01, 24 April 2026 (UTC) == Please connect my Bulgarian implementations == I recently created the following Bulgarian functions: * {{Z|Z34070}} (currently broken, I think because another function I built it upon is unimplemented) * {{Z|Z34088}} * {{Z|Z34105}} * {{Z|Z34072}} * {{Z|Z34084}} Can somebody please connect these functions, and perhaps suggest other functions I could localize? [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 19:03, 24 April 2026 (UTC) : Specifically, [[Z34070]] is based on [[Z34072]] [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 19:05, 24 April 2026 (UTC) :{{done}} for everything that passes, [[Z34070]] still does not work after purging WF's cache, though. For future reference, please request on the [[WF:Community portal|community portal]] instead of the project chat. Thank you for your work! [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 20:03, 24 April 2026 (UTC) :: {{re|Feeglgeef}} Thank you for your help! I will keep in mind to go to the [[project: community portal| community portal]] in future instead for this. :: I still don't understand why {{Z|Z34070}} fails... It's implementation is almost completely identical to [[Z30399]] from {{Z|Z30397}}, unless I messed something up... [[User:QuickQuokka|QuickQuokka]] ([[User talk:QuickQuokka|talk]]) 20:11, 24 April 2026 (UTC) :::{{done}} No, it was mostly just timing out. It is better to use selective fetches where possible. One case is failing to match the expected results, but at least it is returning something. For all I know, it might even be acceptable! [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 20:35, 24 April 2026 (UTC) :::: {{re|GrounderUK}} Thank you so much for your help! The one failed case is with a definite article, so I feel like that might be fixed in the future... <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 20:43, 24 April 2026 (UTC) == Editor experience suggestions == I'm a bit frustrated with the editing experience on Wikifunctions, and I have suggestions based on pain points I've had contributing to this project: * Adding a wizard to create functions, implementations, and tests in one flow, somewhat like Wikimedia Commons' upload wizard * A sandbox for experimenting without changing mainspace functions, and maybe letting non-functioneers connect implementations ([[Project: Sandbox]] doesn't seem to fit this) * We could have functions for creation based on the sandbox, like how Wikipedia has articles for creation and edit requests, * Maybe even another test instance of Wikifunctions, like how Wikidata has [[testwikidata:|Test Wikidata]] I really like this project and I don't mean to whine, but it certainly has a lot of pain points both for technical and non-technical people. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 20:41, 24 April 2026 (UTC) : It's also really complicated to localize functions, so maybe we should add another wizard for that, where you can choose a language, and then create the new function with the aforementioned function wizard, and it just automatically adds it to the related language configuration object of the related function. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 20:48, 24 April 2026 (UTC) :# Sounds good to me. :# A sandbox available is [[Z10119]], though an extension-provided sandbox that allows you to manipulate the types, code, and tests easily without interfering with the mainspace would be nice. :# [[WF:Suggest a function|This page]] works to some extent, though it's too messy in my opinion. :# We used to have a "beta cluster" but it [[phab:rOMWC5f625c5846b5f779473fa32c9a02d87e59215dfa|got shut down]] just over a year ago because it was broken. :[[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 21:07, 24 April 2026 (UTC) == Language parameters in language-specific functions == I think that an effort should be made to give the different natural language options corresponding to different English dialects, Chinese scripts, etc. more of a use (I added the test {{Z|Z34119}} to {{Z|Z26095}} and unsurprisingly it fails). There are two main problems with this approach that I can identify: * If you ask the majority of these functions to make a sentence in British English, much of the time it will give you an output with missing words, because it does not fallback to English labels in the case of a British English label for that item missing. The same applies for every other English dialect, British English is just an example here. * Uninformed editors will probably see the presence of a language parameter on these functions, consider it redundant, and remove it. [[Special:Diff/268074|I have made this mistake before]]. In my opinion, in a perfect world, all of these language generation functions would output monolingual text, and if the user asks for American English text, then American English text is what they'll get. If the user asks for Japanese text in hiragana specifically, then that's what they'll get in return. This is not as high-priority as just rendering text in the language plainly in the first place, but it's something that I feel is still worth devoting some effort to. Right now switching functions to use this paradigm is difficult because, on the one hand, I don't know if consensus tends towards this direction being ideal or advisable, and I don't want to make changes like this without at least notifying the wider community. In addition, all tests break once a parameter is added or removed, and the function editor does not recognize the change in number of parameters and therefore you have to remove the function call, re-add it along with all of its parameters it had previously (which is a tedious cut-and-paste job), and then it will work again. This is something that you can do in five seconds by just adding a few lines of JSON to the test source, but this is not directly editable from the Web browser. This tedium is largely what's preventing me from doing this on a larger scale, besides asking for comments first. If anyone has any insights or comments on this, then that would be appreciated. If a reference of functions with and without the support for language variants is needed, of course [[WF:NLG]] can be perused, but I've also my own list cataloged at [[User:Theki/functions#language]]... Of course, this thread has many similarities to [[#"language" argument for certain functions|the one above]], but this concerns me going out and making this consistent across these NLG functions. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 21:09, 24 April 2026 (UTC) :I've created {{Z|Z34122}} as an extension to {{Z|Z34039}} for larger functions. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 21:34, 24 April 2026 (UTC) :Just to confirm that I, for one, support a Natural language parameter for all natural-language functions. The concern about getting them all aligned is just that we haven’t finally settled on {{Z|Z11}} being preferred to {{Z|Z89}} or some other type that conserves the text’s provenance, so we risk having to change them all again. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 10:07, 25 April 2026 (UTC) == “Key not found ()”? == What am I doing wrong in {{Z|Z34137}}? [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 00:39, 25 April 2026 (UTC) :You were passing a [[Z6091]] to {{Z|32290}}, but it takes a [[Z6001]]. Fixed. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 07:10, 26 April 2026 (UTC) ::{{done|Thank you}}! [[User:Redmin|Redmin]] ([[User talk:Redmin|talk]]) 14:13, 26 April 2026 (UTC) == Why is my test failing? == Hello! I recently made {{Z|Z34139}} based on [[wikt:Module:bg-translit]], and the test case {{Z|Z34141}} is failing on both implementations, despite the expected output and actual output being the same as far as I can tell. I tried looking at the Unicode codepoints of the output, but those are also identical. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 06:21, 25 April 2026 (UTC) :Yes, it’s a tricky one. I’ve added a normalize step to the result validation in {{Z|Z34141}}, which confirms it is a normalization issue. It looks like it is in the code but I don’t know whether simply normalizing the result is the way to go. Logically, you would normalize both the input and the result. The implementations of {{Z|Z10384}} show you how to do this. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 09:41, 25 April 2026 (UTC) == Edit request == Hello! I have an edit request for {{Z|Z23752}} and {{Z|Z23414}}. Please replace all the "an/a" logic with <code>Z21739(Argument reference)</code>, both for readability and for more accuracy ("a university is an institution") <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 09:50, 25 April 2026 (UTC) :{{D}} [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 12:24, 25 April 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #245 is out: The Foundation's search for the perfect language == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-04-25|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we present an academic paper about Abstract Wikipedia, we discuss our latest Type created, and we take a look at the newest created functions. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 09:54, 25 April 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30325620 --> :@[[User:Sannita (WMF)|Sannita (WMF)]], @[[User:DVrandecic (WMF)|DVrandecic (WMF)]], technical meta-question: the newsletter quotes the article: ::the only way to contest its algorithm is to click 👍 or 👎 (Crawford and Gillespie 2016) :This quotation sounds sensible, but the article's [https://link.springer.com/article/10.1007/s00146-026-02899-w web version], and the PDF that is downloadable from the same page doesn't actually show the emojis. It rather shows text that looks lacking: ::the only way to contest its algorithm is to click or (Crawford and Gillespie [https://link.springer.com/article/10.1007/s00146-026-02899-w#ref-CR14 2016]) :Where did you get the emojis? Is it your (probably correct) guess or is there a version somewhere that actually shows the emojis? [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 15:16, 25 April 2026 (UTC) ::Scratch that. I've found a version with correct emojis: https://wikihistories.github.io/wikilambda-the-ultimate/ [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 15:37, 25 April 2026 (UTC) == Requested deletion of test == Please delete {{Z|Z34143}}. this was never valid Bulgarian, I messed up. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:19, 25 April 2026 (UTC) :[[WF:RFD]] please. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 16:40, 25 April 2026 (UTC) == Request for comment (global AI policy) == <bdi lang="en" dir="ltr" class="mw-content-ltr"> A [[:m:Requests for comment/Artificial intelligence policy|request for comment]] is currently being held to decide on a global AI policy. {{int:Feedback-thanks-title}} [[User:MediaWiki message delivery|MediaWiki message delivery]] ([[User talk:MediaWiki message delivery|talk]]) 00:57, 26 April 2026 (UTC) </bdi> <!-- Message sent by User:Codename Noreste@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Distribution_list/Global_message_delivery&oldid=30424282 --> == Is it OK to connect the implementation? == Hello! I recently applied for functioneer on [[WF:RFG]], and I was wondering whether I could connect the implementation for {{Z|Z34165}} despite its dependency {{Z|Z34149}} being currently unimplemented. That is <em>if</em> I get accepted. I am planning on implementing it based on [[wikt:module:bg-nominal]], but am still having trouble figuring it out for now. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 09:04, 26 April 2026 (UTC) == Past tense function == Is there a function like {{Z|Z26039}}, but for the past tense (e.g. "Leo Tolstoy <em>was</em> a writer.")? If not, I will create it myself, I just want to make sure there's not a duplicate. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:10, 26 April 2026 (UTC) : {{Done}} with {{Z|Z34224}}, but I have a few kinks to work out with it. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:35, 26 April 2026 (UTC) :: I need to create some other similar functions for the past tense, I have some ideas: ::* {{Z|Z26095}} ::* {{Z|Z32643}} ::* {{Z|Z28016}} ::* {{Z|Z26570}} ::* {{Z|Z33975}} ::* {{Z|Z27243}} ::* <ins>{{Z|Z26627}}</ins> ::* <ins>{{Z|Z27627}}</ins> ::* <ins>{{Z|Z27173}}</ins> ::* <ins>{{Z|Z29591}}</ins> :: :: Are there any I have missed? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:57, 26 April 2026 (UTC) :I think that here we are starting to walk on dangerous waters: what does past mean? Is it a recent o a far past? Does it have ripercussions on the present or not? Is it just a thing that happened once, many times or for a continuative period of time? :Consider that various languages distinguish between many different types of past. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 12:38, 26 April 2026 (UTC) :: {{re|Dv103}} That is a fair point... :: How do we go about solving this problem though? I don't think having every sentence on Abstract Wikipedia be "X is a Y" is a very good idea. :: Maybe we have different functions for all these variations of past you mentioned that just map into "X was a Y." in English? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 13:31, 26 April 2026 (UTC) :::To properly solve this problem, we should use a more complete abstract content representation model, like for example the proposal of [[Wikifunctions:Type proposals/Semantic unit|Semantic units]] (look at [[Wikifunctions:Type proposals/Semantic unit/Douglas Adams|the example]] to see how times could be handled). For now, since we're still stuck with single fragment generation functions (that I hope will be slowly replaced with the complete represenation model, when available), we could just restrict your function to a very specific meaning, like "subject was an instance of, for most of its existence" (which means for example that it could be used to say "Douglas Adams was a writer", but not "Abraham Lincoln was a president", since he only was a president for 4 years). Probably my definition is still too vague, and this is why we need to go beyond these fragment generating functions. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 19:47, 26 April 2026 (UTC) ::Nitpick... I don't like that it outputs a string instead of monolingual text. With {{Z|Z26039}} it's used so much that I think it's unfixable in that case beyond deprecating it if people care that much, but {{Z|Z34224}} doesn't even have any connected implementations yet. Consider it, maybe? ::Nitpick 2... {{Z|Z34227}} is missing a language parameter. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 16:08, 26 April 2026 (UTC) ::: I will consider that! ::: I just did that because that's what {{Z|Z26039}} does, so I assumed I should follow suit with it. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 16:48, 26 April 2026 (UTC) == Legacy functions == If and when more robust methods of abstractly representing and generating linguistic content come around, and more efficient ways of creating abstract content are devised and implemented, I suspect that our current methods will require some form of deprecation. This is a significant source of concern for me in relation to WF and AW, questioning how prone our current methods of doing things are and eventually will be prone to obsolescence, and how it will be worked around when it comes. We have over 1 250 articles on AW presently, and these are rather all over the place. I suspect the maintenance burden from keeping these articles up to code will eventually, err, creep up on us, I suppose, and some kind of major refactoring will be necessary. We are definitely in a period of experimentation and whatnot right now but eventually, like with enwiki, some sort of structure and rigor will form and I suspect it will start to become rather boring for me... I, for one, very much enjoy experimenting with new and better ways to do things here. I don't personally mind changing things to use a new and better paradigm if need be, that sort of thing highly excites me, but of course there will be things that are left behind, and I suspect maybe bots will be employed to deal with this? A lot of Wikipedia sister sites seem to do that, e.g. going and fixing up use of deprecated templates. Considering the nature of Wikifunctions and Abstract Wikipedia I suspect certain maintenance tasks will be made simpler or even trivial by the typical uniformity of our implementations. I guess I am just concerned if Wikifunctions or Abstract Wikipedia will ever accrue its own kind of "technical debt" with how we are plowing through things presently, and if there is a plan for how we will eventually seek to mitigate that. Maybe too early to ask this question, but I am a notoriously anxious person, so I thought it wouldn't hurt to raise the question regardless... &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 21:30, 26 April 2026 (UTC) :I very much agree, thank you for expressing my position so well. {{ping|Immanuelle}} has been using an AI-generated tool (well, they haven't edited in a week, perhaps it's a break or perhaps they don't wish to contribute to the project any more) to create a bunch of articles en masse, which I have warned them multiple times is a bad idea (on top of evolving functions, all of the articles are one-sentence-per-paragraph, [[abstract:Q12184|like so]]). That's why I've been avoiding creating articles recently, I'd say I have a good fourth (no data to support, rough guess) of the comments on the wiki, yet less than a percentage of the article count (only three, including the [[abstract:Q319|first article]], though, so perhaps I'm the next [[w:Special:Permalink/908493298|office.bomis.com]]). [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 19:41, 27 April 2026 (UTC) :: I feel that the overwhelming presence of these low-quality articles (which I admit I myself am [[abstract:Q1710970|guilty]]/[[abstract:Q7601858|of]]/[[abstract:Q39338|creating]], usually as testbeds) may incur a large maintenance burden. I do expect them to be easy to detect, however, as searching for the presence of "deprecated" NLG functions is trivial, and it is possible that replacing them with their future ''even abstracter&trade;'' counterparts could be done automatically since they all have the same signatures and can be expected to create the same form of sentence. If it needs to be done manually for a while or for certain delinquent instances, my hope is that it will be fun, at least for a while. :: I just hope that these hypothetical future waves of "this new and versatile way of abstractly representing linguistic content" obsoleting previous methods and requiring refactoring across all articles is only a one-time thing. We should strive to be as robust and flexible as possible from the outset as each brand new paradigm of abstraction is also a brand new maintenance burden for updating old articles. At the end of the day, at least ''some'' of these articles will still render to many different languages even if their methods of creating those sentences of theirs is completely outdated. Ergo, the time it takes for the switchover to be performed across our articles should not be a persistent inconvenience for users (as, of course, they will always still be able to read the content as it was before since these legacy functions aren't being deleted outright), and the increased availability that the new methods will bring about will likely act as motivation for them to join the effort in refactoring (&#x300C;You're telling me that if I rewrite this article in this cool Lisp-looking stuff then I can probably read it in [[abstract:Q9307|Galician]]?? COOL!&#x300D;). &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 20:26, 27 April 2026 (UTC) :::Totally agree. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 02:54, 28 April 2026 (UTC) :::My vague plan is to implement a default function returning an {{Z|Z89}}, for each language-neutral function. A single function would convert any of these to a {{Z|Z11}}, so that a composition of the two can be implemented as the current default until such time as the language-neutral function is ready to return a [[Z89]]. We can already convert a [[Z11]] to a [[Z89]] so, although there is more to be done in this space, existing language-specific functions could be adapted to return a [[Z89]] quite mechanistically. :::Although we certainly could deliver parallel Z89 functions for each existing Z11 function, I don’t think we should assume that particular outcome. Provided the Z89 captures a lang attribute from the Z11’s language tag, the two representations should be largely interchangeable, although I am expecting a Z89 to carry additional attributes at the span level that would be lost on conversion to a Z11 (along with any higher-level tags and attributes). :::When I say there is “more to be done in this space”, I am referring to a new type that would allow HTML fragments to be represented as tractable Wikifunctions objects, but this is currently drafted only in my head! [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 11:21, 29 April 2026 (UTC) == Filtering types of objects == Hello! I have tried to comb through my own edit history several times, but it's really hard to search for specifics because there's no differentiation between different types of objects (functions, implementations, tests, etc.) in the logs as far as I can tell. Am I missing anything? I want it to work sort of like how filtering by namespace works. <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 16:48, 27 April 2026 (UTC) :There is differentiation, it's just rather hard to look through. Since all ZObjects are just JSON data at their core, you can search for instances of <code>{ "Z1K1": "Z[type]"</code>. I haven't tried this so I'm not sure how well it would work and I know MediaWiki search syntax treats quotation marks as a special character, but I have seen Wikifunctions pages link to searches using this before. There is also [[Special:ListObjectsByType]] but it is sitewide rather than specific to your edit history in particular. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 18:59, 27 April 2026 (UTC) ::''[It doesn’t help directly here, but please see [[WF:Find]] for more details of how this works.]'' [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 10:24, 29 April 2026 (UTC) :See the feature requests [[phab:T399244]]/[[phab:T373735]]. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 06:06, 28 April 2026 (UTC) :The lack of filtering edits by namespace is exactly the problem that I was trying to solve with the [[User:Amire80/wikifunctionsanalytics]] tool. :I even kind of succeeded, but it has two major problems: :# It doesn't have any real frontend, so you have to know some SQL to use it (or ask other people who know SQL). :# It doesn't get information from the live site, but from the dump, which appears to be updated once a month. :I've made a [https://quarry.wmcloud.org/query/104794 sample query for you]. Unfortunately, it won't do anything at the moment because of the second problem—your edits started in April 2026, which isn't over yet, so the dump for it hasn't been processed. But I hope that early in May you'll be able to use the same query and see something useful. :(I plan to add support for recent edits, but I haven't done it yet. Now that I more or less figured out how to process Wikifunctions edits, I'm focused on trying to understand Abstract Wikipedia edits. Processing up-to-date edits from both sites will possibly be the next thing I work on, but if you know some Python and want to try doing it yourself, don't wait for me—[https://gitlab.wikimedia.org/toolforge-repos/wikifunctions-analytics Patches welcome].) [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 18:51, 28 April 2026 (UTC) ::@[[User:QuickQuokka|QuickQuokka]], I've just updated the data until the end of April. Now the query to which I linked above gives some results. You can also try running other queries if you know SQL. (Or try asking for other queries if you don't.) [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 03:26, 3 May 2026 (UTC) == [[Z34213]] == I'm not quite sure why this implementation is failing. Could someone take a look? [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 02:24, 28 April 2026 (UTC) :I've [https://phabricator.wikimedia.org/T419933#11863997 notified] the team that this is still occurring, the issue was marked as resolved. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 02:52, 28 April 2026 (UTC) :Some useful tips: :* create more testcases: sometimes it is a random error, so try to see how consistent it is between testcases :* your implementation is very inefficient, since it fetches items and lexemes a lot of times. Ideally, each item and each lexeme should be only fetched once in all the execution tree. :[[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 06:06, 28 April 2026 (UTC) ::Caching (''should?'') means that the lexeme and item data are cached, so the call doesn't actually execute multiple times. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 17:51, 28 April 2026 (UTC) :::Are lexemes and items actually cached within the same function execution? Even if they are only partially fetched and/or fetched in bulk? [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 17:54, 28 April 2026 (UTC) ::::I don't have any evidence to prove that it works but that's definitely A. what's supposed to happen and B. the ideal behavior. This happens because the Z680X functions can be cached just like any other. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 18:02, 28 April 2026 (UTC) ::::It is unclear. In general, I believe identical branches are resolved only once in orchestration, but there is also independent caching of Wikidata fetches. ::::According to @[[User:DMartin (WMF)|DMartin (WMF)]] ([https://t.me/Wikifunctions/30374 on Telegram]): ::::<blockquote>Well, no. We have caching of Wikidata entities that have been retrieved, but not of the results of nested function calls. There is a proposal for doing this in the context of the V2 composition language, when it's a bit more mature, and it's regarded as a relatively high priority.</blockquote> ::::It’s hard to tell whether fetches in nested calls are, in fact, cached and available for other nested calls in the same call, since it is not generally the actual fetch that consumes the most resources. Rather (I believe), it is construction and transmission of the result object, which is currently repeated afresh in each nested call (unless it is in an identical branch). ::::I hope that’s clear, and I apologise in advance if it happens to be inaccurate! [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 10:16, 29 April 2026 (UTC) :::::Oh, I should clarify.  There is a lot of caching going on, in several different places.  Lexemes and items ''are'' cached by the orchestrator within the same function execution, even if they are only partially fetched and/or fetched in bulk.  When I said that we don't have caching of the results of nested function calls, I meant that's not happening in general, for all nested function calls in compositions.  But fetching of Wikidata entities gets special treatment, so yes, fetched content from Wikidata is cached, regardless if it was fetched by a top-level call or a nested call. :::::It is also true that the construction of a ZObject from the fetched JSON might happen more than once within the same function execution, depending on how a composition has been structured. However, the construction of the ZObject is actually very fast, compared to the elapsed time of getting the JSON from Wikidata. [[User:DMartin (WMF)|DMartin (WMF)]] ([[User talk:DMartin (WMF)|talk]]) 18:04, 1 May 2026 (UTC) == Question about cardinal numbers == I was about to edit {{Z|Z16435}} to add my function {{Z|Z34308}}, but I noticed that none of the other functions have a gender parameter. Should I create a new wrapper function "Bulgarian cardinal, neuter", or should I just remove the gender parameter and always return neuter? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 10:39, 28 April 2026 (UTC) :The “cardinal” functions should return the words used for “counting” numbers in the abstract. :We should consider converting them to return a {{Z|Z11}} rather than a {{Z|Z6}}. It may even be appropriate to return a {{Z|Z12}} to cater for language variants. Either way, I think that would be the approach to adopt for inflected forms, unless reference to specific lexeme-forms is required. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 12:52, 28 April 2026 (UTC) ::This. If a native of your language were to count up, which form would they be most likely to use? [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 13:29, 28 April 2026 (UTC) ::: {{re|GrounderUK|Feeglgeef}} Thanks for both your input! ::: I relabeled the aforementioned function to {{Z|Z34308}}, and created a new wrapper function {{Z|Z34457}}. ::: Should I specify that my old function is a monolingual text in parentheses? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 16:26, 28 April 2026 (UTC) ::::You don't have to, unless you think that is something that would require distinction when viewing the function in a list of search results &c. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 16:36, 28 April 2026 (UTC) == Optional/nullable function parameters == Hello! Recently, I was informed that Wikifunctions has no optional/nullable function parameters as of now. Are there any future plans to support this, and/or workarounds? Maybe create a union type system like "{{Z|6}} or {{Z|23}}". <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 17:53, 28 April 2026 (UTC) :What I do for this is use an "is empty" function corresponding to the type of the parameter in an If statement. If it isn't empty, the function works as intended. Otherwise, it does something else. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 17:58, 28 April 2026 (UTC) :Unions are not a thing (yet) on Wikifunctions, but you can always define an argument of type {{Z|Z1}}, which means that all types are allowed (I already did this for {{Z|Z26737}}; note that it is still a ugly workaround, don't use it for high level functions). Also, note that usually on Wikifunctions we use {{Z|Z24}} as the null value. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 18:00, 28 April 2026 (UTC) :: {{re|JJPMaster|Dv103}} Thanks for your help! :: @[[User:Dv103|Dv103]] told me a function call with a missing parameter is treated as an invalid function call, so how does the "is empty" function work with that? :: Also, setting the type to {{Z|1}} seems naive, like setting the type as <code>any</code> in TypeScript... :: Related question: Are there plans to add default values to parameters (outside of "if empty")? <span style="border-radius:99q;padding:0 7q;background:#103;border:3q solid #FBF">[[User:QuickQuokka|<span style="color:#FBF">'''QuickQuokka'''</span>]]</span> <sup>[⁠[[User talk:QuickQuokka|talk]] • [[Special:Contribs/QuickQuokka|contribs]]]</sup> 18:19, 28 April 2026 (UTC) :::Setting the type to {{Z|Z1}} is actually naive, and that's why I advised you to only use it for low-level functions. Currently there is nothing better. Sometimes, type correctness is not actually checked, so it might seem that nullable types are possible. But it is still an hack, and it could broke anytime since it is not intended behavior. :::I don't think that there are current plans to add default values (but correct me if I'm wrong). The closest thing that comes to my mind is that, if you incorporate Wikifunctions into Wikitext, you can leave empty some fields (only of some specific types) and Parsoid will replace them to their default value. This is done only depending on the type, and not on the functions. For example, {{Z|Z6091}} and {{Z|Z6001}} are assigned the QID associated to the page, and {{Z|Z20420}} is assigned the current date. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 18:56, 28 April 2026 (UTC) :::@[[User:QuickQuokka|QuickQuokka]]: At the very least, [[Z10008]] accepts a null input. Maybe that feature is unique to the String type—I am not sure. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 19:10, 28 April 2026 (UTC) ::::I think it's just not checked, but it shouldn't be intended. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 19:20, 28 April 2026 (UTC) ::::Strings and typed lists can be “empty” in the sense that their length can be zero. Typed pairs may also be “empty” in a degenerate sense, but such an object will not be returned from a code implementation. A typed map with no entries will also fail to be returned from code, although it is fine in compositions. ::::For a genuinely optional parameter, I prefer a properly typed list, which at least encourages an argument of the correct type. {{Z|Z813}} is also typically faster than {{Z|Z10008}}. Quite a good example of this approach is {{Z|Z23723}}, where it helps to resolve the type union (using [[Z1]]) for both Z6003K1 and Z6003K3. Of course, there’s nothing to prevent more than one element in the list, but additional elements are easily ignored. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 22:55, 28 April 2026 (UTC) :Pinging {{ping|Jdforrester (WMF)|prefix=|p=}}, I believe there are no current plans. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 19:02, 28 April 2026 (UTC) ::@[[User:QuickQuokka|QuickQuokka]]: I'm afraid there are no current plans to build out optional params, indeed; we would be happy to review this if a compelling case was made, but it'd be a lot of work to re-build the [[Wikifunctions:Function model|function model]] with that support and ensure we don't break (too many) things. [[User:Jdforrester (WMF)|Jdforrester (WMF)]] ([[User talk:Jdforrester (WMF)|talk]]) 19:11, 28 April 2026 (UTC) == Z6830 for Chinese == I was trying to use {{Z|Z6830}} for implementation in the Chinese-language. And turns out most of the Lexeme on Wikidata is using [[d:Q727694]] as the language instead of [[d:Q7850]]. This makes it impossible to use the mentioned function above, since Standard Chinese is not available (or did I miss something?). Is there a way to fetch lexemes with language=[[d:Q727694]] from item? [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 18:20, 30 April 2026 (UTC) :@[[User:Sun8908|Sun8908]] There is [[Z1006]] for Chinese and it has the language code zh. There is an overview of languages in [[Module:Wikifunctions label]] so you can search there for chinese versions and choose the one you need. [[User:Hogü-456|Hogü-456]] ([[User talk:Hogü-456|talk]]) 20:53, 5 May 2026 (UTC) ::I know that. The problem is when using the function [[Z6830]], it cannot retrieve lexeme with language [[d:Q727694]] (but it is the "Chinese language" with the most current Wikidata lexemes, see [https://ordia.toolforge.org/language/ ordia]). I think it should be a Wikidata problem, I might fix it (possibly by creating the same lexemes with language code zh) on Wikidata. Thanks anyway. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 05:39, 6 May 2026 (UTC) :Could you provide an example of a Chinese lexeme that has a linked Wikidata item, or a Z6830 function call that fails to find such a lexeme where one exists? [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 07:55, 6 May 2026 (UTC) ::Here: [[d:Lexeme:L846083]]. I think that's a primary reason of me trying to look into this problem, as the label in zh for [[d:Q6256]] (country) is not a single phrase (see its talk page on WD for more information). This makes some Abstract Wikipedia articles very weird in Chinese when {{Z|Z26570}} is used, so lexeme could potentially fix that. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 10:33, 6 May 2026 (UTC) :::Thank you. It looks as though {{Z|Z6830}} [https://www.wikifunctions.org/view/en/Z6830?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z6830%22%2C%22Z6830K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q6256%22%7D%2C%22Z6830K2%22%3A%7B%22Z1K1%22%3A%22Z6092%22%2C%22Z6092K1%22%3A%22P5137%22%7D%2C%22Z6830K3%22%3A%7B%22Z1K1%22%3A%22Z60%22%2C%22Z60K1%22%3A%22cmn%22%2C%22Z60K2%22%3A%5B%22Z6%22%5D%7D%7D returns that lexeme for language tag "cmn"]. Perhaps that tag should be added into the helpers for {{Z|Z24144}}? If it is widely used for lexemes, perhaps it should have its own {{Z|Z60}}? In any event, improvements might be considered under [[:phab:T390563]] (or otherwise), including amending [[Z6830]] to also consider "cmn" (and "zho", "chi"…?) when requests are made for "zh-hans" or "zho-hant" (or others?) @[[User:Winston Sung|Winston Sung]] @[[User:DMartin (WMF)|DMartin (WMF)]] [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 17:22, 6 May 2026 (UTC) ::::If you go to [[d:Special:NewLexeme]] and put in [[d:Q727694]] as the language, it is going to tell you it has an unrecognized language code. So I believe "cmn" should not be a {{Z|Z60}} by default? I also started [[d:Wikidata:Project_chat#Lexemes_with_language_Standard_Chinese_(Q727694)|a discussion on WD]] regarding this. I guess we can still use it as a fallback language though if possible. [[User:Sun8908|Sun8908]] ([[User talk:Sun8908|talk]]) 03:43, 7 May 2026 (UTC) ::::We don't have a separated <code>cmn</code> BCP 47 language subtag in MediaWiki and Wikidata at the moment. <code>zho</code> and <code>chi</code> are ISO 639 language codes but not BCP 47 language subtags. ::::For Modern Standard Mandarin, please use <code>zh-*</code> language tags for now. -- [[User:Winston Sung|Winston Sung]] ([[User talk:Winston Sung|talk]]) 15:26, 8 May 2026 (UTC) == Key not found error == Is there a reason why I am getting key not found error for this [[Z34677|function]] {{Z|Z34677}}? All the underlying functions run and all the test cases work. The debug information does not give more details. Any pointers? Thanks in advance [[User:Jsamwrites|John Samuel]] 19:24, 1 May 2026 (UTC) :It was passing the [[Z6091]] to {{Z|34641}} when that takes a [[Z6001]]. I've fixed that, but there's some other problem with the logic, so I've left it disconnected. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 19:42, 1 May 2026 (UTC) ::@[[User:YoshiRulz|YoshiRulz]] Thanks a lot. [[User:Jsamwrites|John Samuel]] 20:21, 1 May 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #246 is out: Request for input: what should we count for Abstract Wikipedia == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-05-02|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we ask you what would be the relevant metrics for Abstract Wikipedia, we discuss our latest news on Composition Language v2, and we take a look at the latest software developments. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 12:21, 2 May 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30325620 --> == Any formal process for deletion of pages == Does a formal process exist for the deletion of functions, implementations, and tests that includes a notification system for creators, analogous to Wikidata’s process, explaining the rationale behind the deletion (or proposal for deletion)? [[User:Jsamwrites|John Samuel]] 12:36, 3 May 2026 (UTC) :Does [[Wikifunctions:Requests for deletions]] work? [[User:Amire80|Amir E. Aharoni]] ([[User talk:Amire80|talk]]) 13:00, 3 May 2026 (UTC) :Please see the discussion at [[Wikifunctions talk:Requests for deletions#Should we expect Objects' creators to get pinged on deletion proposals?]]. :As I see it, it is the proposer’s responsibility to consult appropriately before making a request and we expect our administrators to act only when satisfied that appropriate consultation has occurred. In many cases, no consultation is required. Administrators may delete their own contributions without making a request, but this is not a practice I would encourage. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 13:51, 3 May 2026 (UTC) == Implementation of rational number in JS doesn't match in Z19677 (Rational number) and Z28579 (RGBA colour) == In {{Z|19677}} it's <syntaxhighlight lang=js> { "K1": sign * numerator, "K2": denominator } </syntaxhighlight> but in {{Z|28579}} it's <syntaxhighlight lang=js> [ sign * numerator, denominator ] </syntaxhighlight> '''<span style="font-family:Iosevka,monospace">[[User:沈澄心|<span style="color:#9f3526">dring</span>]][[User talk:沈澄心|<span style="color:#534fa3">sim</span>]]</span>''' 05:15, 4 May 2026 (UTC) :I'm guessing this is why [[Z34743]] fails all the tests. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 01:00, 18 May 2026 (UTC) == Nested functions in compositions == I wish it will be easier to a add another function about a specific existing function in a function implementation based on a composition. When I write long functions in spreadsheets I usually stat with a small part and then I try to go further and after important steps I test if the output is as expected. I created [[Z34826]] to get the German gender specific occupation lexeme for a specific person based on their gender. I wanted to add a function around the existing one and it was not successful. It is not very easy to implement as it requires the possibily to move a part to another section but I think it can be helpful if it will be implemented. So far I spend more time as expected on the function. Describing it with words what the function needs to do is much easier than implementing it here in Wikifunctions. So I think there needs to be improvement to make Wikifunctions more accessible. [[User:Hogü-456|Hogü-456]] ([[User talk:Hogü-456|talk]]) 21:10, 5 May 2026 (UTC) :Have you tried to use the copy-paste functionality? It is very useful to move parts of composition arounn. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 07:12, 6 May 2026 (UTC) :I've also found the composition editor to be wholly unsuitable for any expressions more than a few levels deep. (Even with the <code>localStorage</code> clipboard, because of its overzealous type checks.) Compositions naturally grow out from the "leaves", the immediate operations on the inputs, while the interface really wants you to build from the "root". I mostly use the [https://yoshirulz.gitlab.io/WikiLambdaBlockly drag-and-drop block editor] which I made to smooth over some of the site's problems, so if you want to try that out and give me some feedback I'd appreciate it. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 14:36, 6 May 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #247 is out: References from Wikidata now available == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-05-08|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we announce that is now possible to pass references in Wikidata statements, we introduce the [https://abstract-data.toolforge.org/ Abstract Data dashboard], we report you on the presentation about Abstract Wikipedia at WikiCon Australia, and we take a look at the latest software developments. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Also, we remind you that if you have questions or ideas to discuss, the next '''Volunteers' Corner''' will be held on '''[https://zonestamp.toolforge.org/1778520600 May 11, at 17:30 UTC]''' ([https://meet.google.com/xuy-njxh-rkw link to the meeting]). Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 11:16, 8 May 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30325620 --> == RGBA colour, spelling... == Something that has always irked me a little bit is the spelling of [[Z28579|RGBA colour (Z28579)]]. I guess this is not unsurprising for me considering my use of US English but I think there is more to it than preference and I want to try to argue for it being changed to use American spelling. I know that this probably has a snowball's chance in hell of actually garnering any support, so I won't really be miffed if the spelling remains as it is, but I thought it wouldn't hurt to raise this regardless. The main issue I have with it is the spelling of the original proposal. When infernostars raised the [[Wikifunctions:Type proposals/RGBA color|type proposal]], the spelling was 「RGBA color」. Of the comments that mentioned the word 「colo[u]r」, two used British spelling while six used the American spelling as used in the proposal. The only thing that really pointed to the use of ''colour'' was the fact that the catalog page on color functions used that spelling already. For all intents and purposes, the spelling of the original proposal should have been maintained, but it was not; [[User:DVrandecic (WMF)|DVrandecic]], the eventual creator of the type, used a different spelling. It should be noted that there was really no reason for this to occur and while it is an undoubtedly minor issue I still believe it should be rolled back and the type should use the spelling of the original proposal and majority of editor comments. In [[abstract:Q936|OpenStreetMap]], there have been keyvalue proposals that have had the finalized spelling that gets put to use be in British English despite the original proposal being in American English; this has usually occurred with proposals relating to 「X center/centre」 tags. This makes sense on the surface, because OpenStreetMap is maintained by a UK organization, and still has close ties to Europe. The Wikimedia Foundation, however, is an ''American'' company. This is often brought up as a fallible argument when debating article spelling on the English Wikipedia, and I don't bring it up to support that 「RGBA color」 should be used for that exact reason, but rather to state that OpenStreetMap's general policy on tag names need not apply here. It appears to me that, at least initially, the majority of 「core contributors」 to Wikifunctions used British English; I can name YoshiRulz, 99of9, GrounderUK, and VIGNERON.<ref group="color">I'm avoiding linking to these folks because I don't think pinging them about this discussion is all too necessary unless they themselves want to be involved; I don't want to clutter their inboxes just to briefly mention them. I pinged Denny because, well, I'm asking him a question directly, but everyone else I would prefer to join this discussion by their own accord... not that I wish for this decision to be confused as me going 「these people use British English so they will probably oppose my idea, I won't invite them to the discussion because of that」...no, I promise you that is not the reason.</ref> I see (or saw) these people ''everywhere'', so it makes sense that British English has prevailed in some sorts on this website, but I don't think that indicates that it should be the ''preferred'' spelling across the website, at least not to the point where a proposal should have its name changed to match such a "consensus".<ref group="color">It could be argued that the front-and-center ''Function catalogue'' using 「catalogue」 is actually indicative of such a "consensus", but ''catalogue'' is in a similar position to the word ''grey'' where I live (that is, the US) in that it is used just as often as its American counterpart. Also, consider Wiktionary's ''Beer parlour'' project chat.</ref> The unnecessary modification of the original spelling is my main argument for changing it back... but of course, I must obligatorily state that on English Wikipedia, it is [[w:Color|Color]] and [[w:RGBA color model|RGBA color model]]; on Wikidata, it is [[d:Q1075|color]] and [[d:Q2325624|RGBA color space]]; in CSS (which typically uses hexadecimal triplets to specify RGBA values), the properties are <code>color</code>, <code>background-color</code>, etc.; bit of a weak jab, but on Schema.org it is [https://schema.org/color color], [https://schema.org/colorSwatch colorSwatch]; et cetera. {{Z|Z28580}} uses ''color'', so does {{Z|Z28591}} and its Python counterpart. Mr. Vrandečić, I have to ask, I'm rather confused... you created the color type using British English spelling, but you were also responsible for the creation of the equality function which uses the American English spelling. You also seem to be writing in American English for the status updates, judging by your use of -''ize'' over -''ise'' endings and use of ''program'' over ''programme'' in [[Wikifunctions:Status updates/2026-04-16]]. Is there something I'm missing or have you switched your preferred variant somewhere along the way? Anyways, do consider this if you wish... again, I don't suppose this will garner much support, it is the ''non-issuest'' of ''non-issues'', but it has irked me to the point where I want to ask about it to get some answers, if nothing else. I am not arguing for every other color function to have its name changed, just the type itself. <references group="color"></references> &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:04, 8 May 2026 (UTC) :This is a multilingual project; the <code>en</code> label is <code>RGBA colour</code> and the <code>en-us</code> label is <code>RGBA color</code>. Though I'm not able to switch to <code>en-us</code> via the language picker so that would need to be fixed.<!-- --><br>edit after reading your whole comment: The same is true of {{Q|1075}}, there are labels specified for multiple English variants. (In {{Q|2325624}} it's only an alias.) I agree that other websites' choices aren't binding on us, but from that, I conclude that the more widespread British/Commonwealth spellings should be used for the generic <code>en</code>. As for myself, I'm Aussie and I will continue to use the BrE spellings ([[w:en:Oxford_spelling#Language_tag_comparison|+ "routing"]], TIL) if only by muscle memory.<!-- --><br>[[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 17:42, 8 May 2026 (UTC) :: Your lattermost point would normally be fine in a perfect world. Wikipedia's <code>convert</code> function defaults to "international" English, which I don't personally take issue with because it happens that we here in America are actually outliers for saying and spelling things differently... err, or we were for a while at least, nowadays it seems like an even split (plus you have "yield" vs. "give way" which is effectively the logical opposite of US's use of "meter" over "metre"). :: However, this is not a perfect world, and I don't think <code>en</code> should correspond to any particular variant. It is too fragmented across all software at this point to impose such a requirement. The inability to switch to <code>en-us</code> on this website foregoes an easy and simple solution to this problem that makes everyone happy, because the yanks (such as myself) can't be happy because we can't see the labels in American English even if we wanted to, and the other folk can't switch either as far as I'm aware (and the en-CA and en-GB languages in the preferences page seems to be deprecated). My point being, <code>en</code> is abused to mean "en-UK" just as often as it is abused to mean <code>en-US</code>; I think a decision shouldn't be made on such an assumption of one "default". &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:48, 12 May 2026 (UTC) :Hi @[[User:Theki|rae]]! I have no opinion nor preference on this, and given my background, I am just entirely confused about my spelling preferences myself, as you can tell from my inconsistent usage. I learned British English in school and used that for maybe two decades or so, but moved to the US and lived there for more than a decade, enough to be naturalized, but now I am back in Europe and I am technically a professor at King's College London, soooo.... honestly, I do not know. I don't remember having put too much thought into it at the moment I created it. The good thing is that in Wikifunctions, just as in Wikidata, it is easy to change, without messing things up too much (unlike in Wikipedia), so my suggestion is, just make the change, see if anyone complains, and if they do, discuss it more. I don't know if there is a guideline already in Wikifunctions about the variants. I am happy either way, and honestly, I keep forgetting which variant is which most of the time. --[[User:DVrandecic (WMF)|DVrandecic (WMF)]] ([[User talk:DVrandecic (WMF)|talk]]) 18:16, 10 May 2026 (UTC) :: I can definitely understand this, although I am unfortunately rather passionate about any minutiae involving preferential minor differences in ''anything'', of which AmE vs. BrE chiefly is. So I dedicate a lot of headspace to it. More than I should. Not that I wish to imply that the comment above that I have wrote is of an irrational nature, or done out of spite or pure emotion and subjectivity; I do genuinely believe that ''RGBA color'' is beyond just a personal preference and is just logical. I may boldly go and change it, but for some reason I was expecting that changing the English label of a Type would require elevated permissions, and I also didn't want to do it only to get immediately reverted because it ''did'' strike a chord with someone, when I could instead see how apathetic, supportive, or in opposition interested people are beforehand and ''then'' act accordingly. I was not meaning to antagonize you over your spelling habits, I did actually use British English for a few years starting in 2020 before I went back to American English, so I'd be a hypocrite for me to decry you for not always sticking to some arbitrary standard of spelling words over the other. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:55, 12 May 2026 (UTC) :Although I spell it “colour”, I think it makes more sense to use “color” for the type, since that is almost always the required spelling when the string functions as a keyword. :More generally, though, Wikidata’s lexicographic data happens to favour “colour” over “color” and (quite rightly, in my view) lacks a specific representation for "en". This is unusual, in my experience, as "en" is widely misused in place of "en-US", where there are recorded spelling differences. :(I would also say it is standard British English to use “program” in a programming context and “programme” elsewhere. Use of -ize rather than -ise is a matter of personal preference or house style, but regional autocorrect encourages -ise.) [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 11:00, 12 May 2026 (UTC) :: ''Wikidata’s lexicographic data happens to favour “colour” over “color” and (quite rightly, in my view) lacks a specific representation for "en"'' :: Definitely agreeing with you on the latter being a good choice. However, I suspect the favoring of "colour" over "color" may be because, in terms of language codes, when sorted alphabetically <code>en-us</code> actually comes ''after'' <code>en-gb</code>. Although, the frontend seems to be sorting <code>en-ca</code> after <code>en-gb</code>, so I don't actually know how correct that is. :: ''I would also say it is standard British English to use “program” in a programming context and “programme” elsewhere'' :: The context of the spelling was "''No program for the NLG SIG meeting for next Tuesday has been proposed''". In that usage context, I think it makes sense to assume that ''program'' is not being used to refer to a computer program, but to a ''program of events'' or similar, something that you would spell as a ''programme'' in British English. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 15:02, 12 May 2026 (UTC) :{{s}} this. I'm obviously biased but I believe American English is preferable generally, American dominance on the internet (our Department of Defen'''s'''e invented it!) and rapidly-increasing consumption of American media by international English speakers means that more people use American English's conventions, this is clear through for example [http://trends.google.com/explore?q=color%2Ccolour&date=all&geo=Worldwide search trends] (though they aren't particularly reliable). Perhaps this is a bit of a supremacist opinion, but we should have internal consistency, and if we must choose, American English should be our first choice (then Indian and then British English) [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:10, 12 May 2026 (UTC) :: This is rather flawed reasoning, though. I think probably any given British or Indian person would not agree on using that as the reasoning for this, not that you are necessarily ''completely wrong'', but if this is not a good enough reason for English Wikipedia's (admittedly extremely flawed) ''ENGVAR'' policy then I don't think it's likely it will pass here either. :: Although of note is that [https://books.google.com/ngrams/graph?content=color%2Ccolour&year_start=1800&year_end=2022&corpus=en&smoothing=3&case_insensitive=true Google ngrams] agree with you, but "color" vs. "colour" is an eternal holy war that will not be won by demonstrating that more books use US spelling over Commonwealth spelling. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 14:44, 12 May 2026 (UTC) :::You're probably right that it's not very sound. I'm biased in that other varieties of English irk me, and that's probably mutual for people who are used to other varieties of English when they read what I write! [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 14:56, 12 May 2026 (UTC) :I've decided to boldly [[Special:Permalink/274271|make the change]]. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:02, 12 May 2026 (UTC) :: Thank you. Considering both you and GrounderUK seem to consider it an okay change, I think this will do for now. :: I should note that the matter of whether to move [[Wikifunctions:Catalogue/Colour functions]] in response to this (however this discussion will ultimately turn out) is a whole other can of worms, in my view. I can't say I have an opinion on that at the moment, but I'm putting it out there regardless. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 15:06, 12 May 2026 (UTC) :::Personally, I'm in favor of moving the page and renaming all of the items on it. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:10, 12 May 2026 (UTC) ::I don't like this (exactly because of the American hegemony you cited), but again, it shouldn't matter because the software is meant to be multilingual. Clearly there's a bug preventing you from picking an English variant/dialect as your display language. But the search bar and Function/Type autocompletion do check the English variants for matches. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 15:15, 12 May 2026 (UTC) == Proposals on the architecture of Abstract Content rendering == Starting from a discussion born on the Telegram chat, I've explained two different proposals on how the NLG on Abstract Wikipedia should be organized in the page [[abstract:User:Dv103/Abstract articles architectures]]. Please come to contribute to the discussion, or to propose alternatives. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 14:31, 11 May 2026 (UTC) :Thank you for dedicating your time to writing this, it is very informative. I will try to add input once I'm not in over my head with finals. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 16:27, 12 May 2026 (UTC) == Display function for HTML fragment == Currently, any collapsed Z89 literal appears as<blockquote>&lt;&gt; [[Z89|HTML fragment]]</blockquote>If I were to create a new Function which returned something like<blockquote>&lt;&gt; 123-byte HTML fragment <q><nowiki><td><span lang=</nowiki>&hellip;</q></blockquote>could that be connected to replace the collapsed form, or would it require changes to the Wikilambda software? [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 16:14, 11 May 2026 (UTC) :It might work, but I doubt it. Those angled brackets suggest that the collapsed form is not simply defaulting to the type’s label. Looking at [[:phab:T410509]], I’ve concluded that enhancements to the collapsed form were never considered, rather than being actively rejected. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 12:12, 12 May 2026 (UTC) ::[[:Phab:T391985]] documents the original design. Note the fifth bullet point under “Acceptance criteria”. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 12:21, 12 May 2026 (UTC) :I'm not sure the byte-size is necessary, but the outer tag (or first outer tag, though generally I'd prefer most fragments use a wrapper tag if it needs multiple like JSX does, but that's a whole different topic) would be nice. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 12:51, 12 May 2026 (UTC) == Wikifunctions & Abstract Wikipedia Newsletter #248 is out: A higher meaning == There is [[:f:Special:MyLanguage/Wikifunctions:Status updates/2026-05-15|a new update]] for Abstract Wikipedia and Wikifunctions. Please, come and read it! In this issue, we discuss functions creating language fragments, we present our latest news in Types, and we take a look at the latest software developments. Want to catch up with the previous updates? Check [[:f:Special:MyLanguage/Wikifunctions:Status updates|our archive]]! Enjoy the reading! -- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 14:36, 15 May 2026 (UTC) <!-- Message sent by User:Sannita (WMF)@metawiki using the list at https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Wikifunctions_%26_Abstract_Wikipedia&oldid=30536976 --> == [[Z34510]] == This function, which determines if a Wikidata item for a {{q|5}} has an undeprecated {{p|21}} statement of {{q|6581097}}, returns false for {{q|173399}}, a transgender man. This is because his item assigns his P21 statement to {{q|2449503}}, not {{q|6581097}}. I'm not sure how to account for this discrepancy. Should {{z|34510}}: # Include {{q|2449503}} as a value that can lead to a true result, # Not include {{q|2449503}} as a value that can lead to a true result, while another function (e.g., "Q5 is a man?") could return true for either "male" or "trans man", # Not include {{q|2449503}} as a value that can lead to a true result, while another function (e.g., "Q5 is a trans man?") could return true for "trans man", # Not exist at all? [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 16:48, 16 May 2026 (UTC) :I can't think of a single use case where you would need to determine if a person is a cisgender man and nothing else. Functions are good for generalizing across multiple possibilities when they exist, so I think it would be best if trans men were considered a part of the criteria for returning a true value. If asking for specifically {{q|6581097}}s and ''nothing'' else was desired then the function name would be a misnomer as Elliot Page is inarguably a male (at least in the view of most reasonable and intelligent people). &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 19:03, 16 May 2026 (UTC) :You made the function in the first place; what were you planning on using it for? AW? Maybe it should return a {{Z|25501}} which can then be passed on to other NLG functions. [[User:YoshiRulz|YoshiRulz]] ([[User talk:YoshiRulz|talk]]) 20:01, 16 May 2026 (UTC) == Lexeme from wikidata label, or "best" lexeme from wikidata item == I was looking into fixing [[Z28028]]. I found that I could add "requires grammatical feature: definite article" to "United Kingdom" (L8558). Now I'm stuck on how to get to that lexeme from {{Q|145}}. There's [[Z23471]], but that for very good reason gives you multiple lexemes with the same sense, and I just want the best one like how the label is always the best string. Is there a function that can do this? There's definitely the case of a Wikidata label that isn't a lexeme (most commonly multiple lexemes) but I'm only considering the case where it is one lexeme here. [[User:Aaron Liu|Aaron Liu]] ([[User talk:Aaron Liu|talk]]) 20:02, 16 May 2026 (UTC) :There is {{Z|Z27327}}, that tries to give the best lexeme through various heuristics. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 22:22, 16 May 2026 (UTC) :: Wonderful! I did stumble upon [[Z33818]] but this is perfect. [[User:Aaron Liu|Aaron Liu]] ([[User talk:Aaron Liu|talk]]) 00:25, 17 May 2026 (UTC) == [[Z29591]] isn't working for me == For instance, trying to manually put in the exact inputs for one of the test cases just returns an empty Monolingual text. See [https://www.wikifunctions.org/wiki/Z29591?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z29591%22%2C%22Z29591K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q3257809%22%7D%2C%22Z29591K2%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q21264361%22%7D%2C%22Z29591K3%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q22006653%22%7D%2C%22Z29591K4%22%3A%22Z1002%22%7D]. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 01:17, 17 May 2026 (UTC) :You used [[:d:Q22006653]] rather than [[:d:Q1075]]. It looks like the [https://www.wikifunctions.org/wiki/Special:RunFunction?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z30784%22%2C%22Z30784K1%22%3A%7B%22Z1K1%22%3A%22Z11%22%2C%22Z11K1%22%3A%22Z1002%22%2C%22Z11K2%22%3A%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z21394%22%2C%22Z21394K1%22%3A%5B%22Z6%22%2C%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z22664%22%2C%22Z22664K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q22006653%22%7D%2C%22Z22664K2%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q21264361%22%7D%2C%22Z22664K3%22%3A%22Z1002%22%7D%5D%7D%7D%7D explanatory error] is suppressed by the [https://www.wikifunctions.org/view/en/Z30009?call=%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z30009%22%2C%22Z30009K1%22%3A%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z30784%22%2C%22Z30784K1%22%3A%7B%22Z1K1%22%3A%22Z11%22%2C%22Z11K1%22%3A%22Z1002%22%2C%22Z11K2%22%3A%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z21394%22%2C%22Z21394K1%22%3A%5B%22Z6%22%2C%7B%22Z1K1%22%3A%22Z7%22%2C%22Z7K1%22%3A%22Z22664%22%2C%22Z22664K1%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q22006653%22%7D%2C%22Z22664K2%22%3A%7B%22Z1K1%22%3A%22Z6091%22%2C%22Z6091K1%22%3A%22Q21264361%22%7D%2C%22Z22664K3%22%3A%22Z1002%22%7D%5D%7D%7D%7D%2C%22Z30009K2%22%3A%22Z801%22%7D final transformation]. The returned result is not actually empty; if you expand it, you can see that it is an unresolved function call. [[User:GrounderUK|GrounderUK]] ([[User talk:GrounderUK|talk]]) 09:59, 17 May 2026 (UTC) == [[Z35298]] == Does anyone know what the problem with this implementation is? [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 21:14, 18 May 2026 (UTC) :There is a bug that doesn't allow Python implementation to return nested lists. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 05:31, 19 May 2026 (UTC) ::Is there a Phabricator task for this? Searching through them is hell. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 03:22, 20 May 2026 (UTC) :::A bit of time ago I opened [[phab:T392750]], which is very similar to this issue. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 05:26, 20 May 2026 (UTC) fid5obql66txqh2ghb2mt45fibh3l5g Wikifunctions:Requests for deletions 4 1696 276195 276187 2026-05-19T13:26:17Z Ameisenigel 44 /* Z18927 */ withdrawn 276195 wikitext text/x-wiki <noinclude>__NEWSECTIONLINK__ __FORCETOC__</noinclude> Functions or implementations or tests which do not work properly, do not meet notability criteria or are duplicates of another object can be deleted. Please nominate items for deletions under the "Requests for deletion" section below. If it is obvious vandalism, just report it in [[Wikifunctions:Report vandalism]], or ping an [[Special:ListAdmins|administrator]]. Contact can also be made with an administrator on [https://t.me/Wikifunctions Telegram] or IRC [irc://irc.libera.chat/wikipedia-abstract #wikipedia-abstract]. If it is a predefined object (its ZID is less than 10000), please see [[Wikifunctions:Report a technical problem]]. {{Autoarchive resolved section |age = 1 |archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) |level = 2 }} {{Archives|{{Special:PrefixIndex/Wikifunctions:Requests for deletions/Archive/|stripprefix=1}}}} = Requests for deletion = == [[Z18720]] == This kind of function is not supported, at least not in the way as it is currently implemented. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:24, 27 April 2026 (UTC) :CC @[[User:Ioaxxere|Ioaxxere]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 12:27, 28 April 2026 (UTC) :Why isn't it supported? This function would be useful on Wiktionary itself if we could call it from a template. [[User:Ioaxxere|Ioaxxere]] ([[User talk:Ioaxxere|talk]]) 13:47, 28 April 2026 (UTC) ::Web requests are not technically supported, and the Abstract Wikipedia team has no plans to support it. Functions should be deterministic, which means that they cannot rely on web requests. The proper way to do this would be to use the templates feature, you can do something like <nowiki>{{:hello}}</nowiki> to bring the full page hello a function call. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 13:53, 28 April 2026 (UTC) == [[Z18771]] == Duplicate of [[Z10251]]. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 12:51, 3 May 2026 (UTC) :{{s}} deletion, unless {{ping|Jsamwrites}} has a comment to make. This is a relatively old one, but WhatLinksHere shows that nothing uses it. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:44, 3 May 2026 (UTC) :Thanks for pointing this out. However, there are implementations and test cases that cover more interesting use cases. Also added a composition function making use of {{Z|Z10251}} [[User:Jsamwrites|John Samuel]] 17:01, 3 May 2026 (UTC) ::It is possible to move these from the duplicate to the original function. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 17:49, 7 May 2026 (UTC) :::I have moved all the tests and implementations (except the one that is just using the older function) to Z10251. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 09:05, 17 May 2026 (UTC) == [[Z18927]] == Duplicate of [[Z11853]]. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:52, 18 May 2026 (UTC) :cc @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:22, 19 May 2026 (UTC) ::Thanks for pointing this. This has been corrected and used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) :{{withdrawn}} per above --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC) {{Section resolved|1=[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC)}} == [[Z18928]] == Unused string. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:54, 18 May 2026 (UTC) :CC @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:21, 19 May 2026 (UTC) ::Thanks for pointing this. This is now used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) == [[Z18929]] == Unused string. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:54, 18 May 2026 (UTC) :cc @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:22, 19 May 2026 (UTC) ::Thanks for pointing this. This is now used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) n6uff5ic3sby5xe89hgnjd90f1fwm8u 276196 276195 2026-05-19T13:26:41Z Ameisenigel 44 /* Z18928 */ withdrawn 276196 wikitext text/x-wiki <noinclude>__NEWSECTIONLINK__ __FORCETOC__</noinclude> Functions or implementations or tests which do not work properly, do not meet notability criteria or are duplicates of another object can be deleted. Please nominate items for deletions under the "Requests for deletion" section below. If it is obvious vandalism, just report it in [[Wikifunctions:Report vandalism]], or ping an [[Special:ListAdmins|administrator]]. Contact can also be made with an administrator on [https://t.me/Wikifunctions Telegram] or IRC [irc://irc.libera.chat/wikipedia-abstract #wikipedia-abstract]. If it is a predefined object (its ZID is less than 10000), please see [[Wikifunctions:Report a technical problem]]. {{Autoarchive resolved section |age = 1 |archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) |level = 2 }} {{Archives|{{Special:PrefixIndex/Wikifunctions:Requests for deletions/Archive/|stripprefix=1}}}} = Requests for deletion = == [[Z18720]] == This kind of function is not supported, at least not in the way as it is currently implemented. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:24, 27 April 2026 (UTC) :CC @[[User:Ioaxxere|Ioaxxere]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 12:27, 28 April 2026 (UTC) :Why isn't it supported? This function would be useful on Wiktionary itself if we could call it from a template. [[User:Ioaxxere|Ioaxxere]] ([[User talk:Ioaxxere|talk]]) 13:47, 28 April 2026 (UTC) ::Web requests are not technically supported, and the Abstract Wikipedia team has no plans to support it. Functions should be deterministic, which means that they cannot rely on web requests. The proper way to do this would be to use the templates feature, you can do something like <nowiki>{{:hello}}</nowiki> to bring the full page hello a function call. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 13:53, 28 April 2026 (UTC) == [[Z18771]] == Duplicate of [[Z10251]]. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 12:51, 3 May 2026 (UTC) :{{s}} deletion, unless {{ping|Jsamwrites}} has a comment to make. This is a relatively old one, but WhatLinksHere shows that nothing uses it. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:44, 3 May 2026 (UTC) :Thanks for pointing this out. However, there are implementations and test cases that cover more interesting use cases. Also added a composition function making use of {{Z|Z10251}} [[User:Jsamwrites|John Samuel]] 17:01, 3 May 2026 (UTC) ::It is possible to move these from the duplicate to the original function. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 17:49, 7 May 2026 (UTC) :::I have moved all the tests and implementations (except the one that is just using the older function) to Z10251. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 09:05, 17 May 2026 (UTC) == [[Z18927]] == Duplicate of [[Z11853]]. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:52, 18 May 2026 (UTC) :cc @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:22, 19 May 2026 (UTC) ::Thanks for pointing this. This has been corrected and used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) :{{withdrawn}} per above --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC) {{Section resolved|1=[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC)}} == [[Z18928]] == Unused string. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:54, 18 May 2026 (UTC) :CC @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:21, 19 May 2026 (UTC) ::Thanks for pointing this. This is now used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) :{{withdrawn}} per above --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC) {{Section resolved|1=[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC)}} == [[Z18929]] == Unused string. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:54, 18 May 2026 (UTC) :cc @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:22, 19 May 2026 (UTC) ::Thanks for pointing this. This is now used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) 1v966c953y3pb5y3rcb0cdvohx53fpo 276197 276196 2026-05-19T13:27:03Z Ameisenigel 44 /* Z18929 */ withdrawn 276197 wikitext text/x-wiki <noinclude>__NEWSECTIONLINK__ __FORCETOC__</noinclude> Functions or implementations or tests which do not work properly, do not meet notability criteria or are duplicates of another object can be deleted. Please nominate items for deletions under the "Requests for deletion" section below. If it is obvious vandalism, just report it in [[Wikifunctions:Report vandalism]], or ping an [[Special:ListAdmins|administrator]]. Contact can also be made with an administrator on [https://t.me/Wikifunctions Telegram] or IRC [irc://irc.libera.chat/wikipedia-abstract #wikipedia-abstract]. If it is a predefined object (its ZID is less than 10000), please see [[Wikifunctions:Report a technical problem]]. {{Autoarchive resolved section |age = 1 |archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) |level = 2 }} {{Archives|{{Special:PrefixIndex/Wikifunctions:Requests for deletions/Archive/|stripprefix=1}}}} = Requests for deletion = == [[Z18720]] == This kind of function is not supported, at least not in the way as it is currently implemented. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:24, 27 April 2026 (UTC) :CC @[[User:Ioaxxere|Ioaxxere]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 12:27, 28 April 2026 (UTC) :Why isn't it supported? This function would be useful on Wiktionary itself if we could call it from a template. [[User:Ioaxxere|Ioaxxere]] ([[User talk:Ioaxxere|talk]]) 13:47, 28 April 2026 (UTC) ::Web requests are not technically supported, and the Abstract Wikipedia team has no plans to support it. Functions should be deterministic, which means that they cannot rely on web requests. The proper way to do this would be to use the templates feature, you can do something like <nowiki>{{:hello}}</nowiki> to bring the full page hello a function call. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 13:53, 28 April 2026 (UTC) == [[Z18771]] == Duplicate of [[Z10251]]. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 12:51, 3 May 2026 (UTC) :{{s}} deletion, unless {{ping|Jsamwrites}} has a comment to make. This is a relatively old one, but WhatLinksHere shows that nothing uses it. [[User:Feeglgeef|Feeglgeef]] ([[User talk:Feeglgeef|talk]]) 15:44, 3 May 2026 (UTC) :Thanks for pointing this out. However, there are implementations and test cases that cover more interesting use cases. Also added a composition function making use of {{Z|Z10251}} [[User:Jsamwrites|John Samuel]] 17:01, 3 May 2026 (UTC) ::It is possible to move these from the duplicate to the original function. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 17:49, 7 May 2026 (UTC) :::I have moved all the tests and implementations (except the one that is just using the older function) to Z10251. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 09:05, 17 May 2026 (UTC) == [[Z18927]] == Duplicate of [[Z11853]]. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:52, 18 May 2026 (UTC) :cc @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:22, 19 May 2026 (UTC) ::Thanks for pointing this. This has been corrected and used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) :{{withdrawn}} per above --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC) {{Section resolved|1=[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC)}} == [[Z18928]] == Unused string. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:54, 18 May 2026 (UTC) :CC @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:21, 19 May 2026 (UTC) ::Thanks for pointing this. This is now used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) :{{withdrawn}} per above --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC) {{Section resolved|1=[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:26, 19 May 2026 (UTC)}} == [[Z18929]] == Unused string. --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 20:54, 18 May 2026 (UTC) :cc @[[User:Jsamwrites|Jsamwrites]] <span style="font-family:monospace;font-weight:bold">[[User:Bunnypranav|<span style="color:#63b3ed">~/Bunny</span><span style="color:#2c5282">pranav</span>]]:&lt;[[User talk:Bunnypranav|<span style="color:#63b3ed">ping</span>]]&gt;</span> 03:22, 19 May 2026 (UTC) ::Thanks for pointing this. This is now used in a dedicated for detecting basic phrase categories in English ({{Z|Z35352}} and the associated implementation -- {{Z|Z35353}} as well as the tests). [[User:Jsamwrites|John Samuel]] 09:26, 19 May 2026 (UTC) :{{withdrawn}} per above --[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:27, 19 May 2026 (UTC) {{Section resolved|1=[[User:Ameisenigel|Ameisenigel]] ([[User talk:Ameisenigel|talk]]) 13:27, 19 May 2026 (UTC)}} twc5cvbvywd08o6i118lfv85pz8p5x8 Wikifunctions talk:Main Page 5 3346 276191 273229 2026-05-19T12:15:52Z Madhulika Kokate 74948 /* Portable Air Purifier Market */ new section 276191 wikitext text/x-wiki *''This is the place where you can discuss the Main Page.'' ** ''The Main Page can be translated at [[Template:Main page]].'' ** ''The Main Page News can be translated at [[Template:Main page/News]].'' *'''''General project discussion takes place at [[Wikifunctions:Project chat]].''''' {{Autoarchive resolved section |age = 1 |archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) |timeout=30 }} {{Archives|{{Flatlist|{{Special:PrefixIndex/Wikifunctions talk:Main Page/Archive/|stripprefix=1}} }} }} ;Sandbox links: Use the sandboxes for complex edit suggestions. * [[Template:Main page/sandbox]] and [[Template:Main page/sandbox/styles.css]] == Portable Air Purifier Market == The global [https://marketintelo.com/report/portable-air-purifier-market Portable Air Purifier] market is witnessing rapid expansion due to rising urban air pollution, increasing respiratory health concerns, and growing consumer adoption of smart home appliances. The market was valued at approximately USD 10.2 billion in 2023 and is projected to surpass USD 24.8 billion by 2032, growing at a CAGR of 10.4% during 2024–2032. Increasing indoor air quality awareness and rising government initiatives for pollution control continue to accelerate market growth worldwide. [[User:Madhulika Kokate|Madhulika Kokate]] ([[User talk:Madhulika Kokate|talk]]) 12:15, 19 May 2026 (UTC) oky0r8qghmsl85cyvr20qrgzkjnqqkl 276201 276191 2026-05-19T13:30:05Z Ameisenigel 44 Reverted edit by [[Special:Contributions/Madhulika Kokate|Madhulika Kokate]] ([[User talk:Madhulika Kokate|talk]]) to last revision by [[User:Sabelöga|Sabelöga]] 273229 wikitext text/x-wiki *''This is the place where you can discuss the Main Page.'' ** ''The Main Page can be translated at [[Template:Main page]].'' ** ''The Main Page News can be translated at [[Template:Main page/News]].'' *'''''General project discussion takes place at [[Wikifunctions:Project chat]].''''' {{Autoarchive resolved section |age = 1 |archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) |timeout=30 }} {{Archives|{{Flatlist|{{Special:PrefixIndex/Wikifunctions talk:Main Page/Archive/|stripprefix=1}} }} }} ;Sandbox links: Use the sandboxes for complex edit suggestions. * [[Template:Main page/sandbox]] and [[Template:Main page/sandbox/styles.css]] n73gpiwzt4pf9ulylrc3qofw2uh3o11 Template:Mbox 10 3549 276390 189384 2026-05-20T03:08:40Z Theki 2389 add right padding (and increase from 0.9em to 1em), remove left margin 276390 wikitext text/x-wiki <table class="messagebox plainlinks layouttemplate {{{lang|}}} {{{class|}}}" {{#if:{{{lang|}}}|lang="{{{lang}}}" dir="{{dir|{{{lang|}}}}}"}} style="margin:2px {{#if:{{{margin|}}}|{{{margin|}}}|{{#if:{{{width|}}}|auto|0}}}};width:{{#if:{{{width|}}}|{{{width|}}}|auto}};padding-right:0.9em;{{#switch:{{{type|}}} |warning |speedy = border:2px solid #b22222; |serious |delete |stop = border:2px solid #b22222; |issue |content = border:2px solid #f28500;<!--warn--> |query |style = border:2px solid #f4c430;<!--cleanup--> |shit = border:2px solid #960; |license = border:2px solid #88a; |legal = border:2px solid #666; |honor = border:2px solid #ca3; |growth = border:2px solid #8d4;<!--alt--> |move = border:2px solid #93c; |protection |message = border:2px solid #aaa;<!--none--> |notice |#default = border:2px solid #48d;<!--info--> }}{{#switch:{{{type|}}} |warning |speedy = background:var(--background-color-destructive-subtle,#ffe9e5); |#default = background:var(--background-color-base,#fff);}}color:var(--color-base,#222);border-{{Dir|{{{lang|}}}|right|left}}-width:8px;border-collapse:collapse;{{{style|}}}"><tr> {{#ifeq:{{{image|}}}|none | <td class="mbox-empty-cell"></td><!--No image. Cell with some width or padding necessary for text cell to have 100% width.--> | <td class="mbox-image" style="padding-{{Dir|{{{lang|}}}|right|left}}:1em">{{#if:{{{image|}}} | {{{image|}}} | [[File:{{#switch:{{{type|}}} |warning = Commons-emblem-late |speedy = Commons-emblem-urgent |serious |delete = Gnome-emblem-important |stop = Commons-emblem-hand |move = Go-next-purple |issue |content = Commons-emblem-issue |query = Commons-emblem-query |style = Gnome-edit-clear |shit = OpenMoji-color 1F4A9 |license = Commons-emblem-copyright |legal = Commons-emblem-legal |honor = Gnome-help-about |growth = Dialog-apply |protection = Gnome-security-medium |message = Tango-style info icon |notice |#default = Commons-emblem-notice }}.svg|45x45px|class=noviewer|{{#ifeq:{{NAMESPACE}}|Template||link=}}]] }}</td> }}<td class="mbox-text" style="padding-{{dir|{{{lang|}}}|left|right}}:1em;{{#if:{{{textstyle|}}} | {{{textstyle|}}} }}">{{{text|}}}</td>{{#if:{{{imageright|}}} | <td class="mbox-imageright">{{{imageright|}}}</td> }}</tr></table><!-- Most templates made based on this template do not comply with [[Help:Authoring a license-template]] -->{{#ifeq:{{{type|}}}|license|[[Category:Licensing templates based on Mbox]]}}<noinclude> {{Documentation}} </noinclude> 50s8an7u9it8gdwlgs6bmj6cmabkd1o Wikifunctions:Requests for user groups 4 3790 276270 273610 2026-05-19T18:39:14Z Some helpful person 65824 /* Functioneer */ 276270 wikitext text/x-wiki {{shortcut|[[WF:RFG]]|[[WF:PERM]]|[[WF:RFUG]]}} This is the place to request specific user groups: {{ombox | image = [[File:Echo user-rights icon.svg|60x60px|alt=|link=]] | text = '''How to make a request''' # Edit the section for the user group you wish to request # Copy the following and ''append'' it to the text-area: ## Requests without required discussion: <code><nowiki>{{subst:rfg|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> ## Functioneer requests (required 48-hour discussion): <code><nowiki>{{subst:rfg|3=1|length=2 days|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> ## Requests with required 1-week discussion: <code><nowiki>{{subst:rfg|3=1|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> # Replace <code>reason</code> with a rationale based on the guidelines specified for the user group }} : ''Archived requests can be found at [[Wikifunctions:Requests for user groups/Archive]]'' {{Autoarchive resolved section | age = 1 | archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) | level = 3 }} == Functioneer == {{see also|Wikifunctions:Functioneers}} === Some helpful person === Kind of hesitant to ask, but was encouraged to on my talk page and there are some minor things I'd be willing to fix (i.e. connected implementations and test cases that don't do what they're supposed to) if I didn't have to make connection and disconnection requests every time. I will admit I have been somewhat trigger-happy with the Publish button in my edits on Wikimedia projects, but I promise with Functioneer rights I'd be careful about the changes I make and only do good with it. Aside from that I have contributed a couple of pages to Abstract Wikipedia and can adapt quickly to the unique computational problems presented by Wikifunctions. Granted, I do not have a complete understanding of its internals, but it seems easy enough to get the hang of, and I've already created a few new functions. I like niches and filling them... am also good at discerning what's wrong with things... and have been learning how to fill in gaps on Wikidata so related functions will work better. Functioneer rights would be very much appreciated, now or at a later date. Thank you. [[User:Some helpful person|Some helpful person]] ([[User talk:Some helpful person|talk]]) 18:38, 19 May 2026 (UTC) == Autopatroller == {{See also|Wikifunctions:Autopatrollers}} == Administrator == {{see also|Wikifunctions:Administrators}} == Interface administrator == {{see also|Wikifunctions:Interface administrators}} == Translation administrator == {{see also|Wikifunctions:Translation administrators}} == Bureaucrat == {{see also|Wikifunctions:Bureaucrats}} == Miscellaneous requests == == See also == * [[Wikifunctions:User groups]] ** [[mw:Help:Wikifunctions/User rights]] for additional context about functioneers, maintainers, sysops, and bureaucrats [[Category:User groups|*]] 4r9v26dwvy7hbdc0bwlwlbdtl54n9q7 276274 276270 2026-05-19T19:04:02Z JJPMaster 6409 /* Some helpful person */ Reply 276274 wikitext text/x-wiki {{shortcut|[[WF:RFG]]|[[WF:PERM]]|[[WF:RFUG]]}} This is the place to request specific user groups: {{ombox | image = [[File:Echo user-rights icon.svg|60x60px|alt=|link=]] | text = '''How to make a request''' # Edit the section for the user group you wish to request # Copy the following and ''append'' it to the text-area: ## Requests without required discussion: <code><nowiki>{{subst:rfg|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> ## Functioneer requests (required 48-hour discussion): <code><nowiki>{{subst:rfg|3=1|length=2 days|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> ## Requests with required 1-week discussion: <code><nowiki>{{subst:rfg|3=1|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> # Replace <code>reason</code> with a rationale based on the guidelines specified for the user group }} : ''Archived requests can be found at [[Wikifunctions:Requests for user groups/Archive]]'' {{Autoarchive resolved section | age = 1 | archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) | level = 3 }} == Functioneer == {{see also|Wikifunctions:Functioneers}} === Some helpful person === Kind of hesitant to ask, but was encouraged to on my talk page and there are some minor things I'd be willing to fix (i.e. connected implementations and test cases that don't do what they're supposed to) if I didn't have to make connection and disconnection requests every time. I will admit I have been somewhat trigger-happy with the Publish button in my edits on Wikimedia projects, but I promise with Functioneer rights I'd be careful about the changes I make and only do good with it. Aside from that I have contributed a couple of pages to Abstract Wikipedia and can adapt quickly to the unique computational problems presented by Wikifunctions. Granted, I do not have a complete understanding of its internals, but it seems easy enough to get the hang of, and I've already created a few new functions. I like niches and filling them... am also good at discerning what's wrong with things... and have been learning how to fill in gaps on Wikidata so related functions will work better. Functioneer rights would be very much appreciated, now or at a later date. Thank you. [[User:Some helpful person|Some helpful person]] ([[User talk:Some helpful person|talk]]) 18:38, 19 May 2026 (UTC) :{{Support}} No concerns. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 19:04, 19 May 2026 (UTC) == Autopatroller == {{See also|Wikifunctions:Autopatrollers}} == Administrator == {{see also|Wikifunctions:Administrators}} == Interface administrator == {{see also|Wikifunctions:Interface administrators}} == Translation administrator == {{see also|Wikifunctions:Translation administrators}} == Bureaucrat == {{see also|Wikifunctions:Bureaucrats}} == Miscellaneous requests == == See also == * [[Wikifunctions:User groups]] ** [[mw:Help:Wikifunctions/User rights]] for additional context about functioneers, maintainers, sysops, and bureaucrats [[Category:User groups|*]] q0uzpzqm91vbci4dsis3hymg1hrrc56 276276 276274 2026-05-19T19:04:56Z JJPMaster 6409 /* Functioneer */ fix malformed request 276276 wikitext text/x-wiki {{shortcut|[[WF:RFG]]|[[WF:PERM]]|[[WF:RFUG]]}} This is the place to request specific user groups: {{ombox | image = [[File:Echo user-rights icon.svg|60x60px|alt=|link=]] | text = '''How to make a request''' # Edit the section for the user group you wish to request # Copy the following and ''append'' it to the text-area: ## Requests without required discussion: <code><nowiki>{{subst:rfg|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> ## Functioneer requests (required 48-hour discussion): <code><nowiki>{{subst:rfg|3=1|length=2 days|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> ## Requests with required 1-week discussion: <code><nowiki>{{subst:rfg|3=1|1={{subst:REVISIONUSER}}|2=reason ~~~~}}</nowiki></code> # Replace <code>reason</code> with a rationale based on the guidelines specified for the user group }} : ''Archived requests can be found at [[Wikifunctions:Requests for user groups/Archive]]'' {{Autoarchive resolved section | age = 1 | archive = ((FULLPAGENAME))/Archive/((year))/((month:##)) | level = 3 }} == Functioneer == {{see also|Wikifunctions:Functioneers}} === Some helpful person === :{{UL2.0|1=Some helpful person|contributions=1|deletedcontributions=1|editcount=1|blocklog=1|rightslog=1|crosswiki=1}} :Kind of hesitant to ask, but was encouraged to on my talk page and there are some minor things I'd be willing to fix (i.e. connected implementations and test cases that don't do what they're supposed to) if I didn't have to make connection and disconnection requests every time. I will admit I have been somewhat trigger-happy with the Publish button in my edits on Wikimedia projects, but I promise with Functioneer rights I'd be careful about the changes I make and only do good with it. Aside from that I have contributed a couple of pages to Abstract Wikipedia and can adapt quickly to the unique computational problems presented by Wikifunctions. Granted, I do not have a complete understanding of its internals, but it seems easy enough to get the hang of, and I've already created a few new functions. I like niches and filling them... am also good at discerning what's wrong with things... and have been learning how to fill in gaps on Wikidata so related functions will work better. Functioneer rights would be very much appreciated, now or at a later date. Thank you. [[User:Some helpful person|Some helpful person]] ([[User talk:Some helpful person|talk]]) 18:38, 19 May 2026 (UTC) ::{{Support}} No concerns. [[User:JJPMaster|JJP]]<sub>[[User talk:JJPMaster|Mas]]<sub>[[Special:Contributions/JJPMaster|ter]]</sub></sub> ([[wikt:she|she]]/[[wikt:they|they]]) 19:04, 19 May 2026 (UTC) == Autopatroller == {{See also|Wikifunctions:Autopatrollers}} == Administrator == {{see also|Wikifunctions:Administrators}} == Interface administrator == {{see also|Wikifunctions:Interface administrators}} == Translation administrator == {{see also|Wikifunctions:Translation administrators}} == Bureaucrat == {{see also|Wikifunctions:Bureaucrats}} == Miscellaneous requests == == See also == * [[Wikifunctions:User groups]] ** [[mw:Help:Wikifunctions/User rights]] for additional context about functioneers, maintainers, sysops, and bureaucrats [[Category:User groups|*]] euqw0yecjfpaoalyexukav0vr9lo7nl Wikifunctions:How to create implementations/en 4 8925 276446 240249 2026-05-20T06:15:33Z FuzzyBot 207 Updating to match new version of source page 276446 wikitext text/x-wiki <languages/> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. == Types of Implementations == In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' == Practice Test-Driven Development == '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> or ... <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". == Code implementations == [[File:Code implementation.png|thumb|alt=Wikifunctions code editor initialized with a function template|When adding a new code implementation, the function template is initialized with the function and argument names]] When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. === Using input types in your code === Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. === Returning the right outputs === Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> Or in JavaScript: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} {{phab|T392750}}As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. === Code in Python === In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Since this is Python, do not forget to indent this line. If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. === Code in JavaScript === In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. == Compositions == In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> There are multiple ways to write a composition: notice that the same thing could be accomplished with: <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. In order to create this: # Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page. # Make sure that the option "composition" under "Implementation" is selected. # Click on the "›" icon or click the "Select Function" link to expand the function details. # Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list. # You will see two new fields, one for each of the arguments needed for the selected function. # For the first argument, we want to select the first input to our function: ## Next to "first string", click on the "…" button and select "Argument reference". ## Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs. # For the second argument, we want to use the result of another call to "join two strings": ## Next to "second string", click on the "…" button and select "Function call". ## Under "function", search and select the function you want to call, which is again "join two strings". ## For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown. Your composition is now complete! You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. [[File:Composition implementation expanded.png|frame|center|alt=A Wikifunctions composition implementation in its expanded view|A Wikifunctions composition implementation in its expanded view]] [[File:Composition implementation collapsed.png|frame|center|alt=A Wikifunctions composition implementation in its collapsed view|A Wikifunctions composition implementation in its collapsed view]] == Wikifunctions error handling == As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. In this section you will learn: * How to throw errors from both code and composition implementations, * how to write tests for error cases, and * how to catch and handle errors thrown by functions that you are using in your compositions. === Throwing errors from code implementations === When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. <code>Wikifunctions.Error()</code> has two parameters: # Error type: a string containing the ZID of the error type you want to return. # Error arguments: a list of string arguments to build the error. Let's go one by one: ==== Error type ==== An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: [[File:Error type.png|thumb|alt=Error type creation in Wikifunctions|To create new Error type (Z50), edit the label and add the necessary keys.]] * '''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About". * '''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object. ==== Error arguments ==== Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. ==== Using Wikifunctions.Error() ==== Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: * Input key: contains the key of the failing input * Input value: contains the current value of the failing input To raise an error in your JavaScript implementation you should do something like this: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> To raise an error in your Python implementation you should do something like this: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! === Throwing errors from compositions === If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. ==== Throw Error function (Z851) ==== The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: * '''Error type''' – A reference to the Error type you want to raise * '''Error parameters''' – A list with the arguments to create your Error, which should also be Strings. ==== Using Throw Error ==== Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: * If the first argument is empty, throw an error for the first argument * Else, proceed to check the second argument * If the second argument is empty, throw an error for the second argument * Else, proceed with the success path and return the joint strings with the space separator Or in functional pseudo code: <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> Let's create this step by step: # Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page. # Make sure that the option "composition" under "Implementation" is selected. # Click on the "›” icon or click the "Select Function" link to expand the function details. # Under "function" search and select the outermost function you want to use, which in this case is "if". # Check the validity of the first argument: ## Next to "condition", click on the "…" button and select "function call" ## Under "function", search and select the function "is empty string" ## Next to "input", click on the "…" button and select "argument reference" ## Under "key id", select the first input (e.g. "first string") ## You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )" # Throw error if the condition is true: ## Next to "then", click on the "…" button and select "function call" ## Under "function", search and select the function "Throw Error" ## Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005) ## Under "error parameters", add two items by clicking on the "+" button ## For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1") ## For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference" ## Under "key id", select the first input (e.g. "first string") ## You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )" # Continue to check the second argument if the first was good: ## Next to "else", click on the "…" button and select "function call" ## Under "function", search and select the function "if" ## Set up "condition" to check the validity of the second argument by following the same process as described in step 5. ## Set up "then" to throw an error for the second argument by following the same process as described in step 6. # Finally, set up the success path: ## Next to the nested "else", click on the "…" button and select "function call" ## Under "function", search and select the successful function, which in this case can be "join strings with separator" ## Next to "first string", click on the "…" button and set it to "argument reference", then select "first string" ## Next to "second string", click on the "…" button and set it to "argument reference", then select "second string" ## Under "separator" add a space into the text field The resulting function call should look like this: [[File:Throw error expanded.png|frame|center|alt=Wikifunctions composition using Throw Error function|Wikifunctions composition using Throw Error function]] [[File:Throw error collapsed.png|frame|center|alt=Wikifunctions composition using Throw Error function, in its collapsed view|Wikifunctions composition using Throw Error function, in its collapsed view]] === Handling errors in compositions === While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. ==== Try-Catch function (Z850) ==== The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: * '''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call. * '''Error type''' – An error type to catch in case it is thrown during the execution of the first function call. * '''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned. ==== Using Try-Catch ==== Once we have all the functions for our composition, we can craft it like this: <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> This means that: * The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned * If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code> * Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown" Let's create this step by step: # Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page. # Make sure that the option "composition" under "Implementation" is selected. # Click on the "›” icon or click the "Select Function" link to expand the function details. # Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch". # Set the main function call: ## Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call" ## Under "function" search and select the function "join two strings with space" ## Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown. ## Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown. # Select the error to catch: ## Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code> # Set the error handler function call: ## Next to "error handler", click on the "…" button and select "function call" ## Under "function", search and select the function "echo" ## Under "input" and "type", search and select the type "String" ## Now, under "input", type "Unknown" in the text field The resulting function should look like this: [[File:Try catch expanded.png|frame|center|alt=Wikifunctions composition using Try-catch function, in expanded mode|Wikifunctions composition using Try-catch function, in expanded mode]] [[File:Try catch collapsed.png|frame|center|alt=Wikifunctions composition using Try-catch function, in collapsed mode|Wikifunctions composition using Try-catch function, in collapsed mode]] === Testing your failure use cases === As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. To do that, you will need other two system functions: ==== Is error type (Z852) ==== The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: * '''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value. * '''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true. ==== Get error thrown by function call (Z853) ==== The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: * '''Function call''' – A function call which can either return a successful value of any type, or throw an error. This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: * If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second. * If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second. To use this function in your compositions, you might need to use the additional functions: * {{Z|Z821}}, and * {{Z|Z822}} ==== Testing errors ==== Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: * Throw a failing function call * Get the error using the function {{Z|Z853}} * Check that the error is the right type with {{Z|Z852}} Tests have two fields: * '''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value. * '''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call. For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. In our example, we can structure it like this — but this is not the only way! The call, which will return an {{Z|Z5}} object: <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> And the result validation, which will take the {{Z|Z5}} object as its first argument: <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> Let's do this step by step: # Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them. # First, let's set the call: ## Under "call", click the "›" chevron button to expand the function call. ## Under "function", edit the field and search and select the function "Get second element of a typed pair" ## Once selected, next to "Typed pair", click on the "…" button and select "function call" ## Under "function", search and select the function "Get error thrown by function call" ## Next to "function call", click on the "…" button and select "function call" ## Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>) ## Now set the inputs so that they cause a failure: at least one of them should be empty. ## You can now collapse your "call" by clicking again on the down-chevron button if you want! # Next, let's set the result validation: ## Under "result validation", click the "›" chevron button to expand the function call. ## Under "function", edit the field and search and select the function "Is error type" ## Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type. # And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks. If everything went right, you can now save your test. It should look like this: [[File:Get error expanded.png|frame|center|alt=Testing a failure using Get error and Is error type functions, in expanded mode|Testing a failure using Get error and Is error type functions, in expanded mode]] [[File:Get error collapsed.png|frame|center|alt=Testing a failure using Get error and Is error type functions, in collapsed mode|Testing a failure using Get error and Is error type functions, in collapsed mode]] == Debugging your implementations == Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. In this section you will learn: * How to add debug messages from both code and composition implementations, * how to inspect the metadata manually or via the UI to inspect these logs. === Debugging your code implementations === When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> And the same in your Python3 implementation will be: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> This way, no matter what happens, we will be adding one message to your debugging logs: * If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure. * If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log. === Debugging your compositions === To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. ==== Add debug log to function call (Z854) ==== The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: * '''Function call''' – Any composition you want to execute. * '''Debug log''' – A string message that will be recorded if the given function call is evaluated. When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. You will benefit from this built-in if you want to observe: * Which branch of a conditional was executed, or * the order of evaluation in a composition. ==== Using Add debug log to function call ==== Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> This way, * when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log. * When called with an empty second input, the call will also fail, but the logged message will be "failed on second input" * When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key. This is the way this composition would look: [[File:Add debug log expanded.png|frame|center|alt=Composition implementation using Add debug logs to log all possible execution paths|Composition implementation using Add debug logs to log all possible execution paths]] === Accessing execution debug logs === Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. The error and debug information will appear at the top of the "Details" dialog. This is what you would see when running the composition from our previous example with valid and invalid inputs: {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=Function metadata dialog for a successful execution with debug logs]] | [[File:Execution logs failure.png|frameless|center|alt=Function metadata dialog for a failed execution with debug logs]] |- | Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"'' | Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"'' |} [[Category:How to create implementations| {{#translation:}}]] jsw8z4o9fmvsr495ba9aa7nq4pl9jjc Wikifunctions:How to create implementations/de 4 9282 276447 240248 2026-05-20T06:15:33Z FuzzyBot 207 Updating to match new version of source page 276447 wikitext text/x-wiki <languages/> Diese Seite bietet eine detailliertere Anleitung dafür, wie man '''Implementierungen erstellt''' und geht über den Überblick auf {{ll|Wikifunctions:Introduction}} hinaus. <span id="Types_of_Implementations"></span> == Arten von Implementierungen == In Wikifunctions kann eine '''Implementierung''' zwei Hauptformen annehmen: '''Code''' oder '''Komposition'''. Eine Code-Implementierung drückt die Logik der Funktion direkt in einer der verfügbaren Programmiersprachen aus (derzeit Python3 oder JavaScript). Sie ist besonders nützlich, wenn sich das Verhalten der Funktion nicht ohne Weiteres aus bestehenden Wikifunktionen ableiten lässt oder wenn eine präzise Kontrolle über die Datenverarbeitung erforderlich ist. Eine Kompositions-Implementierung definiert die Funktion hingegen vollständig durch die Kombination bestehender Funktionen, ohne dass Code geschrieben werden muss. Kompositionen sind leichter verständlich, wiederverwendbar und lassen sich automatisch in andere Sprachen übersetzen. Sie setzen jedoch voraus, dass geeignete Bausteine ​​bereits vorhanden sind und sind oft weniger leistungsfähig. Prüfe daher zunächst, ob dein Ziel durch Komposition erreicht werden kann. Ist dies nicht möglich oder spielen Leistung oder feingranulare Logik eine Rolle, wähle stattdessen eine Code-Implementierung. Es gibt eine dritte Implementierungsart: '''integrierte Implementierungen'''. Diese werden vom Systemcode ausgeführt und können nicht bearbeitet werden. Höchstwahrscheinlich verfügen alle vordefinierten Funktionen über eine integrierte Implementierung. In solchen Fällen wird beim Öffnen der Implementierungsseite die Meldung ''"{{int|wikilambda-implementation-selector-none}}"'' angezeigt. <span id="Practice_Test-Driven_Development"></span> == Praxis der testgetriebenen Entwicklung == '''Testgetriebene Entwicklung''' oder '''TDD''' ist eine Methode zur Softwareentwicklung, bei der Tests geschrieben werden, bevor der eigentliche Code geschrieben wird. Tests dienen dazu, die Funktionsweise einer Funktion anhand von Beispielen und deren Funktionsweise zu verstehen. In Wikifunctions bietet das Schreiben von Tests als erste Tätigkeit erhebliche Vorteile. Wenn du an einer Implementierung arbeitest, kannst du deinen Code anhand der vorhandenen Tests ausführen, um sicherzustellen, dass er sich wie erwartet verhält. Dadurch lassen sich Fehler frühzeitig erkennen, noch bevor du deine Implementierung veröffentlichst. Tests sind außerdem ein effektives Mittel, um die benötigte Funktion zu beschreiben. Durch das Schreiben von Tests '''kommunizierst du klar das erwartete Verhalten''' und die Community kann bei der Implementierung helfen oder alternative Implementierungen erstellen. Stell dir vor, du möchtest eine Funktion implementieren, die zwei Zeichenketten mit einem Leerzeichen dazwischen verknüpft. Ein einfacher Test dafür könnte so aussehen: <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> Sobald du das grundlegende Verhalten definiert hast, ist es wichtig, auch '''an Randfälle zu denken''' — Situationen, in denen die Eingaben so beschaffen sind, dass ein spezielles Verhalten erforderlich sein könnte. Was passiert beispielsweise, wenn deine erste Zeichenkette mit einem Leerzeichen endet oder deine zweite mit einem Leerzeichen beginnt? Soll die Funktion alle vorhandenen Leerzeichen beibehalten und ein weiteres hinzufügen oder ein sauber formatiertes Ergebnis mit nur einem Leerzeichen zwischen den Wörtern zurückgeben? Je nach deinen Anforderungen solltest du einen Test für einen solchen Fall erstellen. Ein Test für diesen Sonderfall könnte beispielsweise einer der folgenden sein — aber nicht beide!: <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> oder ... <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> Stell sicher, dass deine Tests alle möglichen Sonderfälle abdecken, und sobald du diese hast, stell sicher, dass sie alle mit der Funktion verbunden sind, indem du sie auswählst und auf "Verbinden" klickst. <span id="Code_implementations"></span> == Code-Implementierungen == [[File:Code implementation.png|thumb|alt=Wikifunctions-Code-Editor, der mit einer Funktionsvorlage initialisiert wurde|Beim Hinzufügen einer neuen Code-Implementierung wird die Funktionsvorlage mit den Funktions- und Argumentnamen initialisiert]] Beim Erstellen einer Implementierung mit Code richtet die Wikifunctions-Benutzeroberfläche einen Code-Editor ein, in dem die ausgewählte Sprache für Syntaxhervorhebung und -validierung aktiviert ist. Sobald die zu implementierende Funktion und die Programmiersprache ausgewählt sind, wird dieser Editor mit der korrekten Funktionsvorlage konfiguriert: '''Entferne oder bearbeite sie nicht!''' Platziere deinen Code innerhalb dieser Funktionssignatur. Falls du Hilfsfunktionen benötigst, kannst du diese einfach in deiner Hauptfunktionsdeklaration deklarieren. <span id="Using_input_types_in_your_code"></span> === Verwendung von Eingabetypen in deinem Code === Die Wikifunctions-Typen {{Z|Z6}} und {{Z|Z40}} können in JavaScript und Python3 wie native Typen verwendet werden. Beispielsweise lässt sich eine Zeichenkette verketten oder ein boolescher Wert direkt in einem logischen Ausdruck verwenden. Um andere Typen in deinen Code-Implementierungen zu verwenden, musst du den jeweiligen Typ genauer untersuchen, herausfinden, ob eine Umwandlung in ein natives Äquivalent existiert, und ihn entsprechend behandeln. Nehmen wir beispielsweise an, wir möchten Python-Code schreiben, der eine Eingabe vom Typ {{Z|Z20420}} verarbeitet. Auf der Seite für diesen Typ sehen wir uns die "Typumwandler in Code" an und suchen nach einem Python-Umwandler. Der Umwandler {{Z|Z20424}} wird auf unsere Datumseingabe angewendet, bevor unser Code ausgeführt wird. Unter "nativer Typ" sehen wir, dass unsere Eingabe ein Python-Dictionary ist, und in der Implementierung können wir die zu erwartenden Schlüssel sehen: <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> Wenn ein Typ keinen Umwandler besitzt, musst du direkt über seine Schlüssel auf seine Bestandteile zugreifen. Nehmen wir beispielsweise an, deine Funktion <code>Z30000</code> hat einen Eingabeparameter <code>Z30000K1</code> vom Typ {{Z|Z11}}. Dieser Typ besitzt zwei Schlüssel: <code>Z11K1</code> für die Sprache (selbst ein Objekt vom Typ {{Z|Z60}}) und <code>Z11K2</code> für den Zeichenketten-Wert. Das Sprachobjekt hat wiederum einen Schlüssel <code>Z60K1</code> für den Sprachcode. Um also eine Zeichenkette mit dem Sprachcode und dem Text zu erhalten, kannst du folgendes schreiben: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // z. B. "de: beliebiger Text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> Für eine Kurzübersicht der verfügbaren Typumwandlungen besuche [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|die Tabelle der Standard-Typumwandlungen]]. <span id="Returning_the_right_outputs"></span> === Rückgabe der richtigen Ausgaben === Ähnlich wie bei der Behandlung von Eingaben müssen auch Ausgaben dem in der Funktionsdefinition angegebenen Typ entsprechen. Einige können wie native Typen behandelt werden; daher wird jede Zeichenketten-Ausgabe in ein Wikifunctions-Objekt {{Z|Z6}} und jeder von deiner Implementierung zurückgegebene native boolesche Wert in ein Wikifunctions-Objekt {{Z|Z40}} umgewandelt. Typen mit "Typumwandlern aus Code" wenden die entsprechende Funktion auf die Ausgabe an, um den benötigten Typ zu erzeugen. Am Beispiel von {{Z|Z20420}} transformiert {{Z|Z20443}} die Ausgabe deiner Implementierung – ein Dictionary mit den Schlüsseln K1, K2 und K3 – in die korrekte ZObjekt-Darstellung. Für Typen, die keine Umwandler aus Code haben, kannst du die Ausgabeobjekte sorgfältig erstellen und zurückgeben. Stell dir beispielsweise vor, unsere Funktion <code>Z30000</code> nimmt zwei Zeichenketten als Eingaben entgegen: Sprachcode und Text, und soll ein Objekt {{Z|Z11}} zurückgeben. In Python kannst du dies mit dem Konstruktor <code>ZObject</code> erreichen: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> Oder in JavaScript: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> Du kannst mehr über die Klasse <code>ZObject</code> und andere nützliche Konstruktoren auf {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} erfahren. {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> === Code in Python === In diesem Abschnitt geben wir ein konkretes Beispiel, wie man eine Implementierung in Form von Code in Python erstellt. Angenommen, wir möchten eine Implementierung für eine Funktion erstellen, die zwei Eingabezeichenketten durch Einfügen eines Leerzeichens dazwischen kombiniert und das Ergebnis zurückgibt. Nehmen wir an, die ZID dieser Funktion ist Z30000. Die Implementierung wird über die ZID der Funktion definiert. Das gilt auch für die Argumente der Funktion. Im Fall der Funktion Z30000 mit ihren beiden Argumenten sollte die Funktionsvorlage also so aussehen: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> Wie bereits erwähnt, wissen wir, dass die Argumente (<code>Z30000K1</code> und <code>Z30000K2</code>) Zeichenketten sind, daher können wir sie genauso behandeln wie native Zeichenketten in Python. Die Funktion sollte außerdem eine Zeichenkette zurückgeben. In unserem Beispiel geben wir einfach die beiden Argumente, getrennt durch ein Leerzeichen, aneinandergereiht zurück: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Da es sich um Python handelt, vergesse nicht, diese Zeile einzurücken. Wenn du unserem Rat gefolgt bist, [[#Practice Test-Driven Development|TDD anzuwenden]], verfügst du bereits über eine Reihe von Tests, von denen du weißt, dass sie funktionieren sollten. In diesem Fall kannst du während der Entwicklung deiner Implementierung auf den kreisförmigen Pfeil im Testbereich klicken und überprüfen, ob deine Implementierung alle Tests besteht. Denke daran, dass die Laufzeit keinen Status hat. Gehe nicht von Werten für globale oder statische Variablen aus. Wenn du weitere Fragen dazu hast, was du in Python tun kannst und was nicht, frage auf [[Wikifunctions:Python implementations]]. === Code in JavaScript === In diesem Abschnitt geben wir ein konkretes Beispiel, wie man eine Implementierung in Form von Code in JavaScript erstellt. Angenommen, wir möchten eine Implementierung für eine Funktion erstellen, die zwei Eingabezeichenketten durch Einfügen eines Leerzeichens dazwischen kombiniert und das Ergebnis zurückgibt. Nehmen wir an, die ZID dieser Funktion ist <code>Z30000</code>. Die Implementierung wird über die ZID der Funktion definiert. Das gilt auch für die Argumente der Funktion. Im Fall der Funktion <code>Z30000</code> mit ihren beiden Argumenten sollte die Funktionsvorlage also so aussehen: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> Wir wissen, dass die Argumente (<code>Z30000K1</code> und <code>Z30000K2</code>) Zeichenketten sind, daher können wir sie in JavaScript wie native Zeichenketten behandeln. Die Funktion soll außerdem eine Zeichenkette zurückgeben. Um die Funktion zu vervollständigen, kannst du eine Zeile hinzufügen, die die Eingabezeichenketten verkettet, etwa so: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> Wenn du Tests wie im Abschnitt [[#Practice Test-Driven Development|TDD]] oben empfohlen hast, klicke auf den kreisförmigen Pfeil im Testbereich und prüfe, ob deine Implementierung alle Tests besteht. Denke daran, dass die Laufzeit keinen Status hat. Gehe nicht von Werten für globale oder statische Variablen aus. Wenn du weitere Fragen dazu hast, was du in JavaScript tun kannst und was nicht, frage auf [[Wikifunctions:JavaScript implementations]]. <span id="Compositions"></span> == Kompositionen == Im diesem Abschnitt geben wir ein konkretes Beispiel, wie man eine Implementierung in Form einer Komposition erstellt. Angenommen, wir möchten eine Implementierung für eine Funktion erstellen, die zwei Eingabezeichenketten durch Einfügen eines Leerzeichens dazwischen kombiniert und das Ergebnis zurückgibt. Nehmen wir an, die ZID dieser Funktion ist <code>Z30000</code>. Normalerweise ist es sinnvoll, zunächst darüber nachzudenken, wie man vorhandene Funktionen kombinieren kann, um die gewünschte Ausgabe zu erzielen. Manchmal mag dies trivial sein und du kannst einfach mit dem Zusammenstellen und Funktionen fortfahren, aber in vielen Fällen lohnt es sich, die gewünschte Komposition zu notieren. Beispielsweise könnten wir für die angegebene Funktion die vorhandene Funktion {{Z|Z10000}} verwenden. Diese Funktion nimmt zwei Zeichenketten und erstellt daraus eine Zeichenkette. Aber wir müssen dazwischen ein Leerzeichen einfügen. Wir verbinden also zunächst ein Leerzeichen mit dem Ende der ersten Zeichenkette und verbinden dann die zweite Zeichenfolge mit dem Ergebnis dieser ersten Verbindung. Unsere Komposition könnte also so notiert werden: <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> Es gibt mehrere Möglichkeiten, eine Komposition zu schreiben: Beachte, dass dasselbe auch auf folgende Weise erreicht werden kann: <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> Eine alternative Implementierung könnte auch die vorhandene Funktion {{Z|Z15175}} verwenden, sodass deine Komposition wie folgt aussehen könnte: <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> Wie du siehst, gibt es mehrere Möglichkeiten, dies zu erreichen. Nimm dir also Zeit und erkunde die vorhandenen Funktionen, die im {{ll|Wikifunctions:Catalogue}} verfügbar sind. Versuchen wir, das zweite Beispiel zu erstellen, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. Um dies zu erstellen: # Um eine Implementierung hinzuzufügen, klicke auf der Funktionsseite in der Tabelle "Implementierungen" auf die Schaltfläche "+". # Stelle sicher, dass die Option "Komposition" unter "Implementierung" ausgewählt ist. # Klicke auf das Symbol "›" oder auf den Link "Funktion auswählen", um die Funktionsdetails anzuzeigen. # Suche unter "Funktion" nach dem Namen der äußersten Funktion, die du verwenden möchtest, in diesem Beispiel "verbinde Zeichenketten". Wähle anschließend die gewünschte Funktion aus der Dropdown-Liste aus. # Du siehst zwei neue Felder, eines für jedes der Argumente, die für die ausgewählte Funktion benötigt werden. # Als erstes Argument möchten wir den ersten Eingabewert für unsere Funktion auswählen: ## Klicke neben "erste Zeichenkette" auf die Schaltfläche "…" und wähle "Argumentreferenz" aus. ## Unter "Schlüssel-ID" kannst du nun die erste Zeichenkette deiner Funktion aus dem Dropdown-Menü auswählen, das alle verfügbaren Eingaben enthält. # Für das zweite Argument möchten wir das Ergebnis eines weiteren Aufrufs von "verbinde Zeichenketten" verwenden: ## Klicke neben "zweite Zeichenkette" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus. ## Suche unter "Funktion" nach der Funktion, die du aufrufen möchtest und wähle sie aus, nämlich "verbinde Zeichenketten". ## Konfiguriere die "erste Zeichenkette" für diesen inneren Funktionsaufruf, indem du einfach ein Leerzeichen in das Textfeld eingibst, und konfiguriere die "zweite Zeichenkette" wie in Schritt 6: Ändere sie mit der Schaltfläche "…" in "Argumentreferenz" und wähle dann das zweite Argument in der Dropdown-Liste aus. Deine Komposition ist nun fertig! Du kannst die Details mithilfe der Pfeiltasten ein- und ausblenden, um dir einen Überblick zu verschaffen. Falls du bereits Tests wie im Abschnitt [[#Practice Test-Driven Development|TDD]] oben empfohlen implementiert hast, klicke im Testbereich auf den kreisförmigen Pfeil und prüfe, ob deine Implementierung die Tests besteht. Sobald deine Komposition die Tests bestanden hat, kannst du sie veröffentlichen. [[File:Composition implementation expanded.png|frame|center|alt=Eine Wikifunctions-Kompositionsimplementierung in ihrer erweiterten Ansicht|Eine Wikifunctions-Kompositionsimplementierung in ihrer erweiterten Ansicht]] [[File:Composition implementation collapsed.png|frame|center|alt=Eine Wikifunctions-Kompositionsimplementierung in ihrer reduzierten Ansicht|Eine Wikifunctions-Kompositionsimplementierung in ihrer reduzierten Ansicht]] <span id="Wikifunctions_error_handling"></span> == Fehlerbehandlung auf Wikifunctions == Als Ersteller einer Wikifunctions-Funktion möchtest du möglicherweise den Benutzer warnen, der deine Funktion aufruft, wenn im Code ein Fehler auftritt oder seine Eingaben bestimmte Kriterien nicht erfüllen. Wenn deine Funktion beispielsweise eine Zeichenkette mit einem Namen erwartet, solltest du prüfen, ob der Name nicht leer ist, und gegebenenfalls eine verständliche Fehlermeldung anzeigen. Hierfür kannst du <code>Wikifunctions.Error()</code> in deinen Code-Implementierungen oder die Funktion {{Z|Z851}} in deinen Kompositionen verwenden. In diesem Abschnitt erfährst du: * Wie man Fehler sowohl aus Code- als auch aus Kompositions-Implementierungen auslöst, * wie man Tests für Fehlerfälle schreibt, und * wie man Fehler abfängt und behandelt, die von Funktionen ausgelöst werden, die man in seinen Kompositionen verwendet. <span id="Throwing_errors_from_code_implementations"></span> === Fehler aus Code-Implementierungen auslösen === Sowohl beim Schreiben von JavaScript- als auch von Python-Code kannst du <code>Wikifunctions.Error()</code> nutzen, um die Ausführung mit einem gewünschten Fehler zu beenden. <code>Wikifunctions.Error()</code> hat zwei Parameter: # Fehlertyp: Eine Zeichenkette, die die ZID des Fehlertyps enthält, den du zurückgeben möchtest. # Fehlerargumente: Eine Liste von Zeichenkettenargumenten zur Erstellung des Fehlers. Gehen wir sie der Reihe nach durch: <span id="Error_type"></span> ==== Fehlertyp ==== Ein Fehlertyp ist ein Objekt, das eine Art von Fehler beschreibt, der im System auftreten kann. Es gibt eine Reihe vordefinierter Fehlertypen, du kannst aber auch eigene Fehlertypen erstellen, die besser zu deinem Anwendungsfall passen. Bei der Verwendung von Fehlern empfiehlt es sich, die verfügbaren Fehlertypen zu durchsuchen, die sich in [[Special:ListObjectsByType/Z50|dieser Liste]] finden. Falls keine passenden Fehler für deinen Fall vorhanden sind, erstelle einen neuen Fehler, indem du zur Erstellungsseite gehst und im Typauswahlfeld "Fehlertyp" auswählst. Lege anschließend die erforderlichen Felder fest: [[File:Error type.png|thumb|alt=Erstellung von Fehlertypen in Wikifunctions|Um einen neuen Fehlertyp (Z50) zu erstellen, bearbeite die Bezeichnung und füge die erforderlichen Schlüssel hinzu.]] * '''Bezeichnung''' – Dies ist der Haupttitel des Fehlers, der eine kurze, aber aussagekräftige Meldung enthalten sollte. Lege die Fehlerbezeichnung im rechten Feld mit dem Titel "Info" fest. * '''Schlüssel''' – Schlüssel enthalten zusätzliche Informationen zur Fehlerursache. Wenn beispielsweise eine Eingabe das falsche Format aufwies, möchtest du den Benutzer möglicherweise über den eingegebenen Inhalt informieren, wenn der Fehler auftritt. Um sie in deinen Implementierungen zu verwenden, müssen Schlüssel vom Zeichenketten sein. Um einen Schlüssel zu erstellen, klicke auf das Symbol "[+]" unterhalb von "Schlüssel", wähle unter "Werttyp" die Option "Zeichenkette" aus und füge eine aussagekräftige Bezeichnung hinzu, beispielsweise "tatsächlich Eingabe". Sobald du alle erforderlichen Schlüssel erstellt hast, kannst du deinen Fehlertyp veröffentlichen und die ID des neu erstellten Objekts speichern. <span id="Error_arguments"></span> ==== Fehlerargumente ==== Fehlerargumente entsprechen den Schlüsseln des Fehlertyps und sollten zusätzliche Informationen zum Verständnis des Fehlers liefern. Fehlerargumente sollten immer Zeichenketten sein. <span id="Using_Wikifunctions.Error()"></span> ==== Verwendung von Wikifunctions.Error() ==== Angenommen, du möchtest einen Fehler auslösen, wenn entweder deine erste oder deine zweite Eingabe leer ist. Du hast den Fehlertyp bereits erstellt und ihm wurde die ZID <code>Z30005</code> zugewiesen. Dein Fehlertyp hat zwei Zeichenketten-Schlüssel: * Eingabeschlüssel: Enthält den Schlüssel der fehlerhaften Eingabe * Eingabewert: Enthält den aktuellen Wert der fehlerhaften Eingabe Um einen Fehler in deiner JavaScript-Implementierung auszulösen, solltest du etwa Folgendes tun: <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // Wenn die erste Eingabe leer ist, löse Fehler Z30005 aus // mit zwei Zeichenketten-Argumenten: [ erster Eingabe-Schlüssel, erster Eingabe-Wert ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // Wenn die zweite Eingabe leer ist, löse Fehler Z30005 aus // mit zwei Zeichenketten-Argumenten: [ zweiter Eingabe-Schlüssel, zweiter Eingabe-Wert ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> Um einen Fehler in deiner Python-Implementierung auszulösen, solltest du etwa Folgendes tun: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # Wenn die erste Eingabe leer ist, löse Fehler Z30005 aus # mit zwei Zeichenketten-Argumenten: [ erster Eingabe-Schlüssel, erster Eingabe-Wert ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # Wenn die zweite Eingabe leer ist, löse Fehler Z30005 aus # mit zwei Zeichenketten-Argumenten: [ erster Eingabe-Schlüssel, erster Eingabe-Wert ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Denke daran, dass der Aufruf von <code>Wikifunctions.Error()</code> die Ausführung beendet! <span id="Throwing_errors_from_compositions"></span> === Fehler aus Kompositionen auslösen === Wenn du eine Kompositionsimplementierung erstellst, kannst du einen Fehler auslösen, indem du die Spezialfunktion {{Z|Z851}} aufrufst. <span id="Throw_Error_function_(Z851)"></span> ==== Funktion Fehler auslösen (Z851) ==== Die Funktion {{Z|Z851}} ähnelt der Methode <code>Wikifunctions.Error()</code> und benötigt zwei Argumente: * '''Fehlertyp''' – Ein Verweis auf den Fehlertyp, den du auslösen möchtest * '''Fehlerparameter''' – Eine Liste mit den Argumenten zur Erstellung deines Fehlers, die ebenfalls Zeichenketten sein sollten. <span id="Using_Throw_Error"></span> ==== Verwendung von Fehler auslösen ==== Angenommen, du möchtest deine Komposition so ändern, dass sie zuerst prüft, ob die Argumente nicht leer sind, und einen Fehler ausgibt, wenn sie ein leeres Argument findet. Wenn dann keines der Argumente leer ist, wird die ursprüngliche Komposition ausgeführt, die wie folgt aussieht: <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> Dazu musst du bedingte Pfade erstellen, für die du die Funktion {{Z|Z802}} verwenden kannst. Stell es dir folgendermaßen vor: * Wenn das erste Argument leer ist, soll ein Fehler für das erste Argument ausgelöst werden * Andernfalls wird mit der Überprüfung des zweiten Arguments fortgefahren * Wenn das zweite Argument leer ist, soll ein Fehler für das zweite Argument ausgelöst werden * Andernfalls wird der Erfolgspfad verfolgt und die verbundenen Zeichenketten mit dem Leerzeichen als Trennzeichen zurückgegeben Oder in funktionalem Pseudocode: <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> Lass uns das Schritt für Schritt erstellen: # Um eine Implementierung hinzuzufügen, klicke auf der Funktionsseite in der Tabelle "Implementierungen" auf die Schaltfläche "+". # Stelle sicher, dass die Option "Komposition" unter "Implementierung" ausgewählt ist. # Klicke auf das Symbol "›" oder auf den Link "Funktion auswählen", um die Funktionsdetails anzuzeigen. # Suche unter "Funktion" nach der äußersten Funktion, die du verwenden möchtest, in diesem Fall "wenn", und wähle sie aus. # Überprüfe die Gültigkeit des ersten Arguments: ## Klicke neben "Bedingung" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der Funktion "ist leere Zeichenkette" und wähle sie aus ## Klicke neben "Eingabe" auf die Schaltfläche "…" und wähle "Argumentreferenz" aus ## Wähle unter "Schlüssel-ID" die erste Eingabe aus (z. B. "erste Zeichenkette") ## Du kannst den Funktionsaufruf der "Bedingung" nun bei Bedarf ausblenden, indem du auf den Pfeil nach unten neben "Bedingung" klickst. Es sollte dann etwa Folgendes angezeigt werden: "f(x) ist leere Zeichenkette ( → erste Zeichenkette )" # Fehler auslösen, wenn die Bedingung wahr ist: ## Klicke neben "dann" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der Funktion "Fehler auslösen" und wähle sie aus ## Suche unter "Fehlertyp" nach deinem Fehlertyp (du kannst die Fehler-ID direkt eingeben, wenn du sie kennst, z. B. Z30005) und wähle ihn aus ## Füge unter "Fehlerparameter" zwei Elemente hinzu, indem du auf die Schaltfläche "+" klickst ## Lege für "Objekt 1" (fehlerhafter Argumentschlüssel) den Typ auf "Zeichenkette" fest und trage die Argumentkennung ein (z. B. "erste Eingabe" oder "Z30000K1") ## Klicke für "Objekt 2" (fehlerhafter Argumentwert) auf die "…" neben "Objekt 2" und wähle "Argumentreferenz" aus ## Wähle unter "Schlüssel-ID" die erste Eingabe aus (z. B. "erste Zeichenkette") ## Du kannst den Funktionsaufruf "dann" nun bei Bedarf ausblenden, indem du auf den Pfeil nach unten neben "dann" klickst. Es sollte dann etwa Folgendes angezeigt werden: "f(x) Fehler auslösen ( ungültiges Format, typisierte Liste ( Objekt, "erste Eingabe", → erste Zeichenkette ) )" # Prüfe das zweite Argument, wenn das erste korrekt war: ## Klicke neben "sonst" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der Funktion "wenn" und wähle sie aus ## Richte eine "Bedingung" ein, um die Gültigkeit des zweiten Arguments zu überprüfen, indem du das gleiche Verfahren wie in Schritt 5 beschrieben anwendest. ## Richte "dann" so ein, dass beim zweiten Argument ein Fehler ausgelöst wird, indem du das gleiche Verfahren wie in Schritt 6 beschrieben anwendest. # Richte schließlich den Erfolgspfad ein: ## Klicke neben dem verschachtelten "sonst" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der gewünschten Funktion, in diesem Fall "vereinige zwei Zeichenketten mit Trennzeichen", und wähle sie aus ## Klicke neben "erste Zeichenkette" auf die Schaltfläche "…" und setze sie auf "Argumentreferenz", wähle anschließend "erste Zeichenkette" aus ## Klicke neben "zweite Zeichenkette" auf die Schaltfläche "…" und setze sie auf "Argumentreferenz", wähle anschließend "zweite Zeichenkette" aus ## Füge unter "Trennzeichen" ein Leerzeichen in das Textfeld ein Der resultierende Funktionsaufruf sollte folgendermaßen aussehen: [[File:Throw error expanded.png|frame|center|alt=Wikifunctions-Komposition mit der Funktion Fehler auslösen|Wikifunctions-Komposition mit der Funktion Fehler auslösen]] [[File:Throw error collapsed.png|frame|center|alt=Wikifunctions-Komposition mit der Funktion Fehler auslösen in ihrer reduzierten Ansicht|Wikifunctions-Komposition mit der Funktion Fehler auslösen in ihrer reduzierten Ansicht]] <span id="Handling_errors_in_compositions"></span> === Fehlerbehandlung in Kompositionen === Es ist zwar nützlich, Funktionen das Auslösen erwarteter Fehler zu ermöglichen, aber es ist entscheidend, Fehler in den eigenen Kompositionen behandeln zu können, um diese Funktionen sicher verwenden zu können. Angenommen, du möchtest eine neue Funktion "vollständiger Name einer Person" erstellen – wir bezeichnen sie mit der ZID <code>Z30010</code>. Diese Funktion soll den vollständigen Namen einer Person anhand ihres Vor- und Nachnamens zurückgeben. Ist jedoch eines der beiden Felder leer, soll sie stattdessen den Text "Unbekannt" zurückgeben. Du könntest eine Komposition erstellen, indem du unsere Beispielfunktion "verbinde zwei Zeichenketten mit Leerzeichen" oder <code>Z30000</code> verwendest, um den Namen zu generieren. Wenn eine der Eingaben leer ist, weißt du, dass <code>Z30000</code> einen Fehler vom Typ <code>Z30005</code> auslöst. Mithilfe der Funktion {{Z|Z850}} als Wrapper kannst du die Verbindungsoperation ausführen und einen möglichen Fehler abfangen, indem du einfach "Unbekannt" zurückgibst, wenn er auftritt. <span id="Try-Catch_function_(Z850)"></span> ==== Try-Catch-Funktion (Z850) ==== Die Funktion {{Z|Z850}} ist eine integrierte Funktion mit der ZID <code>Z850</code> und benötigt drei Argumente: * '''Funktionsaufruf''' – Der erste Funktionsaufruf, der ausgeführt werden soll. Wenn kein Fehler auftritt, ist die Antwort das Ergebnis dieses Funktionsaufrufs. * '''Fehlertyp''' – Ein Fehlertyp, der abgefangen werden soll, falls er während der Ausführung des ersten Funktionsaufrufs auftritt. * '''Fehlerhandler''' – Ein Funktionsaufruf, der ausgeführt wird, falls der oben genannte Fehler während der Ausführung des ursprünglichen Funktionsaufrufs auftritt. In diesem Fall wird das Ergebnis der Fehlerbehandlung zurückgegeben. <span id="Using_Try-Catch"></span> ==== Verwendung der Try-Catch-Funktion ==== Sobald wir alle Funktionen für unsere Komposition haben, können wir sie folgendermaßen gestalten: <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> Das bedeutet: * Die Funktion "verbinde zwei Zeichenketten mit Leerzeichen" wird mit den beiden Eingaben ausprobiert und wenn alles erfolgreich verläuft, wird das Ergebnis dieser Funktion zurückgegeben * Wenn eine der Eingaben leer ist, löst "verbinde zwei Zeichenketten mit Leerzeichen" einen Fehler vom Typ <code>Z30005</code> aus * Unsere {{Z|Z850}} erkennt dann diesen Fehler und führt die Funktion {{Z|Z801}} aus, die "Unbekannt" zurückgibt Lass uns das Schritt für Schritt erstellen: # Um eine Implementierung hinzuzufügen, klicke auf der Funktionsseite in der Tabelle "Implementierungen" auf die Schaltfläche "+". # Stelle sicher, dass die Option "Komposition" unter "Implementierung" ausgewählt ist. # Klicke auf das Symbol "›" oder auf den Link "Funktion auswählen", um die Funktionsdetails anzuzeigen. # Suche unter "Funktion" nach der äußersten Funktion, die du verwenden möchtest, in diesem Fall "Try-Catch-Funktion", und wähle sie aus. # Richte den Hauptfunktionsaufruf ein: ## Klicke unterhalb des Feldes, in dem die "Try-Catch-Funktion" ausgewählt ist, neben dem Schlüssel "Funktionsaufruf" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der Funktion "verbinde zwei Zeichenketten mit Leerzeichen" und wähle sie aus ## Klicke neben "erste Zeichenkette" auf die Schaltfläche "…" und wähle "Argumentreferenz" aus, wähle anschließend das Argument "erster Name" aus der Dropdown-Liste aus. ## Klicke neben "zweite Zeichenkette" auf die Schaltfläche "…" und wähle "Argumentreferenz" aus, wähle anschließend das Argument "zweiter Name" aus der Dropdown-Liste aus. # Wähle den abzufangenden Fehler aus: ## Suche unter "Fehlertyp" nach "ungültige Zeichenkette" und wähle es aus – du kannst direkt nach der ZID <code>Z30005</code> suchen # Richte den Funktionsaufruf für den Fehlerhandler ein: ## Klicke neben "Fehlerhandler" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der Funktion "Echo" und wähle sie aus ## Suche unter "Eingabe" und "Typ" den Typ "Zeichenkette" und wähle ihn aus ## Gib nun unter "Eingabe" im Textfeld "Unbekannt" ein Die resultierende Funktion sollte folgendermaßen aussehen: [[File:Try catch expanded.png|frame|center|alt=Wikifunctions-Komposition mit der Try-Catch-Funktion in ihrer erweiterten Ansicht|Wikifunctions-Komposition mit der Try-Catch-Funktion in ihrer erweiterten Ansicht]] [[File:Try catch collapsed.png|frame|center|alt=Wikifunctions-Komposition mit der Try-Catch-Funktion in ihrer reduzierten Ansicht|Wikifunctions-Komposition mit der Try-Catch-Funktion in ihrer reduzierten Ansicht]] <span id="Testing_your_failure_use_cases"></span> === Testen deiner Fehlerfälle === Wie bereits im Abschnitt über die [[#Practice Test-Driven Development|Anwendung von TDD]] erläutert, ist es wichtig, nicht nur die häufigsten Ausführungspfade, sondern auch mögliche Randfälle zu testen. Ebenso wichtig ist es, das Fehlerverhalten zu prüfen. In diesem Abschnitt stellen wir dir die notwendigen Werkzeuge vor, um zu testen, ob deine Funktion bei bestimmten Eingaben fehlschlägt und ob die Fehlermeldung den Erwartungen entspricht. Dazu benötigst du zwei weitere Systemfunktionen: <span id="Is_error_type_(Z852)"></span> ==== ist Fehlertyp (Z852) ==== Die Funktion {{Z|Z852}} ist eine integrierte Funktion mit der ZID <code>Z852</code> und benötigt zwei Argumente: * '''Fehler''' – Ein {{Z|Z5}}-Objekt, das bei einem fehlgeschlagenen Aufruf ausgelöst werden kann. Eine Fehlerinstanz hat einen Typ und einen Wert. * '''Fehlertyp''' – Ein Verweis auf einen {{Z|Z50}}, der mit dem als erstes Argument übergebenen Fehlertyp verglichen wird. Ist dies der Fall, gibt die Funktion wahr zurück. <span id="Get_error_thrown_by_function_call_(Z853)"></span> ==== Fehler erhalten, ausgelöst durch Funktionsaufruf (Z853) ==== Die Funktion {{Z|Z853}} ist eine integrierte Funktion mit der ZID <code>Z853</code> und benötigt ein Argument: * '''Funktionsaufruf''' – Ein Funktionsaufruf, der entweder einen erfolgreichen Wert beliebigen Typs zurückgibt oder einen Fehler auslöst. Diese Funktion gibt ein {{Z|Z882}} zurück, wobei an erster Stelle ein {{Z|Z40}} und an zweiter Stelle ein {{Z|Z1}} steht: * Wenn der Funktionsaufruf erfolgreich ist und somit keinen Fehler auslöst, enthält das zurückgegebene Paar an erster Stelle falsch und an zweiter Stelle leer. * Wenn der Funktionsaufruf einen Fehler auslöst, enthält das zurückgegebene Paar an erster Stelle wahr und an zweiter Stelle den abgefangenen Fehler. Um diese Funktion in deinen Kompositionen zu verwenden, musst du möglicherweise die zusätzlichen Funktionen verwenden: * {{Z|Z821}} und * {{Z|Z822}} <span id="Testing_errors"></span> ==== Fehler testen ==== Angenommen, unsere Zielfunktion "verbinde zwei Zeichenketten mit Leerzeichen" oder <code>Z30000</code> löst einen Fehler vom Typ <code>Z30005</code> aus, und wir möchten dieses Verhalten testen. Dazu müssen wir Folgendes tun: * Einen fehlgeschlagenen Funktionsaufruf auslösen * Den Fehler mit der Funktion {{Z|Z853}} erhalten * Mit {{Z|Z852}} prüfen, ob der Fehler den richtigen Typ hat Tests haben zwei Felder: * '''Aufruf''' – Ein Funktionsaufruf, der mit den zu testenden Eingaben eine Ausgabe erzeugt. Dieser Aufruf gibt einen Wert zurück. * '''Ergebnisprüfung''' – Ein Funktionsaufruf, der überprüft, ob der vom vorherigen Aufruf zurückgegebene Wert dem erwarteten Wert entspricht. Das erste Argument dieses Funktionsaufrufs wird automatisch mit dem Rückgabewert des ersten Aufrufs belegt. Für eine Schritt-für-Schritt-Anleitung zum Erstellen von Tests siehe {{ll|Wikifunctions:Introduction#Create_tests}}. In unserem Beispiel können wir es so strukturieren — aber das ist nicht die einzige Möglichkeit! Der Aufruf, der ein {{Z|Z5}}-Objekt zurückgibt: <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> Und die Ergebnisprüfung, die das {{Z|Z5}}-Objekt als erstes Argument verwendet: <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> Lass uns das Schritt für Schritt tun: # Um einen Test hinzuzufügen, klicke auf der Funktionsseite in der Tabelle "Tests" auf die Schaltfläche "+". Die Felder "Aufruf" und "Ergebnisprüfung" enthalten bereits vordefinierte Funktionen. Um die Fehler zu testen, müssen wir diese jedoch ändern. # Als Erstes richten wir den Aufruf ein: ## Klicke unter "Aufruf" auf die Schaltfläche "›", um den Funktionsaufruf zu erweitern. ## Bearbeite das Feld unter "Funktion" und suche die Funktion "erhalte zweites Element eines typisierten Paars" und wähle sie aus ## Klicke anschließend neben "typisiertes Paar" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der Funktion "Fehler erhalten, ausgelöst durch Funktionsaufruf" und wähle sie aus ## Klicke neben "Funktionsaufruf" auf die Schaltfläche "…" und wähle "Funktionsaufruf" aus ## Suche unter "Funktion" nach der Funktion "verbinde zwei Zeichenketten mit Leerzeichen" (oder nach ZID <code>Z30000</code>) und wähle sie aus ## Lege nun die Eingaben so fest, dass ein Fehler auftritt: Mindestens eine von ihnen muss leer sein. ## Du kannst jetzt deinen "Aufruf" durch erneutes Klicken auf den Pfeil nach unten wieder ausblenden, wenn du möchtest! # Als Nächstes richten wir die Ergebnisprüfung ein: ## Klicke unter "Ergebnisprüfung" auf die Schaltfläche "›", um den Funktionsaufruf zu erweitern. ## Bearbeite das Feld unter "Funktion" und suche die Funktion "ist Fehlertyp" und wähle sie aus ## Du wirst nun nur noch aufgefordert, das zweite Argument zu konfigurieren. Suche unter "Fehlertyp" nach deinem Fehlertyp <code>Z30005</code> und wähle ihn aus. # Und du bist fertig! Du kannst jetzt auf den kreisförmigen Pfeil im Feld "Implementierungen" klicken und solltest grüne Häkchen sehen. Wenn alles geklappt hat, kannst du deinen Test jetzt speichern. Er sollte folgendermaßen aussehen: [[File:Get error expanded.png|frame|center|alt=Testen eines Fehlers mit den Funktionen Fehler erhalten und ist Fehlertyp in ihrer erweiterten Ansicht|Testen eines Fehlers mit den Funktionen Fehler erhalten und ist Fehlertyp in ihrer erweiterten Ansicht]] [[File:Get error collapsed.png|frame|center|alt=Testen eines Fehlers mit den Funktionen Fehler erhalten und ist Fehlertyp in ihrer reduzierten Ansicht|Testen eines Fehlers mit den Funktionen Fehler erhalten und ist Fehlertyp in ihrer reduzierten Ansicht]] <span id="Debugging_your_implementations"></span> == Debuggen deiner Implementierungen == Manchmal läuft etwas schief. Eine Funktion verhält sich möglicherweise anders als erwartet oder ein Wert erscheint merkwürdig. Implementierungen können mitunter sehr komplex sein, und da sie in einer Spielwiesen-Umgebung ausgeführt werden, kann die Fehlersuche extrem schwierig erscheinen. Um das Verständnis der Vorgänge innerhalb eines Funktionsaufrufs zu erleichtern, bietet Wikifunctions einige Debugging-Werkzeuge. Diese Werkzeuge verändern nicht das Ergebnis einer Funktion, sondern fügen den zurückgegebenen Metadaten zusätzliche Informationen hinzu, die du nach dem Ausführen der Funktion einsehen kannst. Du kannst <code>Wikifunctions.Debug()</code> in deinen Code-Implementierungen oder die Funktion {{Z|Z854}} in deinen Kompositionen verwenden. In diesem Abschnitt erfährst du: * Wie man Debug-Meldungen sowohl aus Code- als auch aus Kompositions-Implementierungen hinzufügt, * Wie man die Metadaten manuell oder über die Benutzeroberfläche untersucht, um diese Protokolle einzusehen. <span id="Debugging_your_code_implementations"></span> === Debuggen deiner Code-Implementierungen === Beim Schreiben von Code, sowohl in JavaScript als auch in Python3, kannst du <code>Wikifunctions.Debug()</code> verwenden, um eine Meldung zu deinem Debug-Protokoll hinzuzufügen und die Ausführung fortzusetzen. <code>Wikifunctions.Debug()</code> hat einen Parameter, der üblicherweise als Zeichenkette erwartet wird. Jedes andere als Parameter übergebene Objekt wird jedoch direkt in eine Zeichenkette umgewandelt. Um zu unseren Code-Implementierungen für unsere Beispielfunktion "verbinde zwei Zeichenketten mit Leerzeichen" Debug-Protokolle hinzuzufügen, können wir dies in JavaScript tun: <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> Und das Gleiche in deiner Python3-Implementierung: <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Auf diese Weise fügen wir deinen Debug-Protokollen in jedem Fall eine Meldung hinzu: * Schlägt der Funktionsaufruf bei der Überprüfung der ersten oder zweiten Eingabe fehl, ist das Ergebnis der Ausführung ein Fehler, enthält aber einen informativen Protokolleintrag darüber, welcher Zweig den Fehler verursacht hat. * Wenn der Funktionsaufruf erfolgreich ist — weil beide Eingaben gültig sind — gibt der Funktionsaufruf die verbundene Zeichenkette zurück, aber die zurückgegebenen Metadaten enthalten auch ein Debug-Protokoll. <span id="Debugging_your_compositions"></span> === Debuggen deiner Kompositionen === Zur Unterstützung des Debuggens von Kompositionen stellt Wikifunctions die integrierte Funktion {{Z|Z854}} bereit. Mit dieser Funktion kannst du Debug-Meldungen an die Ausführung jedes Funktionsaufrufs anhängen, der die endgültige Ausgabe erzeugt. Die während der Auswertung gesammelten Debug-Protokolle werden als Teil der Ausführungsmetadaten unter dem Schlüssel <code>executorDebugLogs</code> zurückgegeben. <span id="Add_debug_log_to_function_call_(Z854)"></span> ==== Debug-Protokoll zu Funktionsaufruf hinzufügen (Z854) ==== Die Funktion {{Z|Z854}} ist eine integrierte Funktion mit der ZID <code>Z854</code> und benötigt zwei Argumente: * '''Funktionsaufruf''' – Jede Komposition, die du ausführen möchtest. * '''Debug-Protokoll''' – Eine Zeichenketten-Meldung, die protokolliert wird, wenn der angegebene Funktionsaufruf ausgewertet wird. Wenn der umschlossene Funktionsaufruf ausgeführt wird, wird die bereitgestellte Meldung zu den Ausführungsprotokollen hinzugefügt. Wird dieser Funktionsaufruf nicht ausgeführt oder ist seine Ausführung nicht Teil der endgültigen Ausgabe, erscheint sein Debug-Protokoll nicht in den Metadaten des Endergebnisses. Diese integrierte Funktion ist besonders nützlich, wenn du beobachten möchtest: * Welcher Zweig einer Bedingung ausgeführt wurde, oder * Die Reihenfolge der Auswertung in einer Komposition. <span id="Using_Add_debug_log_to_function_call"></span> ==== Verwendung von Debug-Protokoll zu Funktionsaufruf hinzufügen ==== Angenommen, du möchtest zu unserer Beispielfunktion "verbinde zwei Zeichenketten mit Leerzeichen" oder <code>Z30000</code> Debug-Protokolle hinzufügen, sodass für die verschiedenen möglichen Ergebnisse unterschiedliche Meldungen angezeigt werden. Du könntest unsere integrierte Debugging-Funktion wie folgt verwenden: <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> Dies bewirkt Folgendes: * Wird die Funktion mit einer leeren ersten Eingabe aufgerufen, gibt sie eine Fehlermeldung zurück und die Metadaten enthalten einen Eintrag <code>executorDebugLogs</code> mit dem Protokoll-Eintrag "Fehler bei erster Eingabe". * Wird der Aufruf mit einer leeren zweiten Eingabe aufgerufen, schlägt der Aufruf ebenfalls fehl, die protokollierte Meldung lautet jedoch "Fehler bei zweiter Eingabe". * Bei Aufruf mit gültigen Eingaben gibt die Funktion eine erfolgreiche Antwort zurück und zusätzlich enthalten die Metadaten im Schlüssel <code>executorDebugLogs</code> "Beide Eingaben sind in Ordnung". So würde diese Komposition aussehen: [[File:Add debug log expanded.png|frame|center|alt=Implementierung der Komposition mit Debug-Protokoll hinzufügen, um alle möglichen Ausführungspfade zu protokollieren|Implementierung der Komposition mit Debug-Protokoll hinzufügen, um alle möglichen Ausführungspfade zu protokollieren]] <span id="Accessing_execution_debug_logs"></span> === Zugriff auf Ausführungs-Debug-Protokolle === Unabhängig davon, ob deine Ausführungsprotokolle über <code>Wikifunctions.Debug()</code> oder die integrierte Funktion {{Z|Z854}} hinzugefügt werden, werden sie als Teil der Antwort-Metadaten zurückgegeben. Um die Protokolle zu sehen, klicke nach dem Ausführen deiner Funktion auf die Schaltfläche "Details", die unten im Abschnitt "Ergebnis" erscheint. Die Fehler- und Debug-Informationen werden oben im Dialogfeld "Details" angezeigt. Dies ist das Ergebnis, das du sehen würdest, wenn du die Komposition aus unserem vorherigen Beispiel mit gültigen und ungültigen Eingaben ausführst: {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=Funktions-Metadatendialog für eine erfolgreiche Ausführung mit Debug-Protokollen]] | [[File:Execution logs failure.png|frameless|center|alt=Funktions-Metadatendialog für eine fehlgeschlagene Ausführung mit Debug-Protokollen]] |- | Funktions-Metadatendialog für eine erfolgreiche Ausführung: zeigt keine Fehler an, sondern das Protokoll der erfolgreichen Ausführung: ''"Beide Eingaben sind in Ordnung!"'' | Funktions-Metadatendialog für eine fehlgeschlagene Ausführung: zeigt die Fehlerinformationen und das zusätzliche Ausführungsprotokoll für den ersten Fehlerzweig an: ''"Fehler bei erster Eingabe"'' |} [[Category:How to create implementations| {{#translation:}}]] a9s9w6464c2djtaali66uzrzg01a2ss Wikifunctions:How to create implementations/it 4 9368 276452 240254 2026-05-20T06:15:39Z FuzzyBot 207 Updating to match new version of source page 276452 wikitext text/x-wiki <languages/> Questa pagina fornisce una guida più dettagliata al '''creare''' implementazioni, oltre alla panoramica di {{ll|Wikifunctions:Introduction}}. <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> Di seguito diamo un esempio concreto di come creare una implementazione nella forma di Codice in Python. Mettiamo di voler creare una implementazione di una Funzione che accetta due stringhe in input, le combina mettendo uno spazio fra di loro e restituisce il risultato dell'operazione. Assumiamo che lo ZID di quella funzione sia Z11057. </div> <div class="mw-translate-fuzzy"> L'implementazione è definita utilizzando lo ZID della funzione. Lo sono anche gli argomenti della funzione. Quindi nel caso della funzione Z11057 e dei suoi due argomenti, la prima riga risulterà così: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Visto che è Python, ricordati di indentare correttamente la riga. <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> Ricorda che l'ambiente di esecuzione non ha stato. Non dare per certi i valori per variabili globali o statiche. Se hai ulteriori domande su cosa puoi e non puoi fare in Python, chiedi su [[Wikifunctions:Python implementations]]. <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div class="mw-translate-fuzzy"> Di seguito forniamo un esempio concreto su come creare una implementazione nella forma di Codice Javascript. Mettiamo di voler creare una implementazione per una Funzione che combina due stringhe di input mettendo uno spazio fra di esse, restituendo il risultato dell'operazione. Supponiamo che lo ZID di quella funzione sia Z11057. </div> <div class="mw-translate-fuzzy"> L'implementazione è definita utilizzando lo ZID della funzione, proprio come lo sono gli argomenti. Quindi nel caso della funzione Z11057 con i suoi due argomenti, la prima riga di codice dovrebbe essere: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> Ricorda che l'esecuzione non ha uno stato. Non assumere valori per variabili globali o statiche. Se hai ulteriori domande su cosa puoi o non puoi fare in JavaScript chiedi su [[Wikifunctions:JavaScript implementations]]. <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == Composizione == </div> <div class="mw-translate-fuzzy"> In questa sezione presentiamo un esempio concreto su come creare una implementazione nella forma di una composizione. Assumiamo di voler creare un'implementazione per una funzione che concatena le due stringhe in ingresso mettendo uno spazio tra esse, e ne restituisce il risultato. Assumiamo che lo ZID di tale funzione sia Z11057. </div> <div class="mw-translate-fuzzy"> Solitamente è una buona idea iniziare pensando come combinare le funzioni già esistenti per ottenere il risultato desiderato. A volte ciò potrebbe essere triviale, permettendoti quindi comporre direttamente le funzioni, ma in molti casi è utile segnarsi con carta e penna la composizione che vuoi creare: l'interfaccia di composizione di Wikifunctions non è ancora troppo intuitiva. </div> <div class="mw-translate-fuzzy"> Per esempio, per questa funzione, potremmo usare la funzione già esistente [[{{Z|Z10000}}]], che prende in ingresso due stringhe e le concatena. Ma abbiamo bisogno di aggiungere uno spazio tra le due stringhe. Quindi possiamo concatenare la prima stringa con uno spazio, e poi concatenare la stringa risultante con la seconda stringa. La nostra composizione può essere rappresentata come: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] 4gp56yjwnowk7vn70b99s4b6iz2rk99 Wikifunctions:How to create implementations/sv 4 9732 276460 240262 2026-05-20T06:15:45Z FuzzyBot 207 Updating to match new version of source page 276460 wikitext text/x-wiki <languages/> Den här sidan ger en mer detaljerad guide till att '''skapa implementeringar''', utöver översikten {{ll|Wikifunctions:Introduction}}. <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> I det följande visar vi ett konkret exempel på hur man skapar en Implementering i form av Python-kod. Säg att vi vill skapa en implementering för en Funktion som kombinerar två strängar med ett mellansteg mellan dem och returnerar resultatet. Låt oss anta att funktionens ZID är Z11057. </div> <div class="mw-translate-fuzzy"> Implementeringen, liksom argumenten, definieras med hjälp av funktionens ZID. I fallet med funktionen Z11057 och dess två argument skall första raden se ut så här: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Glöm inte att indentera raden eftersom det är Python. <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> Kom ihåg att miljön inte bevarar tillstånd. Anta inte värden för globala eller statistka variabler. Om du har ytterligare frågor om vad du kan och inte kan göra i Pyton, fråga på [[Wikifunctions:Python implementations]]. <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div class="mw-translate-fuzzy"> I det följande visar vi ett konkret exempel på hur man skapar en Implementering i form av JavaScript-kod. Säg att vi vill skapa en implementering för en Funktion som kombinerar två strängar med ett mellansteg mellan dem och returnerar resultatet. Låt oss anta att funktionens ZID är Z11057. </div> <div class="mw-translate-fuzzy"> Implementeringen, liksom argumenten, definieras med hjälp av funktionens ZID. I fallet med funktionen Z11057 och dess två argument skall första raden se ut så här: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> Kom ihåg att miljön inte bevarar tillstånd. Anta inte värden för globala eller statiska variabler. Om du har ytterligare frågor om vad du kan och inte kan göra i JavaScript, fråga på [[Wikifunctions:JavaScript implementations]]. <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == Komposition == </div> <div class="mw-translate-fuzzy"> I det följande visar vi ett konkret exempel på hur man kan skapa en Implementering genom komposition. Säg att vi vill skapa en implementering för en Funktion som kombinerar två strängar med ett mellansteg mellan dem och returnerar resultatet. Låt oss anta att funktionens ZID är Z11057. </div> <div class="mw-translate-fuzzy"> Det är ofta en bra idé att första tänka igenom hur man kan kombinera existerande funktioner för att uppnå ett önskat resultat. Ibland kan det vara trivialt och du kan bara direkt kombinera funktioner. I många fall är det dock värt att dokumentera den önskade kompositionen. Wikifunctions har ett kompositionsgränssnitt som ännu inte är så bra för att redigera kompositioner. Därför är det en bra idé att först komma fram till exakt vad du vill skapa. </div> <div class="mw-translate-fuzzy"> Till exempel, för den givna Funktionen skulle vi kunna använda den existerande [[{{Z|Z10000}}|''Funktionen för att konkatenera strängar'']]. Den funktionen tar två strängar och sätter ihop dem till en sträng. Men vi behöver lägga till ett mellansteg. Därför konkatenerar vi först den första strängen med ett mellansteg och sedan konkatenerar vi resultatet med den andra strängen. Vår komposition bör alltså se ut så här: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] 62hm0dibklv4w8laon0x4gbmbrrvadz Wikifunctions:How to create implementations/en-gb 4 12322 276448 240250 2026-05-20T06:15:35Z FuzzyBot 207 Updating to match new version of source page 276448 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Compositions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div class="mw-translate-fuzzy"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. The Wikifunctions composition interface is not very good yet at editing compositions, so it is a good idea to first figure out what exactly you want to create. </div> <div class="mw-translate-fuzzy"> For example, for the given Function, we could use the existing [[{{Z|Z10000}}|''Function to concatenate strings'']]. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] mc85mp5yuiu4qxewkhoanefvqtn1fjt Wikifunctions:How to create implementations/fr 4 15833 276450 240251 2026-05-20T06:15:36Z FuzzyBot 207 Updating to match new version of source page 276450 wikitext text/x-wiki <languages/> Cette page fournit un guide plus détaillé pour '''créer des implémentations''', au delà de l’explication générale de {{ll|Wikifunctions:Introduction}}. <span id="Types_of_Implementations"></span> == Types d'implémentations == Dans Wikifunctions, une '''implémentation''' peut prendre la forme d'un '''code''' ou d'une '''composition'''. Une implémentation sous forme de code exprime directement la logique de la fonction dans tout langage de programmation disponible (actuellement, Python3 ou JavaScript). Cela sert principalement quand le comportement de la fonction ne peut pas se construire facilement à partir des Wikifunctions existantes, ou quand un contrôle précis du traitement des données est nécessaire. Une implémentation sous forme de composition, en revanche, définit la fonction entièrement par une combinaison d'autres fonctions existantes, sans écrire de code. Les compositions sont plus faciles à comprendre, à réutiliser et à traduire automatiquement dans d'autres langues, mais elles dépendent des blocs de construction appropriés déjà disponibles et sont souvent moins performantes. En général, commencez par vérifier si votre objectif peut être atteint avec des compositions; si ce n'est pas le cas, ou si la performance ou la logique du détail sont importantes, choisissez plutôt une mise en œuvre sous forme de code. Un troisième type d'implémentation existe : '''built-ins'''. Il est exécuté par le code interne du système et n'est pas modifiable. En général chaque fonction prédéfinie aura déjà une implémentation interne. Si c'est le cas, vous verrez un message disant ''"{{int|wikilambda-implementation-selector-none}}"'' lorsque vous afficherez la page d'implémentation. <span id="Practice_Test-Driven_Development"></span> == Développement pratique dirigé par les tests == Le '''TDD''' (''Test-Driven Development'') est un principe où l'on décrit le logiciel en partant de l'écriture des tests avant celle du code actuel. Les tests sont juste une manière de comprendre ce que votre fonction doit réaliser en fournissant des exemples et la façon dont ils doivent fonctionner. Dans Wikifunctions, l'écriture des tests offre d'abord des bénéfices significatifs. Si vous travaillez sur une implémentation, vous pouvez exécuter votre code avec les tests existants pour vérifier qu'il se comporte comme attendu. Cela facilite la détection des erreurs très tôt, bien avant même que de publier votre implémentation. Les tests sont aussi un moyen puissant de décrire la fonction dont vous avez besoin. En décrivant ces tests, '''vous indiquez clairement le comportement attendu''', et la communauté peut poursuivre en aidant à l'implémentation ou à la création d'implementations alternatives. Imaginez que vous voulez mettre en œuvre une fonction qui combine deux chaînes avec un espace entre elles. Un test de base pour cela pourrait être : <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> Une fois le comportement de base défini, il est important de '''penser aux cas aux limites'''—ce sont des situations où les entrées nécessitent un comportement particulier. Par exemple, que faire si votre première chaîne se termine par un espace, ou que votre deuxième chaîne commence avec un espace ? La fonction doit-elle conserver tous les espaces existants et en ajouter un autre ? ou doit-elle renvoyer un résultat espacé effectivement avec un seul espace entre les mots ? Selon vos besoins, vous devez écrire un test pour ce type de situation. Par exemple, un test pour ce cas aux limites pourrait être l'un des deux suivants — mais pas les deux simultanément ! : <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> ou ... <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> Assurez-vous que tous les cas spéciaux possibles sont couverts par vos tests et dès que vous les avez rassemblés, vérifiez qu'ils sont tous conectés à la Fonction en les sélectionnant et en cliquant sur ''Connect''. <span id="Code_implementations"></span> == Implémentations du code == [[File:Code implementation.png|thumb|alt=Editeur de code de Wikifunctions initialisé avec un modèle de fonction|Lors de l'ajout d'une nouvelle implémentation de code, le modèle de fonction est initialisé avec le nom de la fonction et les noms des arguments]] Lorsque vous créez une implementation en code, l'interface utilisateur de Wikifunctions vous configure l'éditeur de code qui correspond au langage actif pour la mise en valeur de la syntaxe et la validation. Lorsque la fonction à implémenter et le langage de programmation sont sélectionnés, cet éditeur est configuré avec le modèle correct de fonction : '''ne supprimez pas, ni ne modifiez pas cela''' ! Conservez votre code à l'intérieur de la signature de cette fonction : si vous avez besoin de fonctions annexes, il suffit de les déclarer simplement à l'intérieur de la déclaration de la fonction de niveau principal. <span id="Using_input_types_in_your_code"></span> === Utiliser des types d'entrées dans votre code === Les types Wikifunctions {{Z|Z6}} et {{Z|Z40}} peuvent être utilisés comme s'ils étaient des types natifs en JavaScript et en Python3. Par exemple, une entrée chaîne de caractères peut être concatenée ou un booléan peut être directement utilisé dans une expression logique. Pour utiliser d'autres types dans vos implémentations de code, vous devrez regarder le type plus précisément, déterminer s'il a une conversion en un équivalent natif, et le traiter en conséquence. Supposons par exemple que l'on veuille écrire du code Python qui traite une entrée de type {{Z|Z20420}}. Sur la page de ce type, nous cherchons les ''convertisseurs de type en code'' et en choisissons un pour Python. Le convertisseur {{Z|Z20424}} est appliqué à notre entrée date avant le code, donc en cherchant le ''type natif'' nous voyons que notre entrée est un ''dict'' Python et l'implémentation nous donne les clés attendues : <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> Quand un type n'a pas de convertisseur, vous devez accéder à ses composants directement à l'aide de ses clés. Par exemple, supposons que votre fonction <code>Z30000</code> a une entrée <code>Z30000K1</code> de type {{Z|Z11}}. Ce type a deux clés : <code>Z11K1</code> pour le langage (lui-même un objet de type {{Z|Z60}}), et <code>Z11K2</code> pour la valeur de la chaîne. De même, l'objet language a une clé <code>Z60K1</code> pour le code de langue. Donc, pour obtenir une chaîne avec le code de la langue et le texte, vous pouvez écrire : <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // par exemple "fr: placez votre texte en français ici" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> Pour une référence rapide des conversions de type, voir la [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|table de conversion du type par défaut]]. <span id="Returning_the_right_outputs"></span> === Renvoyer les bonnes sorties === De la même façon que vous traitez les entrées, les sorties doivent correspondre au type spécifié dans la définition de la fonction. Certains peuvent être traités comme des types natifs, de sorte que toute sortie de chaîne sera convertie en un objet Wikifunctions {{Z|Z6}} et tout booléen natif renvoyé par votre implémentation sera converti en un objet wikifunctions {{Z|Z40}} . Ces types qui disposent de ''convertisseurs de type à partir du code'' appliquent la fonction appropriée à la sortie, afin de construire le type requis. Suivant l'exemple de {{Z|Z20420}}, le {{Z|Z20443}} transformera la sortie de implémentation – dicté par les clés K1, K2 et K3 – en sa représentation ZObject correcte. Pour les types qui n'ont pas de convertisseur de code, vous pouvez construire soigneusement et renvoyer les objets en sortie. Par exemple, si notre fonction <code>Z30000</code> prend deux entrées de chaîne : le code de langue et un texte, et doit renvoyer un objet {{Z|Z11}}. Vous pouvez faire cela en Python en utilisant le constructeur <code>ZObject</code> : <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> Ou en JavaScript : <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> Vous trouverez des informations complémentaires sur la classe <code>ZObject</code> et d'autres constructeurs utiles dans {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}}. {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <span id="Code_in_Python"></span> === Code Python === Dans cette section nous donnons ci-dessous un exemple concret de la façon de créer une implémentation sous la forme de code Python. Supposons que nous voulons créer une implémentation pour une fonction qui combine deux chaînes d'entrée en mettant un espace entre-elles et qui renvoie le résultat. Supposons que le ZID de cette fonction est Z30000. L’implémentation est définie en utilisant le ZID de la fonction. Il en va de même pour les arguments de la fonction. Donc, dans le cas de la fonction Z300000 avec ses deux arguments, le modèle de la fonction devrait ressembler à : <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> Comme nous l'avons décrit précédemment, nous savons que les arguments (<code>Z30000K1</code> et <code>Z30000K2</code>) sont des chaînes, donc nous pouvons les traiter aussi simplement que nous utilisons les chaînées natives en Python. De plus, la fonction doit renvoyer une chaîne. Pour notre exemple, nous renvoyons simplement les deux arguments concatenés avec un espace entre eux deux : <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Comme il s’agit de Python, n’oubliez pas d’indenter cette ligne. Si vous avez suivi notre conseil pour [[#Practice Test-Driven Development|pratiquer le TDD]] vous disposez déjà d'un ensemble de tests dont vous savez qu'ils fonctionnent. Si c'est la cas, tout en construisant votre immplémentation vous pouvez cliquer sur la flèche circulaire du panneau Tests pour voir si votre implémentation les vérifie tous. Rappelez-vous que le temps d’exécution n'a pas d'état. Ne supposez pas que les valeurs sont des variables globales ou statiques. Si vous avez d’autres questions sur ce que vous pouvez et ne pouvez pas faire en Python, demandez à [[Wikifunctions:Python implementations]]. <span id="Code_in_JavaScript"></span> === Code JavaScript === Nous donnons ci-dessous un exemple concret de la façon de créer une implémentation sous la forme de code JavaScript. Supposons que nous voulons créer une implémentation pour une fonction qui combine deux chaînes d'entrée en mettant un espace entre-elles et qui renvoie le résultat. Supposons que le ZID de cette fonction est <code>Z30000</code>. L’implémentation est définie en utilisant le ZID de la fonction. Il en va de même pour les arguments de la fonction. Donc, dans le cas de la fonction <code>Z30000</code> avec ses deux arguments, le modèle de la fonction devrait ressembler à : <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> Nous savons que les arguments (<code>Z30000K1</code> et <code>Z30000K2</code>) sont des chaînes, donc nous pouvons les traiter comme des chaînées natives en JavaScript. De plus, la fonction doit renvoyer une chaîne. Pour compléter notre fonction, vous pouvez ensuite ajouter une ligne qui concatène les chaînes d'entrée, comme ceci : <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> Si vous avez des tests comme cela a été recommandé dans la section [[#Practice Test-Driven Development|TDD]] ci-dessus, cliquez sur la flèche circulaire du panneau Tests pour voir si votre implémentation les vérifie tous. Rappelez-vous que le runtime n'a pas d'état. Ne présumez pas des valeurs des variables globales ou statiques. Si vous avez d'autres questions sur ce que vous pouvez ou ne pouvez pas faire en JavaScript, posez-les sur [[Wikifunctions:JavaScript implementations]]. <span id="Compositions"></span> == Composition == Nous donnons ci-dessous un exemple concret de la façon de créer une implémentation sous la forme de composition. Supposons que nous voulons créer une implémentation pour une fonction qui combine deux chaînes d'entrée en mettant un espace entre-elles et qui renvoie le résultat. Supposons que le ZID de cette fonction est <code>Z30000</code>. Il est généralement bon de réfléchir d'abord à la façon de combiner les fonctions existantes afin de créer la sortie souhaitée. Parfois, cela peut être trivial, et vous pouvez simplement continuer en utilisant les fonctions de composition, mais dans de nombreux cas, cela vaut la peine de détailler la composition souhaitée. Par exemple, pour la fonction donnée, nous pourrions utiliser la fonction existante {{Z|Z10000}}. Cette fonction prend deux chaînes de caractères et en fait une chaîne résultat. Mais nous devons ajouter un espace entre les deux. Donc nous concaténons d'abord un espace à la fin de la première chaîne, puis concatenons la deuxième chaîne au résultat de la première concatenation. Notre composition pourrait donc se noter ainsi : <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> Il existe différentes façons d'écrire une composition; notez que la même chose peut être réalisée avec : <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> Une implémentation alternative pourrait également utiliser la fonction existante {{Z|Z15175}}, de sorte que votre composition pourrait être : <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> Comme vous pouvez le voir, il y a plusieurs façons d'y parvenir, alors prenez votre temps et explorez les fonctions existantes disponibles dans le {{ll|Wikifunctions:Catalogue}}. Essayons de créer le second exemple, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. Pour créer ceci : # Commencez par ajouter une implémentation en cliquant sur le bouton <code>+</code> dans la table ''Implémentations'' de votre page ''Fonction''. # Vérifier que l'option ''composition'' sous ''Implémentation'' est sélectionnée. # Cliquez sur l'icône <code>›</code> ou cliquez sur le lien ''Sélectionner une fonction'' pour développer les détails de la fonction. # Sous "fonction" chercher le nom de la fonction la plus extérieure que vous voulez utiliser, qui dans cet exemple est ''joindre deux chaînes''. Ensuite, sélectionner la fonction souhaitée dans la liste déroulante. # Vous verrez deux nouveaux champs, un pour chacun des arguments nécessaires à la fonction sélectionnée. # Pour le premier argument, nous voulons sélectionner la première entrée de notre fonction : ## À côté de ''première chaîne'', cliquer sur le bouton <code>...</code> et sélectionnez ''Référence d'argument''. ## Sous ''key id'' vous pouvez maintenant sélectionner la première chaîne de votre fonction dans la liste déroulante, qui contient toutes les entrées possibles. # Pour le deuxième argument, nous voulons utiliser le résultat d'un autre appel à ''joindre deux chaînes'' : ## À côté de ''seconde chaîne'', cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction''. ## Sous ''fonction'', chercher et sélectionner la fonction que vous voulez appeler, et qui est encore ''joindre deux chaînes''. ## Pour cet appel de fonction interne, configurer la ''première chaîne'' en tapant simplement un espace blanc dans le champ de texte, et configurer la ''seconde chaîne'' comme vous l'avez fait pour l'étape 6 : changez-le en mettant le bouton <code>...</code> à ''Référence d'argument'', puis sélectionner le deuxième argument dans la zone déroulante. Votre composition est maintenant terminée ! Vous pouvez développer ou replier les détails en utilisant les boutons avec des chevrons pour voir à quoi cela ressemble. Si vous disposez déjà des tests comme il vous l'a été indiqué dans la section [[#Practice Test-Driven Development|TDD]] ci-dessus, cliquer sur la flèche circulaire du panneau Tests et vérifier si votre implementation passe les tests. Dès que votre composition réussit les tests, avancez et publiez-la. [[File:Composition implementation expanded.png|frame|center|alt=Implémentation d'une composition Wikifunctions dans sa vue étendue|Implémentation d'une composition Wikifunctions dans sa vue étendue]] [[File:Composition implementation collapsed.png|frame|center|alt=Implémentation d'une composition Wikifunctions dans sa vue repliée|Implémentation d'une composition Wikifunctions dans sa vue repliée]] <span id="Wikifunctions_error_handling"></span> == Gestion des erreurs Wikifunctions == En tant que créateur de fonctions Wikifunctions, vous voudrez peut-être avertir l'utilisateur qui appelle votre fonction lorsque quelque chose ne va pas dans le code, ou lorsque les entrées ne correspondent pas à un certain critère. Par exemple, si votre fonction s'attend à ce qu'une chaîne de saisie contienne un nom, vous voudrez peut-être vérifier que le nom n'est pas vide et, si c'est le cas, afficher un message d'erreur compréhensible par la personne qui utilise votre fonction. Pour cela, vous pouvez utiliser <code>Wikifunctions.Error()</code> de vos implémentations de code ou la fonction {{Z|Z851}} de vos compositions. Dans cette section nous aprrendrons : * Comment générer des erreurs provenant à la fois par les implémentations du code et par les compositions, * comment écrire les tests pour les cas d'erreur, et * comment récupérer et gérer les erreurs causées par les fonctions que vous utilisez dans vos compositions. <span id="Throwing_errors_from_code_implementations"></span> === Générer des erreurs à partir de l'implémentation du code === Lorsque vous écrivez du code, à la fois à partir de JavaScript ou de Python, vous pouvez utiliser <code>Wikifunctions.Error()</code> pour terminer l'exécution avec une erreur souhaitée. <code>Wikifunctions.Error()</code> a deux paramètres : # Type d'erreur : une chaîne contenant le ZID du type d'erreur à renvoyer. # Arguments d'erreur : liste d'arguments de chaîne pour construire l'erreur. Procédons par étape : <span id="Error_type"></span> ==== Type d'erreur ==== Un type d'erreur est un objet qui décrit une sorte d'erreur pouvant se produire dans le système. Il existe un certain nombre de types d'erreur intégrés mais vous pouvez aussi construire d'autres types d'erreur plus adaptés à votre cas d'utilisation. Si vous utilisez les erreurs, le mieux est de parcourir les types d'erreur disponibles que vous pouvez retrouver dans [[Special:ListObjectsByType/Z50|cette liste]]. S'il n'y a pas d'erreurs qui puissent correspondre à votre cas, créez-en une nouvelle en allant sur la page de création et en sélectionnant ''type d'erreur'' dans le sélecteur de type. Ensuite, définissez les champs nécessaires : [[File:Error type.png|thumb|alt=Création de type d'erreur dans Wikifunctions|Pour créer un nouveau type d'erreur (Z50), modifier l'étiquette et ajoutez les clés nécessaires.]] * '''Label''' – c'est le titre principal de l'erreur qui doit contenir un message bref mais suffisamment descriptif. Initialiser le libellé d'erreur dans la boîte ''About'', à droite. * '''Keys''' – les clés contiennent des informations supplémentaires à propos de ce qui a causé l'erreur. Par exemple, si une entrée a un mauvais format, vous pouvez informer l'utilisateur en donnant son contenu au moment de l'erreur. Pour pouvoir utiliser les clés dans vos implémentations, elles doivent être des chaînes. Pour créer une clé, cliquer sur l'icône <code>[+]</code> sous ''keys'', sélectionner ''String'' sous ''value type'' et ajouter un libellé suffisamment descriptif, par exemple ''entrée actuelle''. Une fois toutes les clés nécessaires en votre possession, vous pouvez publier votre type d'erreur et conserver l'ID du nouvel objet créé. <span id="Error_arguments"></span> ==== Arguments des erreurs ==== Les arguments des erreurs correspondent aux clés du type d'erreur et doivent fournir des informations supplémentaires pour comprendre l'erreur. Les arguments d'erreur doivent toujours être des ''String''. <span id="Using_Wikifunctions.Error()"></span> ==== Utiliser Wikifunctions.Error() ==== Supposons que vous voulez qu'une erreur soit signalée soit quand votre première, ou votre deuxième entrée est vide. Vous avez déjà créé le type d'erreur, et le ZID qui a été attribué était <code>Z30005</code>. Votre type d'erreur a deux clés textuelles : * Input key : contient la clé de l'entrée erronnée * Input value : contient la valeur actuelle de l'entrée erronnée Pour générer une erreur dans votre implémentation JavaScript, essayez ceci : <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // si la première entrée est vide, générer une erreur Z30005 // avec deux arguments de chaîne : [ première clé d'entrée, première valeur d'entrée ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // si la seconde entrée est vide, générer une erreur Z30005 // avec deux arguments chaîne : [ seconde clé d'entrée, seconde valeur d'entrée ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> Pour créer une erreur dans votre implémentation Python, essayez ceci : <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # si l'entrée est vide, générer une erreur Z30005 # avec deux arguments chaîne : [ première clé d'entrée, première valeur d'entrée ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # si la deuxième entrée est vide, générer l'erreur Z30005 # avec deux arguments chaîne : [ première clé d'entrée, première valeur d'entrée ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Rappelez-vous que l'appel à <code>Wikifunctions.Error()</code> met fin à l'exécution ! <span id="Throwing_errors_from_compositions"></span> === Générer des erreurs à partir des compositions === Si vous créez l'implémentation d'une composition, vous pouvez générer une erreur en appelant la fonction spéciale {{Z|Z851}}. <span id="Throw_Error_function_(Z851)"></span> ==== Fonction ''Throw Error'' (Z851) ==== La fonction {{Z|Z851}} est similaire à la méthode <code>Wikifunctions.Error()</code> et prend deux arguments : * '''Error type''' – référence du type d'erreur que vous voulez signaler * '''Error parameters''' – liste d'arguments pour créer votre erreur (doivent aussi être des ''String'') . <span id="Using_Throw_Error"></span> ==== Utiliser ''Throw Error'' ==== Supposons que vous souhaitez modifier votre composition pour qu'elle vérifie d'abord que les arguments ne sont pas vides, et qu'elle génère une erreur si un argument est vide. Si aucun d'entre-eux est vide, la composition originale est exécutée, soit : <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> Pour cela, vous devez créer des pattes conditionnelles à l'aide la fonction {{Z|Z802}}. Elle doit être comprise ainsi : * Si le premier argument est vide, générer une erreur pour le premier argument * Sinon procéder au contrôle du second argument * Si le deuxième argument est vide, générer une erreur pour ce deuxième argument * Sinon, procéder avec la patte de succès et renvoyer les chaînes jointes avec le séparateur espace Ou sous forme de pseudo code fonctionnel : <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> Créons cela progressivement : # Commencez par ajouter une implémentation en cliquant sur le bouton <code>+</code> dans la table ''Implémentations'' de votre page ''Fonction''. # Vérifier que l'option ''composition'' sous ''Implémentation'' est sélectionnée. # Cliquez sur l'icône <code>›</code> ou cliquez sur le lien ''Sélectionner une fonction'' pour développer les détails de la fonction. # Sous "fonction" chercher et sélectionner la fonction la plus extérieure que vous souhaitez utiliser, qui dans ce cas est ''if''. # Vérifier la validité du premier argument : ## À côté de ''condition'', cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction''. ## Sous ''fonction'', chercher et sélectionner la fonction ''is empty string'' ## À côté de ''entrée'', cliquer sur le bouton <code>...</code> et sélectionnez ''Référence d'argument''. ## Sous ''key id'', sélectionner la première entrée (par exemple ''first string'') ## Vous pouvez désormais refermer l'appel de la fonction ''condition'' si vous le souhaitez, en cliquant sur le chevron vers le bas à côté de ''condition''. Vous devriez voir quelque chose comme ''f(x) est une chaîne vide (→ première chaîne)'' # Générer une erreur si la condition est vraie : ## À côté de ''then'', cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction''. ## Sous ''fonction'', chercher et sélectionner la fonction ''Throw Error'' ## Sous ''error type'', chercher et sélectionner votre type d'erreur (vous pouvez entrer directement l'ID de l'erreur si vous le connaissez, par exemple Z30005) ## Sous ''paramètres d'erreur'', ajouter deux éléments en cliquant sur le bouton <code>+</code> ## Pour ''Item 1'' (cassant la clé de l'argument), définir son type à ''String'' et écrire l'identificateur d'arguments (par exemple ''first input'' ou ''Z30000K1'') ## Pour ''Item 2'' (valeur d'argument offensant), cliquer sur <code>…</code> à côté de ''Item 2'' et sélectionner ''argument reference'' ## Sous ''key id'', sélectionner la première entrée (par exemple ''first string'') ## Vous pouvez maintenant refermer l'appel de la fonction ''then'' si vous le souhaitez, en cliquant sur le chevron vers le bas à côté de ''then''. Vous devriez voir quelque chose comme ''f(x) Throw Error( l'entrée avait le format incorrect, liste typée (Objet, "première entrée", → première chaîne) )'' # Continuer le contrôle du second argument si le premier est correct : ## À côté de ''else'', cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction'' ## Sous ''fonction'', chercher et sélectionner la fonction ''if'' ## Configurer ''condition'' pour vérifier la validité du deuxième argument en suivant le même processus que celui décrit à l'étape 5. ## Configurez "then" pour générer une erreur pour le deuxième argument en suivant le même processus que celui décrit à l'étape 6. # Enfin définir la patte de succès : ## À côté du ''else'' imbriqué, cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction'' ## Sous ''fonction'', chercher et sélectionner la fonction réussie, qui dans ce cas peut être ''joindre des chaînes avec séparateur'' ## À côté de ''première chaîne'', cliquer sur le bouton <code>...</code> et initialisez-le à ''Référence d'argument'' puis sélectionner ''première chaîne''. ## À côté de la ''seconde chaîne'', cliquer sur le bouton <code>...</code> et définissez-le à ''référence d'argument'', puis sélectionner "seconde chaîne" ## Sous ''separator'' ajouter un espace dans le champ de texte L'appel résultant de la fonction doit être similaire à : [[File:Throw error expanded.png|frame|center|alt=Composition Wikifunctions utilisant la fonction ''Throw Error''|Composition Wikifunctions utilisant la fonction ''Throw Error'']] [[File:Throw error collapsed.png|frame|center|alt=Composition Wikifunctions utilisant la fonction ''Throw Error'', dans sa vue repliée|Composition Wikifunctions utilisant la fonction ''Throw Error'', dans sa vue repliée]] <span id="Handling_errors_in_compositions"></span> === Gestion des erreurs dans les compostions === Bien qu'il soit utile de permettre aux fonctions de générer les erreurs attendues, il est crucial de pouvoir gérer les erreurs dans vos compositions afin d'utiliser ces fonctions en toute sécurité. Supposons que vous souhaitiez créer une nouvelle fonction ''nom complet d'une personne'' – nous nous référerons à elle avec le ZID <code>Z30010</code>. Cette fonction doit renvoyer le nom complet de la personne avec un prénom et un nom de famille, mais si l'un des deux champs est vide, elle doit renvoyer le texte ''Unknown'' à la place. Vous pouvez créer une composition en utilisant notre fonction d'exemple ''Join two strings with a space'' ou <code>Z30000</code> pour générer le nom. Si l'une des entrées est vide, vous savez que <code>Z30000</code> va générer une erreur de type <code>Z30005</code>. En utilisant la fonction {{Z|Z850}} comme enveloppe, vous pouvez essayer l'opération de jointure et intercepter une erreur possible pour simplement renvoyer ''Unknown'' chaque fois qu'elle se produit. <span id="Try-Catch_function_(Z850)"></span> ==== Fonction ''Try-Catch'' (Z850) ==== La fonction {{Z|Z850}} est intégrée avec ZID <code>Z850</code> et prend trois arguments : * '''Function call''' – appel de la fonction initiale à exécuter. Si tout se passe bien, la réponse est le résultat de cet appel. * '''Error type''' – type d'erreur à capturer dans le cas où il apparaît pendant l'exécution de l'appel à la première fonction. * '''Error handler''' – fonction à appeler dans le cas où l'erreur spécifiée ci-dessus est capturée pendant l'exécution de l'appel de la fonction initiale. Si la capture a lieu, la valeur renvoyée est le résultat du gestionnaire d'erreur. <span id="Using_Try-Catch"></span> ==== Utiliser ''Try-Catch'' ==== Une fois toutes les fonctions de notre composition réunies, nous pouvons les assembler ainsi : <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> Cela signifie que : * La fonction ''Join two strings with a space'' sera testée avec les deux entrées et, si tout va bien, la sortie de cette fonction sera renvoyée * Si l'une des entrées est vide, ''Join two strings with a space'' génère une erreur de type <code>Z30005</code> * Notre {{Z|Z850}} détecte alors cette erreur et exécute la fonction {{Z|Z801}} et renvoie ''Unknown'' Créons cela progressivement : # Commencez par ajouter une implémentation en cliquant sur le bouton <code>+</code> dans la table ''Implémentations'' de votre page ''Fonction''. # Vérifier que l'option ''composition'' sous ''Implémentation'' est sélectionnée. # Cliquer sur l'icône <code>›</code> ou cliquer sur le lien ''Sélectionner une fonction'' pour développer les détails de la fonction. # Sous "fonction" chercher et sélectionner la fonction la plus extérieure à utiliser, qui dans ce cas est ''Try-Catch''. # Définir l'appel à la fonction principale : ## Dans le champ où la fonction ''Try-Catch'' est sélectionnée, à côté de la touche ''appel à la fonction'', cliquer sur le bouton <code>...</code> et sélectionner ''appel de fonction'' ## Sous ''fonction'', chercher et sélectionner la fonction ''join two strings with space'' ## À côté de ''première chaîne'', cliquer sur le bouton <code>...</code> et sélectionner ''argument reference'' puis sélectionner l'argument de ''premier nom'' dans le menu déroulant. ## À côté de la ''seconde chaîne'', cliquer sur le bouton <code>...</code> et sélectionner ''argument reference'', puis sélectionner l'argument de ''second nom'' à partir du menu déroulant. # Sélectionner l'erreur à récupérer : ## Sous ''error type'', chercher et sélectionner ''bad string input'' – vous pouvez chercher directement à l'aide de son ZID <code>Z30005</code> # Déclarer l'appel de fonction du gestionnaire d'erreur : ## À côté de ''error handler'', cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction''. ## Sous ''fonction'', chercher et sélectionner la fonction ''écho'' ## Sous ''input'' et ''type'', chercher et sélectionner le type ''String'' ## Maintenant, sous ''entrée'', saisir ''Inconnu'' dans le champ de texte La fonction résultante doit être similaire à ceci : [[File:Try catch expanded.png|frame|center|alt=Composition Wikifunctions utilisant la fonction ''Try-catch'', en mode développé|Composition Wikifunctions utilisant la fonction ''Try-catch'', en mode développé]] [[File:Try catch collapsed.png|frame|center|alt=Composition Wikifunctions utilisant la fonction ''Try-catch'', en mode replié|Composition Wikifunctions utilisant la fonction ''Try-catch'', en mode replié]] <span id="Testing_your_failure_use_cases"></span> === Tester vos cas d'utilisation en échec === Comme annoncé dans la section ci-dessus à propos de la [[#Practice Test-Driven Development|pratique du TDD]], il est important de tester non seulement les pattes les plus habituelles, mais également les cas aux limites possibles. De manière équivalente, il est aussi important de tester le comportement en cas d'échec. Dans cette section nous allons vous donner les outils nécessaires pour vérifier que votre fonction échoue avec un ensemble donné de valeurs d'entrées, et que l'erreur générée est bien celle qui est attendue. Pour faire cela, deux fonctions système supplémentaires vous sont nécessaires : <span id="Is_error_type_(Z852)"></span> ==== Tester le type d'erreur (Z852) ==== La fonction {{Z|Z852}} est intégrée avec ZID <code>Z852</code> et prend deux arguments : * '''Error''' – objet {{Z|Z5}}, qui peut être émis par un appel en échec. Une instance d'erreur possède un type et une valeur. * '''Error type''' – référence à un {{Z|Z50}} qui sera comparé au type de l'erreur passé dans le premier argument. S'ils correspondent, la fonction renvoie <code>true</code>. <span id="Get_error_thrown_by_function_call_(Z853)"></span> ==== Récupérer l'erreur générée par l'appel de fonction (Z853) ==== La fonction {{Z|Z853}} est intégrée avec ZID <code>Z853</code> et prend un argument : * '''Function call''' – appel d'une fonction qui peut renvoyer soit une valeur de succès de n'importe quel type, soit générer une erreur. Cette fonction renvoie un {{Z|Z882}} avec un {{Z|Z40}} en première position et un {{Z|Z1}} en seconde position : * Si l'appel de fonction s'exécute avec succès et donc ne produit donc aucune erreur, la paire retournée contiendra <code>False</code> en première position <code>void</code> dans la seconde. * Si l'appel de fonction génère une erreur, la paire retournée contiendra <code>True</code> en première position et l'erreur détectée, en seconde position. Pour utiliser cette fonction dans vos compositions, il est possible que vous deviez utiliser les fonctions supplémentaires : * {{Z|Z821}}, et * {{Z|Z822}} <span id="Testing_errors"></span> ==== Tester les erreurs ==== Disons que notre fonction cible, ''Joindre deux chaînes avec un espace'' ou <code>Z30000</code>, génère une erreur de type <code>Z30005</code> et nous voulons tester ce comportement. Pour ce faire, nous devons : * Génèrer un appel à une fonction en échec * Récupérer l'erreur en utilisant la fonction {{Z|Z853}} * Vérifier que l'erreur est du bon type avec {{Z|Z852}} Les tests ont deux champs : * '''Call''' – appel de fonction générant une sortie d'après les valeurs des entrées à tester. Cet appel renvoie une valeur. * '''Result validation''' – appel de fonction qui valide que la valeur renvoyée par l'appel ci-dessus est bien celle qui était attendue. Le premier argument ce cet appel de fonction sera automatiquement attribué comme étant la valeur renvoyée par le premier appel. Pour les instructions pas à pas sur la manière de créer des tests, voir {{ll|Wikifunctions:Introduction#Create_tests}}. Dans notre exemple, nous pouvons le structurer de la manière suivante — mais elle n'est pas la seule ! L'appel qui va renvoyer un objet {{Z|Z5}} : <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> Et la validation du résultat, qui prend l'objet {{Z|Z5}} comme son premier argument : <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> Faisons cela progressivement : # Commencez par ajouter un test en cliquant sur le bouton <code>+</code> dans la table ''Tests'' de votre page Fonction. Les champs ''call'' et ''result validation'' ont déjà certaines fonctions prédéfinies, mais pour tester les erreurs, nous devons les modifier. # D'abord, définissons l'appel : ## Sous ''call'', cliquer sur le bouton du chevron <code>›</code> pour développer l'appel de fonction. ## Sous ''function'', modifier le champ et chercher puis sélectionner la fonction ''Get second element of a typed pair'' ## Une fois sélectionné, à côté de ''Typed pair'' cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction''. ## Sous ''fonction'', chercher et sélectionner la fonction ''Get error thrown by function call'' ## À côté de ''Appel de fonction'', cliquer sur le bouton <code>...</code> et sélectionner ''Appel de fonction''. ## Sous ''fonction'', chercher et sélectionner la fonction "Join two strings with a space" (ou par ZID <code>Z30000</code>) ## Maintenant définir les entrées de sorte à provoquer une faute : au moins l'une d'entre-elles doit être vide. ## Vous pouvez maintenant, si vous le souhaitez, replier votre appel en cliquant à nouveau sur le bouton avec le chevron vers le bas ! # Puis, définir la validation du résultat : ## Sous ''validation des résultats'', cliquer sur le bouton <code>›</code> pour développer l'appel de fonction. ## Sous ''fonction'', modifier le champ et recherchez et sélectionnez la fonction ''Is error type'' ## Maintenant on vous demandera de ne configurer que le deuxième argument. Sous ''error type'' chercher et sélectionner le type de votre erreur <code>Z30005</code> . # Voila, c'est terminé ! Vous pouvez maintenant cliquer sur la flèche circulaire dans la boîte ''Implémentations'' et vous verrez les cases vertes cochées. Si tout c'est bien passé vous pouvez maintenant sauvegarder votre test. Il doit ressembler à : [[File:Get error expanded.png|frame|center|alt=Tester un échec en utilisant les fonctions ''Get error'' et ''Is error type'', en mode développé|Tester un échec en utilisant les fonctions ''Get error'' et ''Is error type'', en mode développé]] [[File:Get error collapsed.png|frame|center|alt=Tester un échec en utilisant les fonctions ''Get error'' et ''Is error type'', en mode replié|Tester un échec en utilisant les fonctions ''Get error'' et ''Is error type'' en mode replié]] <span id="Debugging_your_implementations"></span> == Deboguer vos implémentations == Parfois, les choses peuvent mal se passer. Une fonction peut se comporter différemment de ce à quoi on s'attendait ou une valeur peut ne pas ressembler parfaitement. Parfois, les implémentations sont vraiment complexes et, parce qu'elles sont exécutées dans un environnement de type bac à sable, il peut sembler très difficile de les déboguer. Pour comprendre ce qui se passe à l'intérieur d'un appel de fonction, Wikifunctions fournit un petit ensemble d'outils de débogage. Ces outils ne changent pas le résultat d'une fonction, mais ajoutent des informations supplémentaires aux métadonnées renvoyées, que vous pouvez observer après avoir exécuté la fonction. Vous pouvez utiliser <code>Wikifunctions.Debug()</code> dans vos implémentations de code ou la fonction {{Z|Z854}} pour vos compositions. Dans cette section, vous apprendrez : * Comment ajouter des messages de débogage à la fois à partir de l'implémentation du code et des compositions, * comment inspecter les métadonnées manuellement ou via l'interface utilisateur pour explorer ces journaux. <span id="Debugging_your_code_implementations"></span> === Deboguer vos implémentations de code === Lorsque vous écrivez du code, à la fois en JavaScript ou en Python3, vous pouvez utiliser <code>Wikifunctions.Debug()</code> pour ajouter un message à votre journal de debogue et continuer l'exécution. <code>Wikifunctions.Debug()</code> a un paramètre, qui est généralement censé être une chaîne de caractères. Cependant, tout autre objet passé en tant que paramètre sera directement converti en chaîne. Si nous voulons ajouter des journaux de débogue à nos implémentations de code pour notre fonction d'exemple ''Join two strings with a space'', nous pouvons le faire, en JavaScript : <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> Et la même chose dans votre implémentation en Python3 sera : <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> De cette façon, peu importe ce qui se passe, nous allons ajouter un message dans vos journaux de débogue : * Si l'appel à la fonction échoue lors de la vérification de la première ou de la deuxième entrée, le résultat de l'exécution sera un échec et il contiendra un journal informatif avec la branche qui n'a pas réussi. * Si l'appel de la fonction réussit — parce que les deux entrées sont valides — l'appel de la fonction renvoie la chaîne jointe, mais les métadonnées renvoyées contiendront aussi un journal de débogue. <span id="Debugging_your_compositions"></span> === Deboguer vos compositions === Pour soutenir les compositions de débogue, Wikifunctions fournit la fonction intégrée {{Z|Z854}}. Cette fonction vous permet d'attacher des messages de débogue à l'exécution de tout appel de fonction qui génère la sortie finale. Les journaux de débogue recueillis pendant l'évaluation sont renvoyés dans le cadre des métadonnées d'exécution, sous la clé <code>executorDebugLogs</code>. <span id="Add_debug_log_to_function_call_(Z854)"></span> ==== Ajouter les journaux de débogue à l'appel de fonction (Z854) ==== La fonction {{Z|Z854}} est intégrée avec ZID <code>Z854</code> et prend deux arguments : * '''Function call''' – toute composition que vous voulez exécuter. * '''Debug log''' – un message textuel qui sera sauvegardé si l'appel de la fonction est évalué. Lorsque l'appel de fonction enveloppe est exécuté, le message fourni est ajouté aux journaux d'exécution. Si cette appel de fonction n'est pas exécuté ou si son exécution ne fait pas partie de la sortie finale, son journal de débogage n'apparaîtra pas dans les métadonnées du résultat final. Vous bénéficiez de cette intégration si vous voulez observer : * Branche exécutée d'une condition, ou * ordre d'évaluation d'une composition. <span id="Using_Add_debug_log_to_function_call"></span> ==== Utiliser l'ajout de journaux de débogue à l'appel de fonction ==== Supposons que vous souhaitez jouter des journaux de débogage à notre fonction d'exemple ''Join two strings with a space'' ou <code>Z30000</code>, de sorte que différents messages soient ajoutés aux différents résultats possibles. Vous pourriez utiliser notre débogage intégré comme ceci : <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> Ainsi, * lorsqu'elle est appelée avec une première entrée vide, la fonction renvoie une réponse d'échec, et les métadonnées contiennent une entrée <code>executorDebugLogs</code> avec une trace ''failed on first input''. * Si l'appel est fait avec une seconde entrée qui est vide, il va échouer aussi mais le message journalisé sera ''failed on second input'' * Lorsque l'appel est effectué avec des entrées valides, la fonction renvoie une réponse de succès avec des métadonnées contenant ''both inputs are ok'' dans sa clé <code>executorDebugLogs</code>. Voici à quoi ressemblerait cette composition : [[File:Add debug log expanded.png|frame|center|alt=Implémentation de composition en utilisant ''Add debug logs'' pour enregistrer toutes les pattes d'exécution possibles|Implémentation de composition en utilisant ''Add debug logs'' pour enregistrer toutes les pattes d'exécution possibles]] <span id="Accessing_execution_debug_logs"></span> === Accès aux journaux de débogue de l'exécution === Que vos journaux d'exécution soient ajoutés via <code>Wikifunctions.Debug()</code> ou via la fonction intégrée {{Z|Z854}} , ils sont renvoyés dans le cadre des métadonnées de réponse. Pour voir les journaux, une fois que vous avez exécuté votre fonction, cliquer sur le bouton ''Details'' qui apparaît en bas de la section ''Résultat''. L'erreur et les informations de debug apparaissent en haut de la boîte de dialogue des ''Détails''. Voici ce que vous obtenez lorsque vous exécutez la composition de notre exemple précédent avec des entrées valides et d'autres invalides : {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=Dialogue des métadonnées de la fonction pour une exécution avec succès, avec les journaux de debogue.]] | [[File:Execution logs failure.png|frameless|center|alt=Dialogue des métadonnées de la fonction pour une exécution en échec, avec les journaux de debogue.]] |- | Dialogue des métadonnées de la fonction pour une exécution avec succès : pas d'erreur affichée, mais affiche le journal d'exécution avec succès : ''"both inputs are ok!"'' | Dialogue des métadonnées de la fonction pour une exécution en échec : affichage des informations d'erreur, et du journal d'exécution supplémentaire pour la première branche en échec : ''"failed on first input"'' |} [[Category:How to create implementations| {{#translation:}}]] rsgxb5jk5fj6x6748qmhawhiq86rhng Wikifunctions:How to create implementations/uk 4 16127 276461 240264 2026-05-20T06:15:47Z FuzzyBot 207 Updating to match new version of source page 276461 wikitext text/x-wiki <languages/> Ця сторінка надає більш детальні інструкції щодо того '''як створювати реалізації''', ніж короткий огляд на сторінці {{ll|Wikifunctions:Introduction}}. <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> Далі ми надаємо конкретний приклад того, як створювати Реалізації у вигляді Коду на Python. Скажімо, ми хочемо створити реалізацію Функції, яка комбінує два рядки вводу вставивши між ними пробіл, і повертає результат цього. Давайте припустимо, що ZID такої функції Z11057. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == Композиція == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] 7k348ua9hh7w3o0rk1c14dty3jywwut Wikifunctions:What Wikifunctions is not/sv 4 17423 276290 190633 2026-05-19T19:22:56Z Tommy Kronkvist 1985 Created page with "== Wikifunctions är inte en encyklopedi över algoritmer ==" 276290 wikitext text/x-wiki <languages/> {{Draft}} <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions is a new kind of website, aiming for a new community. We very much hope to work together with many tools, sites, communities, and kinds of systems that are out there: we want to play together with IDEs, with cloud computing platforms, with app development sites, and many more. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> But we also aim to be a novel thing and we hope to shape a new unique space out for us: a Wikimedia project for everyone to collaboratively create and maintain a library of code functions to support the Wikimedia projects and beyond, for everyone to call and re-use in the world's natural and programming languages. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The scope of the project is within bounds, though. So, let us also explore '''what Wikifunctions is not'''. </div> <span id="Wikifunctions_is_not_an_encyclopædia_of_algorithms"></span> == Wikifunctions är inte en encyklopedi över algoritmer == <div lang="en" dir="ltr" class="mw-content-ltr"> This means that we will '''not''' concentrate on having pages for famous and not-so famous algorithms such as [[w:Euclidean algorithm|Euclid's]], [[w:Newton's method|Newton's]], or [[w:Dijkstra's algorithm|Dijkstra's algorithm]], aiming to represent all existing algorithms faithfully and in their historical context. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Yes, we expect to have a function for the [[w:Greatest common divisor|greatest common divisor]] (GCD) of two integers. And there might be one or more implementations which are based on Euclid's algorithm to calculate the GCD. But Wikifunctions' main goal is not to gather algorithms, and it would not be incomplete if it didn't include some, and used alternatives instead to compute the GCD. If you are looking for that, many Wikipedias are actually [[w:List of algorithms|great resources]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Unlike an encyclopedic overview of existing algorithms, Wikifunctions will also invite original work. We will not be restricted to functions that have been published elsewhere first, and we do not require for every function and implementation to be based on previously published work. Wikifunctions, much like Wikibooks and very unlike Wikipedia, will be open to novel contributions. The main criteria for implementations will be: under which conditions can we run a given implementation, and what resources is it expected to take? </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not an app development site == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> We do not expect to make it possible to create full-fledged, stand-alone apps within Wikifunctions — there will be no place to store state, we don't aim to allow calling external APIs or directly cause changes to other sites, and we don't aim to package up apps with icons and UX, etc. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> We absolutely expect Wikifunctions to be a very useful resource for app developers, and can very much imagine apps that are basically wrappers around one or more functions from Wikifunctions, but these would still need code and other assets which wouldn't be part of Wikifunctions. We are not competing in the area of no-code or low-code development sites. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not a code hosting service == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions will host code — but not for whole projects, merely for individual functions. There won't be libraries, apps, or services developed on Wikifunctions with bug-trackers, forums, etc. There won't be a Web-based version control system such as ''Mercurial'' or ''Git'' running against Wikifunctions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Again, we hope that there will be libraries, apps, and services that will rely on functions available in Wikifunctions, but they would be developed on a different site, such as ''Gerrit'', ''GitHub'', or ''GitLab''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not a programming language, nor is trying to evangelise a particular language == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions will allow for functions to be implemented in a multitude of programming languages. The possibility to compose functions together to create higher level functions may look a little bit like a new programming language, but it will be extremely limited compared to most other programming languages, since we only allow for nested function calls and that's it. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not an Integrated Development Environment (IDE) == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> We won't provide you with an interface for creating and developing software projects, interfacing with build, testing, and source control systems. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not a question-and-answer website == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> We are not competing with ''Stack Overflow'' and similar websites, where a developer would ask how to achieve a certain task and have community members discuss and answer the question. We won't contain code snippets to help answer the question, but we will organize code within our website to enable the evaluation of functions within a library of functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not a cloud computing platform == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> We do not provide computing resources and access to services and APIs so that you can run your computational needs on our platform, either for money or for free. Use of Wikifunctions's evaluation platform is to improve access to knowledge for everyone. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not a code snippet website == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> We are not competing with code snippet sites such as GitHub Gists, [[w:Rosetta_Code|Rosetta Code]], [https://esolangs.org/ esolangs.org], or [http://helloworldcollection.de/ helloworldcollection.de]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions differs in that it allows running code and composing existing functions together to create new ones. As well, Wikifunctions is for useful and meaningful code, not temporary, arbitrary snippets that other platforms may accept. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions is not a code education platform == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> We are not focused on teaching people how to code, the material in Wikifunctions will not be laid out in a pedagogical order, and we also won't make sure to comprehensively cover all topics important for coding. In fact, we aim for Wikifunctions to be usable for people who don't know how to code and who don't need to learn how to code to use most of Wikifunctions effectively. Though the Wikifunctions community may well help each other in sharing best practices, style guides, and tips on how to use the site in different languages, these will be aimed at the purpose of serving the world's knowledge. </div> [[Category:Project concept{{#translation:}}]] 0nk72hxhg0dazmbd2gle3739sbujcj2 Wikifunctions:How to create implementations/ru 4 17562 276457 240259 2026-05-20T06:15:43Z FuzzyBot 207 Updating to match new version of source page 276457 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Compositions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] gqduotf6d59h7zdhzx2eqwlcgy8hdq8 Wikifunctions:How to create implementations/pl 4 20044 276456 255312 2026-05-20T06:15:43Z FuzzyBot 207 Updating to match new version of source page 276456 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> lub ... <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <span id="Code_implementations"></span> == Implementacje kodu == [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <span id="Code_in_Python"></span> === Kod w Pythonie === <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Ponieważ to Python, nie zapomnij o wcięciu tej linii. <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Compositions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] ktoznis980hp6cc2fdd0pufb5pshze4 Wikifunctions:How to create implementations/id 4 21080 276451 240253 2026-05-20T06:15:37Z FuzzyBot 207 Updating to match new version of source page 276451 wikitext text/x-wiki <languages/> Halaman ini menyediakan panduan yang lebih rinci untuk '''membuat implementasi''', di luar gambaran umum di {{ll|Wikifunctions:Introduction}}. <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> Di bawah ini kami memberikan contoh konkret tentang cara membuat Implementasi dalam bentuk Kode berbahasa Python. Misalnya kita ingin membuat implementasi untuk Fungsi yang menggabungkan dua untaian masukan dengan menyisipkan spasi di antara mereka, dan memberikan hasil dari itu. Mari kita asumsikan ZID fungsi itu adalah Z11057. </div> <div class="mw-translate-fuzzy"> Implementasi didefinisikan menggunakan ZID fungsi. Begitu juga dengan argumen fungsi. Jadi dalam kasus fungsi Z11057 dengan dua argumennya, baris pertama haruslah seperti ini: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Karena ini Python, jangan lupa tambahkan indentasi di baris ini. <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> Ingat bahwa selama waktu eksekusi, keadaan tidak disimpan. Jangan menganggap ada nilai variabel global atau statis. Jika Anda memiliki pertanyaan lebih lanjut tentang apa yang dapat dan tidak dapat Anda lakukan di Python, tanyakan di [[Wikifunctions:Python implementations]]. <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div class="mw-translate-fuzzy"> Di bawah ini kami memberikan contoh konkret tentang cara membuat Implementasi dalam bentuk Kode berbahasa JavaScript. Misalnya kita ingin membuat implementasi untuk Fungsi yang menggabungkan dua untaian masukan dengan menyisipkan spasi di antara mereka, dan memberikan hasil dari itu. Mari kita asumsikan ZID fungsi itu adalah Z11057. </div> <div class="mw-translate-fuzzy"> Implementasi didefinisikan menggunakan ZID fungsi. Begitu juga dengan argumen fungsi. Jadi dalam kasus fungsi Z11057 dengan dua argumennya, baris pertama haruslah seperti ini: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> Ingat bahwa selama waktu eksekusi, keadaan tidak disimpan. Jangan menganggap ada nilai variabel global atau statis. Jika Anda memiliki pertanyaan lebih lanjut tentang apa yang dapat dan tidak dapat Anda lakukan di JavaScript, tanyakan di [[Wikifunctions:JavaScript implementations]]. <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == Komposisi == </div> <div class="mw-translate-fuzzy"> Di bawah ini kami memberikan contoh konkret tentang cara membuat Implementasi dalam bentuk komposisi. Misalnya kita ingin membuat implementasi untuk Fungsi yang menggabungkan dua untaian masukan dengan menyisipkan spasi di antara mereka, dan memberikan hasil dari itu. Mari kita asumsikan ZID fungsi itu adalah Z11057. </div> <div class="mw-translate-fuzzy"> Biasanya lebih baik memulai dengan memikirkan cara menggabungkan fungsi yang ada untuk menciptakan keluaran yang diinginkan. Kadang-kadang ini mungkin terasa sangat mudah dan Anda bisa langsung saja mengomposisi fungsi, tetapi dalam banyak kasus sebaiknya komposisi yang diinginkan dicatat terlebih dahulu. Antarmuka komposisi Wikifunctions belum cukup baik dalam menyunting komposisi, jadi lebih baik cari tahu terlebih dahulu apa yang Anda ingin membuat. </div> <div class="mw-translate-fuzzy"> Sebagai contoh, untuk membuat Fungsi yang diminta, kita bisa menggunakan [[{{Z|Z10000}}|''Fungsi penyambung untaian'']] yang ada. Fungsi yang itu menerima dua untaian dan menghasilkan satu untaian dari keduanya. Namun, kita ingin menambahkan spasi di antara mereka. Jadi, pertama-tama kita sambungkan spasi ke ujung untaian pertama, lalu sambungkan untaian kedua ke hasil penyambungan pertama. Jadi komposisi kita bisa dicatat seperti berikut: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] t5ymjfnqfx280hnvqp46vptg3htodt1 Wikifunctions:How to create implementations/bn 4 22538 276445 240247 2026-05-20T06:15:33Z FuzzyBot 207 Updating to match new version of source page 276445 wikitext text/x-wiki <languages/> এই পৃষ্ঠাটি {{ll|Wikifunctions:Introduction}} এ প্রদত্ত সংক্ষিপ্তসারের তুলনায় একটি '''বাস্তবায়ন তৈরি করা''' সম্পর্কিত আরও বিস্তারিত নির্দেশিকা প্রদান করে। <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> নিম্নলিখিতগুলিতে আমরা পাইথনে কোড আকারে কীভাবে একটি বাস্তবায়ন তৈরি করতে হয় তার একটি সুনির্দিষ্ট উদাহরণ প্রদান করি। ধরুন আমরা একটি ফাংশনের জন্য একটি বাস্তবায়ন তৈরি করতে চাই যা দুটি ইনপুট অক্ষরসারিকে (স্ট্রিং) তাদের মধ্যে একটি খালি স্থান রেখে একত্রিত করবে এবং তাদের ফলাফলটি ফেরত দেয়। ধরা যাক সেই ফাংশনের Z-আইডি হল Z11057। </div> <div class="mw-translate-fuzzy"> বাস্তবায়নের সংজ্ঞা দেওয়া হয় ফাংশনের Z-আইডি ব্যবহার করে। একই ভাবে ফাংশনের আর্গুমেন্টও গুলোকেও। সুতরাং ফাংশন Z11057 এর ক্ষেত্রে তার দুটি আর্গুমেন্ট সহ, প্রথম লাইনটি দেখতে হবে: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> যেহেতু এটি পাইথন, তাই এই লাইনটি ইন্ডেন্ট করতে ভুলবেন না। <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> মনে রাখবেন যে রানটাইমের কোনও অবস্থা নেই। গ্লোবাল বা স্ট্যাটিক ভেরিয়েবলের মান ধরে নেবেন না। পাইথনে কী করতে পারেন এবং কী করতে পারেন না সে সম্পর্কে আপনার যদি আরও প্রশ্ন থাকে, তাহলে [[Wikifunctions:Python implementations]] পাতায় জিজ্ঞাসা করুন। <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div class="mw-translate-fuzzy"> নিম্নলিখিতগুলিতে আমরা জাভাস্ক্রিপ্টে কোড আকারে কীভাবে একটি বাস্তবায়ন তৈরি করতে হয় তার একটি সুনির্দিষ্ট উদাহরণ প্রদান করি। ধরুন আমরা একটি ফাংশনের জন্য একটি বাস্তবায়ন তৈরি করতে চাই যা দুটি ইনপুট অক্ষরসারিকে (স্ট্রিং) তাদের মধ্যে একটি খালি স্থান রেখে একত্রিত করবে এবং তাদের ফলাফলটি ফেরত দেয়। ধরা যাক সেই ফাংশনের Z-আইডি হল Z11057। </div> <div class="mw-translate-fuzzy"> বাস্তবায়নের সংজ্ঞা দেওয়া হয় ফাংশনের Z-আইডি ব্যবহার করে। একই ভাবে ফাংশনের আর্গুমেন্টও গুলোকেও। সুতরাং ফাংশন Z11057 এর ক্ষেত্রে তার দুটি আর্গুমেন্ট সহ, প্রথম লাইনটি দেখতে হবে: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> মনে রাখবেন যে রানটাইমের কোনও অবস্থা নেই। গ্লোবাল বা স্ট্যাটিক ভেরিয়েবলের মান ধরে নেবেন না। আপনি জাভাস্ক্রিপ্টে কী করতে পারেন এবং কী করতে পারেন না সে সম্পর্কে আপনার যদি আরও প্রশ্ন থাকে, তাহলে [[Wikifunctions:JavaScript implementations]]-এ জিজ্ঞাসা করুন। <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == ফাংশন প্রণয়ন == </div> <div class="mw-translate-fuzzy"> নিম্নলিখিতগুলিতে আমরা একটি প্রণয়ন আকারে বাস্তবায়ন তৈরি করার সুনির্দিষ্ট উদাহরণ প্রদান করি। ধরুন আমরা একটি ফাংশনের জন্য একটি বাস্তবায়ন তৈরি করতে চাই যা দুটি ইনপুট স্ট্রিংকে তাদের মধ্যে একটি খালি স্থান ছেড়ে একত্রিত করে এবং তার ফলাফলটি ফেরত দেয়। ধরা যাক সেই ফাংশনের Z-আইডি হল Z11057। </div> <div class="mw-translate-fuzzy"> পছন্দসই আউটপুট তৈরি করার জন্য বিদ্যমান ফাংশনগুলিকে কীভাবে একত্রিত করা যায় সে সম্পর্কে প্রথমে চিন্তা করা সাধারণত একটি ভাল ধারণা। কখনও কখনও এটি তুচ্ছ হতে পারে এবং আপনি কেবল প্রণয়নকৃত ফাংশন নিয়ে এগিয়ে যেতে পারেন, তবে অনেক ক্ষেত্রে পছন্দসই প্রণয়নটি নোট করা উপযুক্ত। ফাংশন প্রণয়ন সম্পাদনার ক্ষেত্রে উইকিফংশন প্রণয়ন ইন্টারফেসটি এখনও খুব ভাল নয়, তাই আপনি ঠিক কী তৈরি করতে চান তা প্রথমে নির্ধারণ করা ভাল। </div> <div class="mw-translate-fuzzy"> উদাহরণস্বরূপ, প্রদত্ত ফাংশনের জন্য, আমরা বিদ্যমান [[{{Z|Z10000}}|''অক্ষরসারি গুলোকে সংযুক্ত করার ফাংশন'']] ব্যবহার করতে পারি। সেই ফাংশনটি দুটি অক্ষরসারি নেয় এবং তাদের একটি অক্ষরসারিতে পরিণত করে। কিন্তু আমাদের তাদের মাঝে একটি শূন্যস্থান যোগ করতে হবে। তাই আমরা প্রথমে, প্রথম অক্ষরসারির শেষে একটি শূন্যস্থান সংযুক্ত করি এবং তারপর সেই প্রথম অক্ষরসারির ফলাফলের সাথে দ্বিতীয় অক্ষরসারিটিকে সংযুক্ত করি। সুতরাং আমাদের প্রণয়নটিকে এইভাবে বর্ণনা করা যেতে পারে: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] omkpqhf28qbq6025y9cdgzry9xomjd0 Category:Status updates 14 22741 276537 275151 2026-05-20T06:24:26Z Ameisenigel 44 276537 wikitext text/x-wiki <languages/> <translate></translate>{{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 1kfed3w40efhc58ow3bmmwmu58vu61c Wikifunctions:Status updates/de 4 22906 276442 275012 2026-05-20T06:14:35Z Ameisenigel 44 Created page with "$1: Eine höhere Bedeutung" 276442 wikitext text/x-wiki <languages/> {{shortcut|WF:SU}}{{notice|1='''[[:m:Global message delivery/Targets/Wikifunctions & Abstract Wikipedia|Abonniere]]''' kurze MassMessage-Benachrichtigungen im Wiki über jede neue Ausgabe.}} {{Wikifunctions updates | prevlabel = Vorheriges Update | prev = 2024-02-01 | nextlabel = Letztes Update | next = 2026-05-15 }} Es passiert viel rund um Wikifunctions und die Abstrakte Wikipedia. Auf dieser Seite werden unsere Updates veröffentlicht, inklusive der [[Special:MyLanguage/WF:function of the Week|Funktion der Woche]]. Du kannst auch den [[:m:Global message delivery/Targets/Wikifunctions & Abstract Wikipedia|On-Wiki-Newsletter]] abonnieren, um sie auf deine Diskussionsseite oder die Projektdiskussion deines Projekts geliefert zu bekommen. <inputbox> type=fulltext prefix={{NAMESPACE}}:{{PAGENAME}}/ break=no width=30 searchbuttonlabel={{int:Search}} placeholder=Suchen Sie nach allen Status-Updates </inputbox> <span id="Newsletters"></span> == Newsletter == <!--<nowiki> Newsletter entry template: * <translate><tvar name="1">{{Status updates|2026-0?-??}}</tvar>: Title</translate> NOTE: Remember to also update the "next =" date at the top of this page. </nowiki>--> === 2026 === * {{Status updates|2026-05-15}}: Eine höhere Bedeutung * {{Status updates|2026-05-08}}: Einzelnachweise aus Wikidata jetzt verfügbar * {{Status updates|2026-05-02}}: Bitte um Anregungen: Was sollten wir für die Abstrakte Wikipedia zählen? * {{Status updates|2026-04-25}}: Die Suche der Foundation nach der perfekten Sprache * {{Status updates|2026-04-16}}: Meilensteine; Einige größere Probleme hoffentlich behoben * {{Status updates|2026-04-10}}: Community-Vorschläge zur Erfassung von Bedeutungen * {{Status updates|2026-04-02}}: Diskussionsanfrage: Syntaktische Tabellen * {{Status updates|2026-03-26}}: Erste Tage der Abstrakten Wikipedia Beta; Status der Kompositionssprache v2 * {{Status updates|2026-03-19}}: Abstrakte Wikipedia in Beta * {{Status updates|2026-03-11}}: Eine neue Kompositionssprache * {{Status updates|2026-03-06}}: Einzelnachweise und Kopieren und Einfügen * {{Status updates|2026-02-26}}: Elegante Überschreibungen und Rückfalllösungen * {{Status updates|2026-02-20}}: Eine Vorschau auf die Abstrakte Wikipedia * {{Status updates|2026-02-13}}: Sätze des anderen beenden: Dinge anfangen; Treffen in Istanbul * {{Status updates|2026-01-29}}: Integration der Abstrakten Wikipedia * {{Status updates|2026-01-22}}: Vierteljährliche Planung für Januar–März 2026 * {{Status updates|2026-01-15}}: 25 Jahre Wikipedia === 2025 === * {{Status updates|2025-12-18}}: Wir wünschen euch ein frohes neues gregorianisches Jahr! * {{Status updates|2025-12-11}}: Wie man bessere Fehlermeldungen schreibt * {{Status updates|2025-12-04}}: Und der Name ist Abstrakte Wikipedia * {{Status updates|2025-11-27}}: Stimme über den Namen für das neue Wiki ab!; Sätze des anderen beenden * {{Status updates|2025-11-20}}: Zweite Abstimmungsrunde über den Namen des Wikis mit sprachunabhängigen Inhalten; Teilen von Funktionsaufrufen * {{Status updates|2025-11-13}}: Vorbereitung für die zweite Abstimmungsrunde über den Namen des Wikis mit abstraktem Inhalt; Neuschreiben des Back-Ends: Warum Rust? * {{Status updates|2025-11-05}}: Erste Runde der Abstimmung über den Namen für das Wiki der Abstrakten Inhalte beendet; Aufruf für Wiktionary-Funktionen; Eingebettete Wikifunctions in der bengalischen Wikipedia und sieben weiteren Wiktionarys * {{Status updates|2025-10-29}}: Runde 1 der Abstimmung über den Namen für das “Wiki der Abstrakten Inhalte” endet Montag; Ein Beispiel für Kurzbeschreibungen * {{Status updates|2025-10-23}}: Willkommen, Zaree und Laura! Runde 1 des Namenswettbewerbs gestartet * {{Status updates|2025-10-15}}: Start des Namenswettbewerbs für die Abstrakte Wikipedia; Visualisierung von Funktionen * {{Status updates|2025-10-08}}: Entscheidung über den Ort für abstrakte Inhalte und Quartalsplanung für Oktober–Dezember * {{Status updates|2025-10-03}}: Rich Text jetzt in eingebetteten Funktionsaufrufen in 148 Wiktionarys und im Incubator verfügbar * {{Status updates|2025-09-26}}: Zugriff auf Qualifikatoren in Wikidata-Aussagen * {{Status updates|2025-09-19}}: Wikifunctions in 123 Wiktionary-Sprachversionen verfügbar * {{Status updates|2025-09-12}}: Mehr als 3000 Funktionen auf Wikifunctions * {{Status updates|2025-09-07}}: Funktionsaufrufe aus einer Wikipedia in eine andere kopieren * {{Status updates|2025-08-29}}: Zugriff auf Wikidata-Datenobjekte über eingebettete Funktionsaufrufe nun möglich; Wikifunctions in 65 Wiktionarys verfügbar * {{Status updates|2025-08-22}}: Aufzeichnung der Wikimania-Sitzung: Wikifunctions kommt bald in ein Wiki in deiner Nähe! * {{Status updates|2025-08-01}}: Die Wikimania 2025 kommt bald! * {{Status updates|2025-07-26}}: “Wikipedia ist eine Enzyklopädie”; Zwei Jahre Wikifunctions * {{Status updates|2025-07-19}}: Wikidata-basierte Aufzählungen sind da * {{Status updates|2025-07-10}}: Längenbeschränkungen für Bezeichnungen und Beschreibungen * {{Status updates|2025-07-04}}: Abdeckung von 1298 * {{Status updates|2025-06-27}}: Wie viele Personen werden benötigt, um eine Enzyklopädie zu schreiben? * {{Status updates|2025-06-21}}: Quartalsplanung für Juli-September 2025 * {{Status updates|2025-06-15}}: Ende der Konsultation über den Ort des Abstrakten Inhalts * {{Status updates|2025-06-06}}: Wo wird sich der Abstrakte Inhalt befinden? * {{Status updates|2025-05-29}}: Einführung in fünf Wiktionarys; Berechnung mit dem heutigen Datum * {{Status updates|2025-05-23}}: Laufende Konsultation über den Ort des Abstrakten Inhalts * {{Status updates|2025-05-15}}: Ort des Abstrakten Inhalts * {{Status updates|2025-05-09}}: Abstrakte Wikipedia und die Wikimedia KI-Strategie * {{Status updates|2025-04-30}}: Abstrakte Wikipedia ist Finalist bei MacArthur 100&Change * {{Status updates|2025-04-25}}: Willkommen, Gregory! * {{Status updates|2025-04-16}}: Wikifunctions integriert in Dagbani - und Wikifunctions; und das Osterdatum * {{Status updates|2025-04-11}}: Rückblick auf das Quartal * {{Status updates|2025-04-05}}: Vierteljährliche Planung für April–Juni 2025; Wir suchen nach einem Leitenden Produktmanager * {{Status updates|2025-03-28}}: Es ist Zeit * {{Status updates|2025-03-20}}: Auf Wikidata basierende einfache Aufzählungen * {{Status updates|2025-03-15}}: Anstehendes NLG-Treffen, letzte Änderungen an der Software * {{Status updates|2025-03-07}}: Letzte Änderungen an der Software, Aufzeichnung des Freiwilligentreffens und Vorträge in London * {{Status updates|2025-02-26}}: Von Dingen zu Worten * {{Status updates|2025-02-19}}: Ein Vorschlag für Typen je Sprache und Wortart * {{Status updates|2025-02-13}}: Die Welt begrenzen * {{Status updates|2025-02-06}}: Einladung zur Natural Language Generation Special Interest Group * {{Status updates|2025-01-29}}: Mit 2000 Funktionen ins neue Jahr: Zeit für Statistiken * {{Status updates|2025-01-22}}: Willkommen, David! Empfehlungen zu Namenskonventionen * {{Status updates|2025-01-15}}: Einen frohen Wikipedia-Tag! Vierteljährliche Planung === 2024 === * {{Status updates|2024-12-19}}: Funktion der Woche: Alter; Intro für Artikel über Jahre; Neuer Typ: Gleitkommazahl * {{Status updates|2024-12-12}}: Skizzieren eines Pfads zur Abstrakten Wikipedia; Offsite des Teams in Lissabon; und vieles mehr * {{Status updates|2024-11-27}}: WordGraph-Veröffentlichung; Neue Spezialseite: Funktionen nach Tests auflisten; neuer Typ für Tag des Jahres und viel mehr * {{Status updates|2024-11-21}}: Neue Spezialseite für fehlende Bezeichnungen, neuer Typ für Gregorianische Jahre und viel mehr * {{Status updates|2024-11-13}}: Neuer Typ: rationale Zahl; Dokumentation zu Wikidata-basierten Typen; und mehr * {{Status updates|2024-11-07}}: Der Traum einer universellen Sprache * {{Status updates|2024-11-01}}: Neuschreiben des Back-Ends * {{Status updates|2024-10-25}}: Unser Ziel für dieses Quartal: Kongruenz * {{Status updates|2024-10-17}}: Wie könnte abstrakter Inhalt aussehen? * {{Status updates|2024-10-11}}: Wikidata-Lexeme sind in Wikifunctions bald verfügbar * {{Status updates|2024-10-02}}: Fokusthema: Essen * {{Status updates|2024-09-26}}: Vierteljährliche Planung für Oktober bis Dezember 2024; Präsentation bei Celtic Knot morgen * {{Status updates|2024-09-20}}: Einführung von Fokus-Themenbereichen * {{Status updates|2024-09-13}}: Die Dagbani-Wikipedia wird unser erstes Wiki für die Integration von Wikifunctions sein * {{Status updates|2024-09-06}}: Freiwilligentreffen und andere Neuigkeiten * {{Status updates|2024-08-29}}: Beschränkungen für die Länge von Namen und Beschreibungen * {{Status updates|2024-08-23}}: WasmEdge, jetzt 300 ms weniger langsam * {{Status updates|2024-08-16}}: Ausgabe zur Wikimania 2024 * {{Status updates|2024-08-02}}: Überarbeitung unseres 'Info'-Widgets * {{Status updates|2024-07-26}}: Bald findet die Wikimania 2024 statt! * {{Status updates|2024-07-18}}: Forschungsbericht zur Integration von Wikifunctions in Wikipedia * {{Status updates|2024-07-10}}: Typen-Vorschläge für den Zugriff auf Lexeme * {{Status updates|2024-07-03}}: Vierteljährliche Planung * {{Status updates|2024-06-26}}: Willkommen, Daphne! * {{Status updates|2024-06-20}}: Neuer Typ: Integer * {{Status updates|2024-06-13}}: Neuer Typ: Monate des Igbo-Kalenders * {{Status updates|2024-06-06}}: Neuer Typ: Zeichen * {{Status updates|2024-05-30}}: Ein einziger Singular oder eine Vielzahl von Pluralen? * {{Status updates|2024-05-22}}: Neuer Typ: Monate des Gregorianischen Kalenders * {{Status updates|2024-05-15}}: Aufruf zur Erstellung von Funktionen: Ausschreibung von Zahlen! * {{Status updates|2024-05-10}}: Flaggschifftyp für Aufzählungen: Monate des Gregorianischen Kalenders * {{Status updates|2024-05-03}}: Teamtreffen und Quartalsplan * {{Status updates|2024-04-19}}: Willkommen, Sharvani! * {{Status updates|2024-04-11}}: Neue API zum Aufrufen von Wikifunctions und Feier von 1000 Funktionen * {{Status updates|2024-04-03}}: Produktneuigkeiten auf Diff und anstehende API-Verbesserungen * {{Status updates|2024-03-28}}: Das Erstellen von Tests ist nun viel einfacher! * {{Status updates|2024-03-21}}: Auf dem Weg zur Internationalisierung von Zahlen * {{Status updates|2024-03-13}}: Zur Identität * {{Status updates|2024-03-07}}: Einführung unseres zweiten neuen Typs: Natürliche Zahlen * {{Status updates|2024-02-28}}: Typenvorschlag für natürliche Zahlen * {{Status updates|2024-02-22}}: Aktualisierung des Funktionsmodells * {{Status updates|2024-02-14}}: Reparatur-Woche * {{Status updates|2024-02-07}}: Vierteljährliche Planung. Danke, Nick! Funktion der Woche: ist Permutation * {{Status updates|2024-02-01}}: Der Igbo-Imperativ! <span id="Before_February_2024"></span> === Vor Februar 2024 === Alle Updates aus dieser Zeit sind [[:m:Special:MyLanguage/Abstract Wikipedia/Updates|im Meta-Wiki verfügbar]]. [[Category:Status updates{{#translation:}}| ]] n5ferruk1trwp4ocbwqqqun680gxmx8 Wikifunctions:Human languages 4 23704 276465 273289 2026-05-20T06:16:46Z Ameisenigel 44 MyLanguage 276465 wikitext text/x-wiki <languages/> {{draft}} <translate> <!--T:1--> Supported by the Natural Language Generation Special Interest Group; see also <tvar name="1">{{ll|WF:PROG}}</tvar> and <tvar name="2">{{ll|WF:Catalogue/Natural language operations}}</tvar>. Many of these are morphological functions; morphology is the part of linguistics that studies how language parts are 'shaped' and change diachronically and when inflected. Hausa, Igbo, Malayalam, Bangla/Bengali and Dagbani are [[<tvar name="1">d:Special:MyLanguage/Wikidata:Lexicographical data/Focus languages</tvar>|focus languages]] for Wikidata's lexicographic dataset, which is an important aspect of [[<tvar name="2">Special:MyLanguage/WF:glossary#Abstract Wikipedia</tvar>|Abstract Wikipedia]]. == Related pages == <!--T:121--> </translate> * <translate><!--T:122--> <tvar name="1">[[:Category:Natural languages]]</tvar> — List of categories for languages</translate> * <translate><!--T:123--> <tvar name="1">{{ll|Wikifunctions:Catalogue/Natural language operations}}</tvar> — Lists of natural language functions</translate> * <translate><!--T:124--> <tvar name="1">{{ll|Wikifunctions:NLG functions}}</tvar> — A table of each supported language's NLG functions</translate> ** <translate><!--T:125--> <tvar name="1">{{ll|Wikifunctions:Cardinal numbers}}</tvar> — List of each language's cardinal number functions</translate> * <translate><!--T:126--> <tvar name="1">{{ll|Wikifunctions:Reserved ZIDs/all#Z1000-Z1999}}</tvar> — List of all languages in ZObject order</translate> <translate> == Afroasiatic == <!--T:38--> </translate> * {{z+|Z1472}} (zgh) — [[/Z1472]] * {{z+|Z1013}} (ha) — [[/Z1013]] * <translate><!--T:127--> Semitic</translate> ** <translate><!--T:128--> Arabic</translate> *** {{z+|Z1001}} (ar) — [[/Z1001]] *** {{z+|Z1045}} (ary) — [[/Z1045]] *** {{z+|Z1582}} (aeb) — [[/Z1582]] ** {{z+|Z1186}} (he) — [[/Z1186]] <translate> == Austroasiatic == <!--T:69--> </translate> * {{z+|Z1048}} (vi) — [[/Z1048]] * (<translate><!--T:129--> Mundari, no code yet</translate>) (unr) <translate> == Austronesian == <!--T:70--> </translate> * <translate><!--T:130--> Malayic</translate> ** {{z+|Z1531}} (ms) — [[/Z1531]] *** {{z+|Z1434}} (ms-arab) — [[/Z1434]] ** {{z+|Z1078}} (id) — [[/Z1078]] * {{z+|Z1471}} (su) — [[/Z1471]] <translate> == Constructed == <!--T:131--> </translate> * {{z+|Z1882}} (ldn) — [[/Z1882]] * {{z+|Z1576}} (eo) — [[/Z1576]] * {{z+|Z1534}} (tlh) — [[/Z1534]] * {{z+|Z1762}} (tok) — [[/Z1762]] <translate> == Dravidian == <!--T:132--> </translate> * {{z+|Z1293}} (brh) — [[/Z1293]] * <translate><!--T:133--> South</translate> ** {{z+|Z1012}} (ml) — [[/Z1012]] ** {{z+|Z1429}} (te) — [[/Z1429]] <translate> == Indo-European == <!--T:80--> </translate> * {{z+|Z1541}} (hy) — [[/Z1541]] * <translate><!--T:134--> Balto-Slavic</translate> ** {{z+|Z1709}} (lv) — [[/Z1709]] ** <translate><!--T:135--> Slavic</translate> *** <translate><!--T:136--> East Slavic</translate> **** {{z+|Z1005}} (ru) — [[/Z1005]] **** {{z+|Z1332}} (uk) — [[/Z1332]] **** {{z+|Z1622}} (by) — [[/Z1622]] *** <translate><!--T:137--> West Slavic</translate> **** {{z+|Z1062}} (cs) — [[/Z1062]] **** {{z+|Z1025}} (pl) — [[/Z1025]] **** {{z+|Z1488}} (sk) — [[/Z1488]] *** <translate><!--T:138--> South Slavic</translate> **** {{z+|Z1823}} (bg) — [[/Z1823]] **** {{z+|Z1105}} (cu) — [[/Z1105]] **** {{z+|Z1412}} (sh) — [[/Z1412]] ***** {{z+|Z1473}} (bs) — [[/Z1473]] ***** {{z+|Z1272}} (hr) — [[/Z1272]] ***** {{z+|Z1498}} (cnr) — [[/Z1498]] ***** {{z+|Z1158}} (sr) — [[/Z1158]] **** {{z+|Z1616}} (sl) — [[/Z1616]] * <translate><!--T:139--> Celtic</translate> ** {{z+|Z1282}} (br) — [[/Z1282]] ** {{z+|Z1024}} (cy) — [[/Z1024]] ** {{z+|Z1339}} (gd) — [[/Z1282]] * <translate><!--T:140--> Germanic</translate> ** <translate><!--T:141--> North Germanic</translate> *** <translate><!--T:142--> East Scandinavian</translate> **** {{z+|Z1061}} (dk) — [[/Z1061]] **** {{z+|Z1592}} (sv) — [[/Z1592]] *** {{z+|Z1021}} (no) — [[/Z1592]] ** <translate><!--T:143--> West Germanic</translate> *** <translate><!--T:144--> North Sea</translate> **** {{z+|Z1002}} (en) — [[/Z1002]] ***** <translate><!--T:145--> North American</translate> ****** {{z+|Z1689}} (en-US) — [[/Z1689]] ****** {{z+|Z1437}} (en-CA) — [[/Z1437]] ***** {{z+|Z1113}} (en-AU) — [[/Z1113]] ***** {{z+|Z1199}} (en-GB) — [[/Z1199]] ***** {{z+|Z1966}} (en-IN) — [[/Z1966]] ***** {{z+|Z1881}} (en-x-piglatin) — [[/Z1881]] ***** {{z+|Z1124}} (en-x-simple) — [[/Z1124]] **** {{z+|Z1146}} (nds) — [[/Z1146]] *** <translate><!--T:146--> High German</translate> **** {{z+|Z1099}} (lb) — [[/Z1099]] **** {{z+|Z1430}} (de) — [[/Z1430]] *** {{z+|Z1157}} (nl) — [[/Z1157]] * {{z+|Z1827}} (el) — [[/Z1827]] * <translate><!--T:147--> Indo-Iranian</translate> ** <translate><!--T:148--> Indo-Aryan</translate> *** <translate><!--T:149--> Hindustani</translate> **** {{z+|Z1820}} (hi) — [[/Z1820]] **** {{z+|Z1717}} (ur) — [[/Z1717]] *** <translate><!--T:150--> Northwestern</translate> **** <translate><!--T:151--> Punjabic</translate> ***** {{z+|Z1657}} (pa) — [[/Z1657]] ***** {{z+|Z1083}} (pnb) — [[/Z1083]] **** {{z+|Z1191}} (sd) — [[/Z1191]] *** <translate><!--T:152--> Eastern</translate> **** {{z+|Z1011}} (bn) — [[/Z1011]] **** <translate><!--T:153--> Rohingya</translate> (rhg) ***** {{z+|Z1978}} (rhg-rohg) — [[/Z1978]] ***** {{z+|Z1979}} (rhb-arab) — [[/Z1979]] ** <translate><!--T:154--> Iranian</translate> *** <translate><!--T:155--> Northwestern</translate> **** {{z+|Z1747}} (bal) — [[/Z1747]] **** {{z+|Z1556}} (ku) — [[/Z1556]] ***** {{z+|Z1288}} (ckb) — [[/Z1288]] *** {{z+|Z1728}} (fa) — [[/Z1728]] **** {{z+|Z1207}} (tg) — [[/Z1207]] **** {{z+|Z1265}} (fa-AF / prs) — [[/Z1265]] **** {{z+|Z1277}} (jpr) — [[/Z1277]] * <translate><!--T:156--> Italic</translate> ** {{z+|Z1403}} (la) — [[/Z1403]] ** <translate><!--T:157--> Romance</translate> *** <translate><!--T:158--> Continental Romance</translate> **** <translate><!--T:159--> Western Romance</translate> ***** <translate><!--T:160--> Ibero-Romance</translate> ****** {{z+|Z1037}} (pt) — [[/Z1037]] ******* {{z+|Z1381}} (pt-BR) — [[/Z1381]] ****** {{z+|Z1003}} (es) — [[/Z1003]] ***** <translate><!--T:161--> Occitano-Romance</translate> ****** {{z+|Z1789}} (ca) — [[/Z1789]] ***** <translate><!--T:162--> North Gallo-Romance</translate> ****** {{z+|Z1004}} (fr) — [[/Z1004]] ***** <translate><!--T:163--> North Italian</translate> ****** {{Z+|Z1363}} (vec) — [[/Z1363]] ****** {{z+|Z1483}} (lad) — [[/Z1483]] **** <translate><!--T:164--> South Romance</translate> ***** {{z+|Z1787}} (it) — [[/Z1787]] ***** {{z+|Z1329}} (co) — [[/Z1329]] ***** {{z+|Z1082}} (sdc) — [[/Z1082]] ***** {{z+|Z1491}} (nap) — [[/Z1491]] ***** {{z+|Z1298}} (scn) — [[/Z1298]] **** <translate><!--T:165--> Balkan romance</translate> ***** {{z+|Z1664}} (ro) — [[/Z1664]] *** <translate><!--T:166--> Island Romance</translate> **** {{z+|Z1342}} (sc) — [[/Z1342]] <translate> == Kra-Dai == <!--T:110--> </translate> * {{z+|Z1851}} (th) — [[/Z1851]] <translate> == Niger-Congo == <!--T:167--> </translate> * <translate><!--T:168--> Atlantic-Congo</translate> ** {{z+|Z1015}} (dag) — [[/Z1015]] ** <translate><!--T:169--> Volta-Congo</translate> *** <translate><!--T:170--> Volta-Niger</translate> **** {{z+|Z1014}} (ig) — [[/Z1014]] **** {{z+|Z1818}} (ya) — [[/Z1818]] *** {{z+|Z1179}} (kcg) — [[/Z1179]] <translate> == Mixed and creoles == <!--T:171--> <!--T:172--> These languages are sorted under the language it is primarily based on. </translate> * {{Z|Z1531}} ** {{z+|Z1630}} (bew) — [[/Z1630]] * {{Z|Z1037}} ** {{z+|Z1806}} (kea) — [[/Z1806]] <translate> == Sign == <!--T:173--> </translate> * {{z+|Z1763}} (ase) — [[/Z1763]] * {{z+|Z1907}} (bzs) - [[/Z1907]] * {{z+|Z}}{{q|2107617}} (vgt) - [[/vgt]] <translate> == Sino-Tibetan == <!--T:109--> </translate> * {{z+|Z1147}} (dz) — [[/Z1147]] * <translate><!--T:174--> Sinitic</translate> ** {{z+|Z1006}} (zh) — [[/Z1006]] *** {{z+|Z1645}} (zh-hans) — [[/Z1645]] **** {{z+|Z1411}} (zh-CN) — [[/Z1411]] *** {{z+|Z1672}} (zh-hant) — [[/Z1672]] **** {{z+|Z1589}} (zh-HK) — [[/Z1589]] ** {{z+|Z1202}} (zh-yue) — [[/Z1202]] *** {{z+|Z1901}} (yue-hans) — [[/Z1901]] *** {{z+|Z1902}} (yue-hant) — [[/Z1902]] <translate> == Turkic == <!--T:112--> </translate> * <translate><!--T:175--> Oghuz</translate> ** {{z+|Z1237}} (tr) — [[/Z1237]] ** {{z+|Z1597}} (az) — [[/Z1597]] * {{z+|Z1120}} (uz) — [[/Z1120]] <translate> == Uralic == <!--T:113--> </translate> * {{z+|Z1051}} (fi) — [[/Z1051]] * {{z+|Z1513}} (hu) — [[/Z1513]] <translate> == Isolates and smaller families == <!--T:176--> </translate> * {{z+|Z1314}} (eu) — [[/Z1314]] * {{z+|Z1830}} (ja) — [[/Z1830]] ** {{z+|Z1444}} (ja-hkrt) — [[/Z1444]] ** <translate><!--T:178--> Japanese rōmaji, no ZObject</translate> (ja-latn) * {{z+|Z1643}} (ko) — [[/Z1643]] * {{z+|Z1678}} (qu) — [[/Z1678]] <translate> == Other == <!--T:177--> </translate> * {{z+|Z1360}} (mul) — [[/Z1360]] [[Category:Natural languages| mul]] [[Category:WikiProjects]] t9smrpj6pki9yk2xxlhpznxhufyqmh9 276466 276465 2026-05-20T06:16:58Z Ameisenigel 44 Marked this version for translation 276466 wikitext text/x-wiki <languages/> {{draft}} <translate> <!--T:1--> Supported by the Natural Language Generation Special Interest Group; see also <tvar name="1">{{ll|WF:PROG}}</tvar> and <tvar name="2">{{ll|WF:Catalogue/Natural language operations}}</tvar>. Many of these are morphological functions; morphology is the part of linguistics that studies how language parts are 'shaped' and change diachronically and when inflected. <!--T:179--> Hausa, Igbo, Malayalam, Bangla/Bengali and Dagbani are [[<tvar name="1">d:Special:MyLanguage/Wikidata:Lexicographical data/Focus languages</tvar>|focus languages]] for Wikidata's lexicographic dataset, which is an important aspect of [[<tvar name="2">Special:MyLanguage/WF:glossary#Abstract Wikipedia</tvar>|Abstract Wikipedia]]. == Related pages == <!--T:121--> </translate> * <translate><!--T:122--> <tvar name="1">[[:Category:Natural languages]]</tvar> — List of categories for languages</translate> * <translate><!--T:123--> <tvar name="1">{{ll|Wikifunctions:Catalogue/Natural language operations}}</tvar> — Lists of natural language functions</translate> * <translate><!--T:124--> <tvar name="1">{{ll|Wikifunctions:NLG functions}}</tvar> — A table of each supported language's NLG functions</translate> ** <translate><!--T:125--> <tvar name="1">{{ll|Wikifunctions:Cardinal numbers}}</tvar> — List of each language's cardinal number functions</translate> * <translate><!--T:126--> <tvar name="1">{{ll|Wikifunctions:Reserved ZIDs/all#Z1000-Z1999}}</tvar> — List of all languages in ZObject order</translate> <translate> == Afroasiatic == <!--T:38--> </translate> * {{z+|Z1472}} (zgh) — [[/Z1472]] * {{z+|Z1013}} (ha) — [[/Z1013]] * <translate><!--T:127--> Semitic</translate> ** <translate><!--T:128--> Arabic</translate> *** {{z+|Z1001}} (ar) — [[/Z1001]] *** {{z+|Z1045}} (ary) — [[/Z1045]] *** {{z+|Z1582}} (aeb) — [[/Z1582]] ** {{z+|Z1186}} (he) — [[/Z1186]] <translate> == Austroasiatic == <!--T:69--> </translate> * {{z+|Z1048}} (vi) — [[/Z1048]] * (<translate><!--T:129--> Mundari, no code yet</translate>) (unr) <translate> == Austronesian == <!--T:70--> </translate> * <translate><!--T:130--> Malayic</translate> ** {{z+|Z1531}} (ms) — [[/Z1531]] *** {{z+|Z1434}} (ms-arab) — [[/Z1434]] ** {{z+|Z1078}} (id) — [[/Z1078]] * {{z+|Z1471}} (su) — [[/Z1471]] <translate> == Constructed == <!--T:131--> </translate> * {{z+|Z1882}} (ldn) — [[/Z1882]] * {{z+|Z1576}} (eo) — [[/Z1576]] * {{z+|Z1534}} (tlh) — [[/Z1534]] * {{z+|Z1762}} (tok) — [[/Z1762]] <translate> == Dravidian == <!--T:132--> </translate> * {{z+|Z1293}} (brh) — [[/Z1293]] * <translate><!--T:133--> South</translate> ** {{z+|Z1012}} (ml) — [[/Z1012]] ** {{z+|Z1429}} (te) — [[/Z1429]] <translate> == Indo-European == <!--T:80--> </translate> * {{z+|Z1541}} (hy) — [[/Z1541]] * <translate><!--T:134--> Balto-Slavic</translate> ** {{z+|Z1709}} (lv) — [[/Z1709]] ** <translate><!--T:135--> Slavic</translate> *** <translate><!--T:136--> East Slavic</translate> **** {{z+|Z1005}} (ru) — [[/Z1005]] **** {{z+|Z1332}} (uk) — [[/Z1332]] **** {{z+|Z1622}} (by) — [[/Z1622]] *** <translate><!--T:137--> West Slavic</translate> **** {{z+|Z1062}} (cs) — [[/Z1062]] **** {{z+|Z1025}} (pl) — [[/Z1025]] **** {{z+|Z1488}} (sk) — [[/Z1488]] *** <translate><!--T:138--> South Slavic</translate> **** {{z+|Z1823}} (bg) — [[/Z1823]] **** {{z+|Z1105}} (cu) — [[/Z1105]] **** {{z+|Z1412}} (sh) — [[/Z1412]] ***** {{z+|Z1473}} (bs) — [[/Z1473]] ***** {{z+|Z1272}} (hr) — [[/Z1272]] ***** {{z+|Z1498}} (cnr) — [[/Z1498]] ***** {{z+|Z1158}} (sr) — [[/Z1158]] **** {{z+|Z1616}} (sl) — [[/Z1616]] * <translate><!--T:139--> Celtic</translate> ** {{z+|Z1282}} (br) — [[/Z1282]] ** {{z+|Z1024}} (cy) — [[/Z1024]] ** {{z+|Z1339}} (gd) — [[/Z1282]] * <translate><!--T:140--> Germanic</translate> ** <translate><!--T:141--> North Germanic</translate> *** <translate><!--T:142--> East Scandinavian</translate> **** {{z+|Z1061}} (dk) — [[/Z1061]] **** {{z+|Z1592}} (sv) — [[/Z1592]] *** {{z+|Z1021}} (no) — [[/Z1592]] ** <translate><!--T:143--> West Germanic</translate> *** <translate><!--T:144--> North Sea</translate> **** {{z+|Z1002}} (en) — [[/Z1002]] ***** <translate><!--T:145--> North American</translate> ****** {{z+|Z1689}} (en-US) — [[/Z1689]] ****** {{z+|Z1437}} (en-CA) — [[/Z1437]] ***** {{z+|Z1113}} (en-AU) — [[/Z1113]] ***** {{z+|Z1199}} (en-GB) — [[/Z1199]] ***** {{z+|Z1966}} (en-IN) — [[/Z1966]] ***** {{z+|Z1881}} (en-x-piglatin) — [[/Z1881]] ***** {{z+|Z1124}} (en-x-simple) — [[/Z1124]] **** {{z+|Z1146}} (nds) — [[/Z1146]] *** <translate><!--T:146--> High German</translate> **** {{z+|Z1099}} (lb) — [[/Z1099]] **** {{z+|Z1430}} (de) — [[/Z1430]] *** {{z+|Z1157}} (nl) — [[/Z1157]] * {{z+|Z1827}} (el) — [[/Z1827]] * <translate><!--T:147--> Indo-Iranian</translate> ** <translate><!--T:148--> Indo-Aryan</translate> *** <translate><!--T:149--> Hindustani</translate> **** {{z+|Z1820}} (hi) — [[/Z1820]] **** {{z+|Z1717}} (ur) — [[/Z1717]] *** <translate><!--T:150--> Northwestern</translate> **** <translate><!--T:151--> Punjabic</translate> ***** {{z+|Z1657}} (pa) — [[/Z1657]] ***** {{z+|Z1083}} (pnb) — [[/Z1083]] **** {{z+|Z1191}} (sd) — [[/Z1191]] *** <translate><!--T:152--> Eastern</translate> **** {{z+|Z1011}} (bn) — [[/Z1011]] **** <translate><!--T:153--> Rohingya</translate> (rhg) ***** {{z+|Z1978}} (rhg-rohg) — [[/Z1978]] ***** {{z+|Z1979}} (rhb-arab) — [[/Z1979]] ** <translate><!--T:154--> Iranian</translate> *** <translate><!--T:155--> Northwestern</translate> **** {{z+|Z1747}} (bal) — [[/Z1747]] **** {{z+|Z1556}} (ku) — [[/Z1556]] ***** {{z+|Z1288}} (ckb) — [[/Z1288]] *** {{z+|Z1728}} (fa) — [[/Z1728]] **** {{z+|Z1207}} (tg) — [[/Z1207]] **** {{z+|Z1265}} (fa-AF / prs) — [[/Z1265]] **** {{z+|Z1277}} (jpr) — [[/Z1277]] * <translate><!--T:156--> Italic</translate> ** {{z+|Z1403}} (la) — [[/Z1403]] ** <translate><!--T:157--> Romance</translate> *** <translate><!--T:158--> Continental Romance</translate> **** <translate><!--T:159--> Western Romance</translate> ***** <translate><!--T:160--> Ibero-Romance</translate> ****** {{z+|Z1037}} (pt) — [[/Z1037]] ******* {{z+|Z1381}} (pt-BR) — [[/Z1381]] ****** {{z+|Z1003}} (es) — [[/Z1003]] ***** <translate><!--T:161--> Occitano-Romance</translate> ****** {{z+|Z1789}} (ca) — [[/Z1789]] ***** <translate><!--T:162--> North Gallo-Romance</translate> ****** {{z+|Z1004}} (fr) — [[/Z1004]] ***** <translate><!--T:163--> North Italian</translate> ****** {{Z+|Z1363}} (vec) — [[/Z1363]] ****** {{z+|Z1483}} (lad) — [[/Z1483]] **** <translate><!--T:164--> South Romance</translate> ***** {{z+|Z1787}} (it) — [[/Z1787]] ***** {{z+|Z1329}} (co) — [[/Z1329]] ***** {{z+|Z1082}} (sdc) — [[/Z1082]] ***** {{z+|Z1491}} (nap) — [[/Z1491]] ***** {{z+|Z1298}} (scn) — [[/Z1298]] **** <translate><!--T:165--> Balkan romance</translate> ***** {{z+|Z1664}} (ro) — [[/Z1664]] *** <translate><!--T:166--> Island Romance</translate> **** {{z+|Z1342}} (sc) — [[/Z1342]] <translate> == Kra-Dai == <!--T:110--> </translate> * {{z+|Z1851}} (th) — [[/Z1851]] <translate> == Niger-Congo == <!--T:167--> </translate> * <translate><!--T:168--> Atlantic-Congo</translate> ** {{z+|Z1015}} (dag) — [[/Z1015]] ** <translate><!--T:169--> Volta-Congo</translate> *** <translate><!--T:170--> Volta-Niger</translate> **** {{z+|Z1014}} (ig) — [[/Z1014]] **** {{z+|Z1818}} (ya) — [[/Z1818]] *** {{z+|Z1179}} (kcg) — [[/Z1179]] <translate> == Mixed and creoles == <!--T:171--> <!--T:172--> These languages are sorted under the language it is primarily based on. </translate> * {{Z|Z1531}} ** {{z+|Z1630}} (bew) — [[/Z1630]] * {{Z|Z1037}} ** {{z+|Z1806}} (kea) — [[/Z1806]] <translate> == Sign == <!--T:173--> </translate> * {{z+|Z1763}} (ase) — [[/Z1763]] * {{z+|Z1907}} (bzs) - [[/Z1907]] * {{z+|Z}}{{q|2107617}} (vgt) - [[/vgt]] <translate> == Sino-Tibetan == <!--T:109--> </translate> * {{z+|Z1147}} (dz) — [[/Z1147]] * <translate><!--T:174--> Sinitic</translate> ** {{z+|Z1006}} (zh) — [[/Z1006]] *** {{z+|Z1645}} (zh-hans) — [[/Z1645]] **** {{z+|Z1411}} (zh-CN) — [[/Z1411]] *** {{z+|Z1672}} (zh-hant) — [[/Z1672]] **** {{z+|Z1589}} (zh-HK) — [[/Z1589]] ** {{z+|Z1202}} (zh-yue) — [[/Z1202]] *** {{z+|Z1901}} (yue-hans) — [[/Z1901]] *** {{z+|Z1902}} (yue-hant) — [[/Z1902]] <translate> == Turkic == <!--T:112--> </translate> * <translate><!--T:175--> Oghuz</translate> ** {{z+|Z1237}} (tr) — [[/Z1237]] ** {{z+|Z1597}} (az) — [[/Z1597]] * {{z+|Z1120}} (uz) — [[/Z1120]] <translate> == Uralic == <!--T:113--> </translate> * {{z+|Z1051}} (fi) — [[/Z1051]] * {{z+|Z1513}} (hu) — [[/Z1513]] <translate> == Isolates and smaller families == <!--T:176--> </translate> * {{z+|Z1314}} (eu) — [[/Z1314]] * {{z+|Z1830}} (ja) — [[/Z1830]] ** {{z+|Z1444}} (ja-hkrt) — [[/Z1444]] ** <translate><!--T:178--> Japanese rōmaji, no ZObject</translate> (ja-latn) * {{z+|Z1643}} (ko) — [[/Z1643]] * {{z+|Z1678}} (qu) — [[/Z1678]] <translate> == Other == <!--T:177--> </translate> * {{z+|Z1360}} (mul) — [[/Z1360]] [[Category:Natural languages| mul]] [[Category:WikiProjects]] qms7qbh10vdd8yonu1d0fipa6kg9y3j Wikifunctions:Programming languages 4 24444 276473 272402 2026-05-20T06:19:59Z Ameisenigel 44 tvar 276473 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <translate>[[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</translate> * <translate>[[<tvar name="1">Special:MyLanguage/WF:glossary#composition</tvar>|Compositions]] are a kind of LISPish language, but aren't covered here.</translate> <translate> == Executable == <!--T:2--> === Implemented === <!--T:3--> <!--T:4--> As of March 2024 the following languages compile to [[<tvar name="1">meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25</tvar>|WASM]] to be run by the [[<tvar name="2">Special:MyLanguage/WF:glossary#executor</tvar>|executor]]: </translate> * <translate><!--T:5--> unversioned [[<tvar name="5">Special:MyLanguage/WF:JS</tvar>|JavaScript]] ([<tvar name="1">https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy</tvar> W3C Software and Document Notice and License], [<tvar name="2">https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license</tvar> src]), using [<tvar name="3">https://github.com/second-state/wasmedge-quickjs</tvar> WasmEdge-QuickJS] (using [<tvar name="4">https://bellard.org/quickjs/</tvar> QuickJS 2024], compatible with ES2023)</translate> * <translate><!--T:6--> unversioned [[<tvar name="3">Special:MyLanguage/WF:PY</tvar>|Python]] ([<tvar name="1">https://docs.python.org/3/license.html</tvar> PSF License Agreement], Zero-Clause BSD), using the development version of [<tvar name="2">https://github.com/RustPython/RustPython</tvar> RustPython] WASI mode (this is intended to be compatible with CPython 3.12)</translate> <translate> === Planned === <!--T:7--> </translate> * <translate><!--T:8--> versioned JavaScript (ECMA202?+)</translate> * <translate><!--T:9--> versioned Python (3+)</translate> <translate> === Requested === <!--T:10--> <!--T:11--> See the [[<tvar name="1">phab:tag/wikifunctions-new-language-requests</tvar>|workboard in Phabricator]] to request additional programming languages that should be supported in Wikifunctions. Among other criteria for implementation, available language interpreter/compiler software must be freely licensed. </translate> * <translate><!--T:12--> <tvar name="1">[[phab:T352589|T352589]]</tvar>: LabView/G<!--[<tvar name="2">https://ni.com/en/support/downloads/activate.html</tvar> proprietary]--> via pyLabView ([<tvar name="3">https://github.com/mefistotelis/pylabview/blob/master/LICENSE</tvar> MIT])</translate> * <translate><!--T:13--> <tvar name="1">[[phab:T352588|T352588]]</tvar>: Kotlin ([<tvar name="2">https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE</tvar> Apache])</translate> * <translate><!--T:14--> <tvar name="1">[[phab:T307171|T307171]]</tvar>: Lua ([<tvar name="2">https://lua.org/license.html</tvar> MIT])</translate> * <translate><!--T:15--> <tvar name="1">[[phab:T301418|T301418]]</tvar>: Scratch/Snap!/Logolike ([<tvar name="2">https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE</tvar> BSD 3-Clause], GPLv2 and Scratch Source Code License)</translate> * <translate><!--T:16--> <tvar name="1">[[phab:T298633|T298633]]</tvar>: Vlojure ([<tvar name="2">https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE</tvar> MIT])</translate> <translate> === Former === <!--T:17--> <!--T:18--> Previously, the function evaluator directly ran code in its container. Because it was based on Debian Bullseye, JavaScript execution was provided by Node.js 16 and Python by Python 3.9. These are no longer immediately available due to the re-build onto Web Assembler, but could return if needed via a custom build. == Functions for manipulating == <!--T:19--> </translate> * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] qccitkxtqo6phx27zxom9z3raks8i5v 276474 276473 2026-05-20T06:20:22Z Ameisenigel 44 Marked this version for translation 276474 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <translate><!--T:20--> [[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</translate> * <translate><!--T:21--> [[<tvar name="1">Special:MyLanguage/WF:glossary#composition</tvar>|Compositions]] are a kind of LISPish language, but aren't covered here.</translate> <translate> == Executable == <!--T:2--> === Implemented === <!--T:3--> <!--T:4--> As of March 2024 the following languages compile to [[<tvar name="1">meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25</tvar>|WASM]] to be run by the [[<tvar name="2">Special:MyLanguage/WF:glossary#executor</tvar>|executor]]: </translate> * <translate><!--T:5--> unversioned [[<tvar name="5">Special:MyLanguage/WF:JS</tvar>|JavaScript]] ([<tvar name="1">https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy</tvar> W3C Software and Document Notice and License], [<tvar name="2">https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license</tvar> src]), using [<tvar name="3">https://github.com/second-state/wasmedge-quickjs</tvar> WasmEdge-QuickJS] (using [<tvar name="4">https://bellard.org/quickjs/</tvar> QuickJS 2024], compatible with ES2023)</translate> * <translate><!--T:6--> unversioned [[<tvar name="3">Special:MyLanguage/WF:PY</tvar>|Python]] ([<tvar name="1">https://docs.python.org/3/license.html</tvar> PSF License Agreement], Zero-Clause BSD), using the development version of [<tvar name="2">https://github.com/RustPython/RustPython</tvar> RustPython] WASI mode (this is intended to be compatible with CPython 3.12)</translate> <translate> === Planned === <!--T:7--> </translate> * <translate><!--T:8--> versioned JavaScript (ECMA202?+)</translate> * <translate><!--T:9--> versioned Python (3+)</translate> <translate> === Requested === <!--T:10--> <!--T:11--> See the [[<tvar name="1">phab:tag/wikifunctions-new-language-requests</tvar>|workboard in Phabricator]] to request additional programming languages that should be supported in Wikifunctions. Among other criteria for implementation, available language interpreter/compiler software must be freely licensed. </translate> * <translate><!--T:12--> <tvar name="1">[[phab:T352589|T352589]]</tvar>: LabView/G<!--[<tvar name="2">https://ni.com/en/support/downloads/activate.html</tvar> proprietary]--> via pyLabView ([<tvar name="3">https://github.com/mefistotelis/pylabview/blob/master/LICENSE</tvar> MIT])</translate> * <translate><!--T:13--> <tvar name="1">[[phab:T352588|T352588]]</tvar>: Kotlin ([<tvar name="2">https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE</tvar> Apache])</translate> * <translate><!--T:14--> <tvar name="1">[[phab:T307171|T307171]]</tvar>: Lua ([<tvar name="2">https://lua.org/license.html</tvar> MIT])</translate> * <translate><!--T:15--> <tvar name="1">[[phab:T301418|T301418]]</tvar>: Scratch/Snap!/Logolike ([<tvar name="2">https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE</tvar> BSD 3-Clause], GPLv2 and Scratch Source Code License)</translate> * <translate><!--T:16--> <tvar name="1">[[phab:T298633|T298633]]</tvar>: Vlojure ([<tvar name="2">https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE</tvar> MIT])</translate> <translate> === Former === <!--T:17--> <!--T:18--> Previously, the function evaluator directly ran code in its container. Because it was based on Debian Bullseye, JavaScript execution was provided by Node.js 16 and Python by Python 3.9. These are no longer immediately available due to the re-build onto Web Assembler, but could return if needed via a custom build. == Functions for manipulating == <!--T:19--> </translate> * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] kf40ucux44cuq295dg6v6lh62uo39vv Wikifunctions:Type 4 24478 276512 275626 2026-05-20T06:23:17Z Ameisenigel 44 Marked this version for translation 276512 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <translate> <!--T:1--> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. <!--T:2--> Currently, there are <tvar name="1"><del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}}</tvar> Types that are available for specifying the Arguments and the return Type of a Function: </translate> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<translate><!--T:14--> this is parameterised i.e. it is a Function which returns a Type</translate>) * {{Z+|Z882}} (<translate><!--T:15--> parameterised</translate>) * {{Z+|Z883}} (<translate><!--T:16--> parameterised</translate>) * {{Z+|Z6884}} (<translate><!--T:17--> parameterised, used for defining [[<tvar name="1">Special:MyLanguage/WF:Function_model#Lightweight_enumerations</tvar>|lightweight enumeration types]]</translate>) <translate> === Numeric types === <!--T:6--> </translate> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <translate> === Language and text types === <!--T:18--> </translate> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <translate> ==== Grammatical feature enums ==== <!--T:19--> </translate> * {{Z+|Z28516}} (<translate><!--T:20--> lightweight enum</translate>) * {{Z+|Z28519}} (<translate><!--T:21--> lightweight enum</translate>) * {{Z+|Z25502}} (<translate><!--T:22--> lightweight enum</translate>) * {{Z+|Z25340}} (<translate><!--T:23--> lightweight enum</translate>) * {{Z+|Z25501}} (<translate><!--T:24--> lightweight enum</translate>) * {{Z+|Z26935}} (<translate><!--T:25--> lightweight enum</translate>) * {{Z+|Z26934}} (<translate><!--T:26--> lightweight enum</translate>) * {{Z+|Z28215}} (<translate><!--T:27--> lightweight enum</translate>) * {{Z+|Z28515}} (<translate><!--T:28--> lightweight enum</translate>) * {{Z+|Z28517}} (<translate><!--T:29--> lightweight enum</translate>) * {{Z+|Z32792}} (<translate><!--T:43--> lightweight enum</translate>) * {{Z+|Z32789}} (<translate><!--T:44--> lightweight enum</translate>) * {{Z+|Z27970}} (<translate><!--T:30--> lightweight enum</translate>) * {{Z+|Z28518}} (<translate><!--T:31--> lightweight enum</translate>) * {{Z+|Z28520}} (<translate><!--T:32--> lightweight enum</translate>) * {{Z+|Z33568}} (<translate><!--T:46--> lightweight enum</translate>) * {{Z+|Z27971}} (<translate><!--T:33--> lightweight enum</translate>) <translate> === Calendar types === <!--T:7--> ==== Gregorian calendar ==== <!--T:8--> </translate> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <translate> ==== Hijri (Islamic) calendar ==== <!--T:34--> </translate> * {{Z+|Z26582}} (<translate><!--T:35--> lightweight enum</translate>) <translate> ==== Igbo calendar ==== <!--T:9--> </translate> * {{Z+|Z16927}} <translate> === Wikidata types === <!--T:10--> </translate> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <translate> ==== Wikidata entities ==== <!--T:11--> </translate> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <translate> ==== Wikidata references ==== <!--T:12--> </translate> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <translate> ==== Wikidata statements ==== <!--T:13--> </translate> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <translate> ==== Wikidata datatypes ==== <!--T:36--> </translate> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<translate><!--T:37--> lightweight enum</translate>) * {{Z+|Z6063}} (<translate><!--T:38--> lightweight enum</translate>) * {{Z+|Z6064}} <translate> === Miscellaneous === <!--T:39--> </translate> * {{Z+|Z27951}} (<translate><!--T:40--> lightweight enum</translate>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<translate><!--T:45--> lightweight enum</translate>) <translate> === WikiLambda structure === <!--T:41--> </translate> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <translate> ==== Evaluation ==== <!--T:42--> </translate> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <translate> <!--T:3--> Other types can be used but there may be bugs. For a list of all types, see [[<tvar name="1">Special:ListObjectsByType/Z4</tvar>|the list of all types]] (though that does not include [[<tvar name="2">Special:ListObjectsByType/Z7</tvar>|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as <tvar name="3">{{Z|881}}</tvar>). <!--T:4--> New Types can be proposed on <tvar name="1">[[Wikifunctions:Type proposals]]</tvar>. == See also == <!--T:5--> </translate> * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] 9n58cdqv5cv0d2b5e6n83dvxhurlefm Category:Status updates/uk 14 24563 276564 106676 2026-05-20T06:24:51Z FuzzyBot 207 Updating to match new version of source page 276564 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Z14469 0 26897 276597 274614 2026-05-20T10:00:23Z Winston Sung 2672 276597 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z14469" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z14469K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Recipient's blood type" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "গ্রহণকারীর রক্তের শ্রেণী" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Ụdị ọbara nke nnata" }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "جۆری خوێنی وەرگر" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Blutgruppe des Empfängers" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "groupe sanguin du receveur" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "Grupa sanguină a destinatarului" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "Крвна група на примателот" }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "крвна група примаоца" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "gruppo sanguigno del ricevente" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Golongan darah penerima" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": " 受赠人的血型" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z14469K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Donor's blood type" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "দানকারীর রক্তের শ্রেণী" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Ụdị ọbara nke onye nyere onyinye" }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "جۆری خوێنی بەخشەر" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Blutgruppe des Spenders" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "groupe sanguin du donneur" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "Grupa sanguină a donatorului" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "Крвна група на дарителот" }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "крвна група даваоца" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "gruppo sanguigno del donatore" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Golongan darah donor" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "捐献者的血型" } ] } } ], "Z8K2": "Z40", "Z8K3": [ "Z20", "Z14470", "Z14472", "Z19477" ], "Z8K4": [ "Z14", "Z19162", "Z14471", "Z18945" ], "Z8K5": "Z14469" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "blood compatibility" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "রক্তের সামঞ্জস্যতা" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "ndakọrịta ọbara" }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "گونجانی خوێن" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Blutkompatibilität" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "compatibilité des groupes sanguins" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "compatibilitate sanguină" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "компатибилност на крвни групи" }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "компатибилност крвних група" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "compatibilità sanguigna" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kompatibilitas darah" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "血型相容性" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "is blood donation possible", "recipient and donor's blood type compatibility ", "is plasma compatible", "red blood cell compatibility" ] }, { "Z1K1": "Z31", "Z31K1": "Z1011", "Z31K2": [ "Z6", "কী রক্তদান সম্ভব" ] }, { "Z1K1": "Z31", "Z31K1": "Z1288", "Z31K2": [ "Z6", "بەخشینی خوێن ڕێی تێ دەچێ", "گونجانی جۆری خوێنی بەخشەر و وەرگر", "پلازما گونجاوە", "گونجانی خانەی خوێنی سوور" ] }, { "Z1K1": "Z31", "Z31K1": "Z1430", "Z31K2": [ "Z6", "ist Blutspende möglich", "Blutspender- und Empfänger kompatibel", "Rote Blutkörperchen kompatibel", "Blutgruppen kompatibel" ] }, { "Z1K1": "Z31", "Z31K1": "Z1004", "Z31K2": [ "Z6", "compatibilité sanguine" ] }, { "Z1K1": "Z31", "Z31K1": "Z1664", "Z31K2": [ "Z6", "compatibilitate sangvină", "compatibilitatea sângelui", "sânge donator compatibil" ] }, { "Z1K1": "Z31", "Z31K1": "Z1078", "Z31K2": [ "Z6", "apakah donor darah dimungkinkan, kompatibilitas golongan darah penerima dan donor, apakah plasma kompatibel, kompatibilitas sel darah merah" ] }, { "Z1K1": "Z31", "Z31K1": "Z1645", "Z31K2": [ "Z6", " 是否可以献血,受血者与献血者的血型是否相容,血浆是否相容,红细胞是否相容" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "checks whether two blood groups are compatible with each other. Input must be in the form of A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "এটি দুটি রক্তের গ্রুপ একে অপরের সাথে সামঞ্জস্যপূর্ণ কিনা তা পরীক্ষা করে, রক্তদান বা প্রাপ্তি সম্ভব কিনা তা নির্ধারণ করে। এটি অ্যাটিপিকাল অ্যান্টিবডির অনুপস্থিতি অনুমান করে।" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Ọ na-enyocha ma ìgwè ọbara abụọ hà kwekọrọ na ibe ha, na-ekpebi ma ọ̀ ga-ekwe omume inye onyinye ma ọ bụ nnata ọbara. Nke a na-eche na enweghị ọgwụ mgbochi atypical." }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "دوو گرووپی خوێن دەپشکنێت تا بزانێت ئاخۆ لەگەڵ یەکتر دەگونجێن و بەخشین یان وەرگرتنی خوێن دیاریی دەکات" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "prüft, ob zwei Blutgruppen miteinander kompatibel sind. Eingabe muss in der Form von A+, A-, B+, B-, O+, O-, AB+ oder AB- sein." }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "renvoie \"vrai\" si deux groupes sanguins sont compatibles entre eux, sinon \"faux\" ; la saisie doit être sous la forme A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "verifică dacă două grupe sanguine sunt compatibile între ele. Datele de intrare trebuie să fie de forma A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "проверува дали две крвни групи се компатибилни една со друга." }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "Проверава да ли су крвне групе компатибилне једна са другом. Улаз мора бити у формату \"A+\", \"A-\", \"B+\", \"B-\", \"O+\", \"O-\", \"AB+\", \"AB-\"" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Controlla se due gruppi sanguigni sono compatibili. L'imput deve essere nella forma A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "memeriksa apakah dua golongan darah kompatibel satu sama lain. Input harus dalam bentuk A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "检查两种血型是否相容。输入必须为以下形式:A+、A-、B+、B-、O+、O-、AB+、AB-" } ] } } 0n7o9f8bjinvc2rqqtpxov9z0uokwok 276598 276597 2026-05-20T10:00:39Z Winston Sung 2672 276598 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z14469" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z14469K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Recipient's blood type" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "গ্রহণকারীর রক্তের শ্রেণী" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Ụdị ọbara nke nnata" }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "جۆری خوێنی وەرگر" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Blutgruppe des Empfängers" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "groupe sanguin du receveur" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "Grupa sanguină a destinatarului" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "Крвна група на примателот" }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "крвна група примаоца" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "gruppo sanguigno del ricevente" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Golongan darah penerima" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": " 受赠人的血型" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z14469K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Donor's blood type" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "দানকারীর রক্তের শ্রেণী" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Ụdị ọbara nke onye nyere onyinye" }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "جۆری خوێنی بەخشەر" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Blutgruppe des Spenders" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "groupe sanguin du donneur" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "Grupa sanguină a donatorului" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "Крвна група на дарителот" }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "крвна група даваоца" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "gruppo sanguigno del donatore" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Golongan darah donor" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "捐献者的血型" } ] } } ], "Z8K2": "Z40", "Z8K3": [ "Z20", "Z14470", "Z14472", "Z19477" ], "Z8K4": [ "Z14", "Z19162", "Z14471", "Z18945" ], "Z8K5": "Z14469" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "blood compatibility" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "রক্তের সামঞ্জস্যতা" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "ndakọrịta ọbara" }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "گونجانی خوێن" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Blutkompatibilität" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "compatibilité des groupes sanguins" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "compatibilitate sanguină" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "компатибилност на крвни групи" }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "компатибилност крвних група" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "compatibilità sanguigna" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kompatibilitas darah" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "血型相容性" }, { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "血型相容性" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "is blood donation possible", "recipient and donor's blood type compatibility ", "is plasma compatible", "red blood cell compatibility" ] }, { "Z1K1": "Z31", "Z31K1": "Z1011", "Z31K2": [ "Z6", "কী রক্তদান সম্ভব" ] }, { "Z1K1": "Z31", "Z31K1": "Z1288", "Z31K2": [ "Z6", "بەخشینی خوێن ڕێی تێ دەچێ", "گونجانی جۆری خوێنی بەخشەر و وەرگر", "پلازما گونجاوە", "گونجانی خانەی خوێنی سوور" ] }, { "Z1K1": "Z31", "Z31K1": "Z1430", "Z31K2": [ "Z6", "ist Blutspende möglich", "Blutspender- und Empfänger kompatibel", "Rote Blutkörperchen kompatibel", "Blutgruppen kompatibel" ] }, { "Z1K1": "Z31", "Z31K1": "Z1004", "Z31K2": [ "Z6", "compatibilité sanguine" ] }, { "Z1K1": "Z31", "Z31K1": "Z1664", "Z31K2": [ "Z6", "compatibilitate sangvină", "compatibilitatea sângelui", "sânge donator compatibil" ] }, { "Z1K1": "Z31", "Z31K1": "Z1078", "Z31K2": [ "Z6", "apakah donor darah dimungkinkan, kompatibilitas golongan darah penerima dan donor, apakah plasma kompatibel, kompatibilitas sel darah merah" ] }, { "Z1K1": "Z31", "Z31K1": "Z1645", "Z31K2": [ "Z6", " 是否可以献血,受血者与献血者的血型是否相容,血浆是否相容,红细胞是否相容" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "checks whether two blood groups are compatible with each other. Input must be in the form of A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "এটি দুটি রক্তের গ্রুপ একে অপরের সাথে সামঞ্জস্যপূর্ণ কিনা তা পরীক্ষা করে, রক্তদান বা প্রাপ্তি সম্ভব কিনা তা নির্ধারণ করে। এটি অ্যাটিপিকাল অ্যান্টিবডির অনুপস্থিতি অনুমান করে।" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Ọ na-enyocha ma ìgwè ọbara abụọ hà kwekọrọ na ibe ha, na-ekpebi ma ọ̀ ga-ekwe omume inye onyinye ma ọ bụ nnata ọbara. Nke a na-eche na enweghị ọgwụ mgbochi atypical." }, { "Z1K1": "Z11", "Z11K1": "Z1288", "Z11K2": "دوو گرووپی خوێن دەپشکنێت تا بزانێت ئاخۆ لەگەڵ یەکتر دەگونجێن و بەخشین یان وەرگرتنی خوێن دیاریی دەکات" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "prüft, ob zwei Blutgruppen miteinander kompatibel sind. Eingabe muss in der Form von A+, A-, B+, B-, O+, O-, AB+ oder AB- sein." }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "renvoie \"vrai\" si deux groupes sanguins sont compatibles entre eux, sinon \"faux\" ; la saisie doit être sous la forme A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1664", "Z11K2": "verifică dacă două grupe sanguine sunt compatibile între ele. Datele de intrare trebuie să fie de forma A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1402", "Z11K2": "проверува дали две крвни групи се компатибилни една со друга." }, { "Z1K1": "Z11", "Z11K1": "Z1181", "Z11K2": "Проверава да ли су крвне групе компатибилне једна са другом. Улаз мора бити у формату \"A+\", \"A-\", \"B+\", \"B-\", \"O+\", \"O-\", \"AB+\", \"AB-\"" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Controlla se due gruppi sanguigni sono compatibili. L'imput deve essere nella forma A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "memeriksa apakah dua golongan darah kompatibel satu sama lain. Input harus dalam bentuk A+, A-, B+, B-, O+, O-, AB+, AB-" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "检查两种血型是否相容。输入必须为以下形式:A+、A-、B+、B-、O+、O-、AB+、AB-" } ] } } ngl9hb8p8bddwtqayjy8rdex9rdzyw6 Wikifunctions:How to create implementations/lb 4 30804 276454 240256 2026-05-20T06:15:40Z FuzzyBot 207 Updating to match new version of source page 276454 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == Kompositioun == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] kvzus6fh7am5kd1pwbhgmhxu1war3bg Category:Status updates/en 14 31199 276543 106675 2026-05-20T06:24:42Z FuzzyBot 207 Updating to match new version of source page 276543 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/de 14 31201 276542 106678 2026-05-20T06:24:42Z FuzzyBot 207 Updating to match new version of source page 276542 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/tr 14 32175 276562 109141 2026-05-20T06:24:50Z FuzzyBot 207 Updating to match new version of source page 276562 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/lb 14 32247 276555 109335 2026-05-20T06:24:47Z FuzzyBot 207 Updating to match new version of source page 276555 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Z17485 0 32955 276358 273617 2026-05-20T01:11:54Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276358 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z17485" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z17402", "Z17K2": "Z17485K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "day" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Wochentag" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "jour" } ] } } ], "Z8K2": "Z13518", "Z8K3": [ "Z20", "Z17487", "Z17488" ], "Z8K4": [ "Z14", "Z17489", "Z34634", "Z17486" ], "Z8K5": "Z17485" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "day to day number (starting Sunday=1)" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "nọmba ụbọchị ruo ụbọchị (bido Sọnde = 1) " }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "সপ্তাহের দিনের নাম থেকে সংখ্যা (রবিবার = 1)" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Tag zu Tagnummer" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "jour vers numéro du jour" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "Natural number index from Day of the week", "Day of the week to Natural number (Sunday = 1)", "index for Day of the week" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "কোনো সপ্তাহের বারের নামের সমতুল্য ক্রমিক সংখ্যা প্রদান করবে" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Gibt die Nummer des Tages in einer Woche an, wobei der Sonntag als erster Tag der Woche gilt" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "démarre à partir de dimanche = 1" } ] } } 4tai9hyk18mjo5vhv0470it1ir9v2qr Wikifunctions:Type/en 4 33383 276515 270482 2026-05-20T06:23:20Z FuzzyBot 207 Updating to match new version of source page 276515 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (this is parameterised i.e. it is a Function which returns a Type) * {{Z+|Z882}} (parameterised) * {{Z+|Z883}} (parameterised) * {{Z+|Z6884}} (parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]) === Numeric types === * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} === Language and text types === * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} ==== Grammatical feature enums ==== * {{Z+|Z28516}} (lightweight enum) * {{Z+|Z28519}} (lightweight enum) * {{Z+|Z25502}} (lightweight enum) * {{Z+|Z25340}} (lightweight enum) * {{Z+|Z25501}} (lightweight enum) * {{Z+|Z26935}} (lightweight enum) * {{Z+|Z26934}} (lightweight enum) * {{Z+|Z28215}} (lightweight enum) * {{Z+|Z28515}} (lightweight enum) * {{Z+|Z28517}} (lightweight enum) * {{Z+|Z32792}} (lightweight enum) * {{Z+|Z32789}} (lightweight enum) * {{Z+|Z27970}} (lightweight enum) * {{Z+|Z28518}} (lightweight enum) * {{Z+|Z28520}} (lightweight enum) * {{Z+|Z33568}} (lightweight enum) * {{Z+|Z27971}} (lightweight enum) === Calendar types === ==== Gregorian calendar ==== * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} ==== Hijri (Islamic) calendar ==== * {{Z+|Z26582}} (lightweight enum) ==== Igbo calendar ==== * {{Z+|Z16927}} === Wikidata types === {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} ==== Wikidata entities ==== * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} ==== Wikidata references ==== * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} ==== Wikidata statements ==== * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} ==== Wikidata datatypes ==== * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (lightweight enum) * {{Z+|Z6063}} (lightweight enum) * {{Z+|Z6064}} === Miscellaneous === * {{Z+|Z27951}} (lightweight enum) * {{Z+|Z28579}} * {{Z+|Z33827}} (lightweight enum) === WikiLambda structure === * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} ==== Evaluation ==== * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). New Types can be proposed on [[Wikifunctions:Type proposals]]. == See also == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] by989xm1kxoqmlbz2k8duqyhubywap8 Translations:Wikifunctions:Programming languages/5/en 1198 34498 276477 198830 2026-05-20T06:20:22Z FuzzyBot 207 Importing a new version from external source 276477 wikitext text/x-wiki unversioned [[$5|JavaScript]] ([$1 W3C Software and Document Notice and License], [$2 src]), using [$3 WasmEdge-QuickJS] (using [$4 QuickJS 2024], compatible with ES2023) ay0mody1t9yxjqwsihtvc4dhhlvzdrx Translations:Wikifunctions:Programming languages/6/en 1198 34499 276478 116161 2026-05-20T06:20:22Z FuzzyBot 207 Importing a new version from external source 276478 wikitext text/x-wiki unversioned [[$3|Python]] ([$1 PSF License Agreement], Zero-Clause BSD), using the development version of [$2 RustPython] WASI mode (this is intended to be compatible with CPython 3.12) sdm6sc4bn70b76sjf4jfgkv3o7jzotd Wikifunctions:Programming languages/en 4 34513 276480 198833 2026-05-20T06:20:32Z FuzzyBot 207 Updating to match new version of source page 276480 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * [[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia. * [[Special:MyLanguage/WF:glossary#composition|Compositions]] are a kind of LISPish language, but aren't covered here. == Executable == === Implemented === As of March 2024 the following languages compile to [[meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25|WASM]] to be run by the [[Special:MyLanguage/WF:glossary#executor|executor]]: * unversioned [[Special:MyLanguage/WF:JS|JavaScript]] ([https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy W3C Software and Document Notice and License], [https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license src]), using [https://github.com/second-state/wasmedge-quickjs WasmEdge-QuickJS] (using [https://bellard.org/quickjs/ QuickJS 2024], compatible with ES2023) * unversioned [[Special:MyLanguage/WF:PY|Python]] ([https://docs.python.org/3/license.html PSF License Agreement], Zero-Clause BSD), using the development version of [https://github.com/RustPython/RustPython RustPython] WASI mode (this is intended to be compatible with CPython 3.12) === Planned === * versioned JavaScript (ECMA202?+) * versioned Python (3+) === Requested === See the [[phab:tag/wikifunctions-new-language-requests|workboard in Phabricator]] to request additional programming languages that should be supported in Wikifunctions. Among other criteria for implementation, available language interpreter/compiler software must be freely licensed. * [[phab:T352589|T352589]]: LabView/G<!--[https://ni.com/en/support/downloads/activate.html proprietary]--> via pyLabView ([https://github.com/mefistotelis/pylabview/blob/master/LICENSE MIT]) * [[phab:T352588|T352588]]: Kotlin ([https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE Apache]) * [[phab:T307171|T307171]]: Lua ([https://lua.org/license.html MIT]) * [[phab:T301418|T301418]]: Scratch/Snap!/Logolike ([https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE BSD 3-Clause], GPLv2 and Scratch Source Code License) * [[phab:T298633|T298633]]: Vlojure ([https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE MIT]) === Former === Previously, the function evaluator directly ran code in its container. Because it was based on Debian Bullseye, JavaScript execution was provided by Node.js 16 and Python by Python 3.9. These are no longer immediately available due to the re-build onto Web Assembler, but could return if needed via a custom build. == Functions for manipulating == * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] mlktkiebyh4d7agcc9098zm6pfw1w68 Wikifunctions:Type/ru 4 34562 276526 270492 2026-05-20T06:23:39Z FuzzyBot 207 Updating to match new version of source page 276526 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == См. также == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] plorbmtjpnbpfuds6i7ts8dkqa76agc Wikifunctions:Type/gu 4 34895 276518 270485 2026-05-20T06:23:26Z FuzzyBot 207 Updating to match new version of source page 276518 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == આ પણ જુઓ == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] l1txzyxufybfl8gs6oq0x9y91iwumzn Wikifunctions:How to create implementations/he 4 35103 276449 240252 2026-05-20T06:15:36Z FuzzyBot 207 Updating to match new version of source page 276449 wikitext text/x-wiki <languages/> הדף הזה מספק מדריך מפורט יותר ל'''יצירת מימושים''', מעבר לסקירה הכללית בדף {{ll|Wikifunctions:Introduction}}. <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> בפרק הזה, אנחנו נותנים דוגמה מוחשית על יצירת מימוש בצורת קוד בפייתון. נניח שאנחנו רוצים ליצור מימוש לפונקציה שמאחדת שתי מחרוזות קלט על־ידי הוספת רווח ביניהן, ומחזירה את התוצאה של זה. נניח שמזהה ה־Z של הפונקציה הזאת הוא Z11057. </div> <div class="mw-translate-fuzzy"> המימוש מוגדר באמצעות מזהה ה־Z של הפונקציה. כך גם הארגומנטים של הפונקציה. אז במקרה של פונקציה Z11057 עם שני הארגומנטים שלה, השורה הראשונה צריכה להיראות כך: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> היות שזה פיתון, אל תשכחו להזיח את השורה הזאת. <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> יש לזכור שלקוד בזמן הריצה אין מצב (state). אין להניח מה יהיו הערכים של משתנים גלובליים או סטטיים. אם יש לך שאלות נוספות לגבי מה אפשר ומה אי־אפשר לעשות בפייתון, אפשר לשאול בדף [[Wikifunctions:Python implementations]]. <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div class="mw-translate-fuzzy"> בפרק הזה, אנחנו נותנים דוגמה מוחשית על יצירת מימוש בצורת קוד ב־JavaScript. נניח שאנחנו רוצים ליצור מימוש לפונקציה שמאחדת שתי מחרוזות קלט על־ידי הוספת רווח ביניהן, ומחזירה את התוצאה של זה. נניח שמזהה ה־Z של הפונקציה הזאת הוא Z11057. </div> <div class="mw-translate-fuzzy"> המימוש מוגדר באמצעות מזהה ה־Z של הפונקציה. כך גם הארגומנטים של הפונקציה. אז במקרה של פונקציה Z11057 עם שני הארגומנטים שלה, השורה הראשונה צריכה להיראות כך: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> יש לזכור שלקוד בזמן הריצה אין מצב (state). אין להניח מה יהיו הערכים של משתנים גלובליים או סטטיים. אם יש לך שאלות נוספות לגבי מה אפשר ומה אי־אפשר לעשות ב־JavaScript, אפשר לשאול בדף [[Wikifunctions:JavaScript implementations]]. <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == הרכבה == </div> <div class="mw-translate-fuzzy"> בפרק הזה נותנים דוגמה מוחשית על יצירת מימוש בצורת הרכבה (composition). נניח שאנחנו רוצים ליצור מימוש לפונקציה שמאחדת שתי מחרוזות קלט על־ידי הוספת רווח ביניהן, ומחזירה את התוצאה של זה. נניח שמזהה ה־Z של הפונקציה הזאת הוא Z11057. </div> <div class="mw-translate-fuzzy"> בדרך־כלל כדאי לחשוב תחילה כיצד לשלב פונקציות קיימות כדי ליצור את הפלט הרצוי. לפעמים זה יכול להיות טריוויאלי, ואפשר פשוט להמשיך עם הרכבת פונקציות, אבל במקרים רבים כדאי לרשום מה ההרכבה הרצויה. ממשק ההרכבה של ויקיפונקציות עדיין לא טוב כל־כך בעריכת הרכבות, ולכן מומלץ קודם להבין מה בדיוק ברצונך ליצור. </div> <div class="mw-translate-fuzzy"> למשל, עבור הפונקציה הנתונה, נוכל להשתמש ב[[{{Z|Z10000}}|פונקציה לשרשור מחרוזות]], שכבר קיימת. הפונקציה הזאת לוקחת שתי מחרוזות ויוצרת מהן מחרוזת אחת. אבל אנחנו צריכים להוסיף רווח ביניהן. אז תחילה אנו משרשרים רווח לקצה המחרוזת הראשונה, ולאחר מכן משרשרים את המחרוזת השנייה לתוצאה של השרשור הראשון הזה. אז אפשר לרשום את ההרכבה שלנו כך: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] l6dy9b5y28fcxgowi0lemqkinnejsgg Wikifunctions:Python implementations 4 35115 276437 272405 2026-05-20T05:59:04Z YoshiRulz 10156 /* Matrices (lists of lists) */ Another limitation 276437 wikitext text/x-wiki {{main|WF:PROG}}{{see also|WF:JS}}{{shortcut|[[WF:PY]]}} You can do most things that work in [https://github.com/RustPython/RustPython Rustpython] which is used under the hood. :"RustPython is in development, and while the interpreter certainly can be used in interesting use cases like running Python in WASM and embedding into a Rust project, do note that RustPython is not totally production-ready." [https://github.com/RustPython/RustPython?tab=readme-ov-file source] See https://rustpython.github.io/pages/whats-left for an overview of missing built-in modules. == Error handling == See [[meta:Abstract_Wikipedia/Representation_of_errors]] == Open questions as of October 2024== * How to cast a string to a {{z|Z6091}}? (raised in telegram) == Known limitations as of October 2024 == === Modules === Only built-in python modules in RustPython is supported (installation of modules is not supported) This is by design to avoid reproducibility issues and bugs caused by different module versions. === HTTP connections === Disabled by design for security and reproducibility reasons. * the built-in module http.client does not work. Because of that it is currently not possible to make ANY HTTP requests from implementations. See https://phabricator.wikimedia.org/T371484 === Matrices (lists of lists) === {{phab|T392750}} Functions which return a list of lists can't be implemented in Python, they will fail with a [[Z500]] <q>Could not serialize input Python object</q> error. [[category:Python implementations| ]] 6mcve8d0awjgaqk53otx0agho5nufyz Wikifunctions:Type/de 4 35272 276516 270556 2026-05-20T06:23:20Z FuzzyBot 207 Updating to match new version of source page 276516 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} Jedes Objekt in Wikifunctions gehört zu einem Typ. Typen bestimmen, wie Objekte dieses Typs strukturiert sind und was sie bedeuten. Typen werden auch verwendet, um die Argumente einer Funktion anzugeben und was eine Funktion zurückgibt. Derzeit stehen <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Typen zum Angeben der Argumente und des Rückgabetyps einer Funktion zur Verfügung: * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (dies ist parametrisiert, d.h. es handelt sich um eine Funktion, die einen Typ zurückgibt) * {{Z+|Z882}} (parametrisiert) * {{Z+|Z883}} (parametrisiert) * {{Z+|Z6884}} (parametrisiert, verwendet zur Definition von [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|leichtgewichtigen Aufzählungstypen]]) <span id="Numeric_types"></span> === Numerische Typen === * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <span id="Language_and_text_types"></span> === Sprach- und Texttypen === * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <span id="Grammatical_feature_enums"></span> ==== Aufzählungen grammatikalischer Funktionen ==== * {{Z+|Z28516}} (leichtgewichtige Aufzählung) * {{Z+|Z28519}} (leichtgewichtige Aufzählung) * {{Z+|Z25502}} (leichtgewichtige Aufzählung) * {{Z+|Z25340}} (leichtgewichtige Aufzählung) * {{Z+|Z25501}} (leichtgewichtige Aufzählung) * {{Z+|Z26935}} (leichtgewichtige Aufzählung) * {{Z+|Z26934}} (leichtgewichtige Aufzählung) * {{Z+|Z28215}} (leichtgewichtige Aufzählung) * {{Z+|Z28515}} (leichtgewichtige Aufzählung) * {{Z+|Z28517}} (leichtgewichtige Aufzählung) * {{Z+|Z32792}} (leichtgewichtige Aufzählung) * {{Z+|Z32789}} (leichtgewichtige Aufzählung) * {{Z+|Z27970}} (leichtgewichtige Aufzählung) * {{Z+|Z28518}} (leichtgewichtige Aufzählung) * {{Z+|Z28520}} (leichtgewichtige Aufzählung) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (leichtgewichtige Aufzählung) <span id="Calendar_types"></span> === Kalendertypen === <span id="Gregorian_calendar"></span> ==== Gregorianischer Kalender ==== * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <span id="Hijri_(Islamic)_calendar"></span> ==== Islamischer Kalender ==== * {{Z+|Z26582}} (leichtgewichtige Aufzählung) <span id="Igbo_calendar"></span> ==== Igbo-Kalender ==== * {{Z+|Z16927}} <span id="Wikidata_types"></span> === Wikidata-Typen === {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <span id="Wikidata_entities"></span> ==== Wikidata-Entitäten ==== * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <span id="Wikidata_references"></span> ==== Wikidata-Referenzen ==== * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <span id="Wikidata_statements"></span> ==== Wikidata-Aussagen ==== * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <span id="Wikidata_datatypes"></span> ==== Wikidata-Datentypen ==== * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (leichtgewichtige Aufzählung) * {{Z+|Z6063}} (leichtgewichtige Aufzählung) * {{Z+|Z6064}} <span id="Miscellaneous"></span> === Verschiedenes === * {{Z+|Z27951}} (leichtgewichtige Aufzählung) * {{Z+|Z28579}} * {{Z+|Z33827}} (leichtgewichtige Aufzählung) <span id="WikiLambda_structure"></span> === WikiLambda-Struktur === * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <span id="Evaluation"></span> ==== Auswertung ==== * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} Andere Typen können verwendet werden, es können jedoch Fehler auftreten. Für eine Liste aller Typen siehe [[Special:ListObjectsByType/Z4|Liste aller Typen]] (wobei dies weder [[Special:ListObjectsByType/Z7|persistente Aufrufe]] einschließt, die Typen wie die leichtgewichtigen Aufzählungen zurückgeben, noch parametrisierte Typen wie {{Z|881}}). Neue Typen können auf [[Wikifunctions:Type proposals]] vorgeschlagen werden. <span id="See_also"></span> == Siehe auch == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] 54mpora51snvdpzqxbfi04kemw9s630 Wikifunctions:How to create implementations/sk 4 35417 276458 240260 2026-05-20T06:15:43Z FuzzyBot 207 Updating to match new version of source page 276458 wikitext text/x-wiki <languages/> Táto stránka poskytuje podrobnejšieho sprievodcu '''vytváraním implementácií''', podrobnej ako v {{ll|Wikifunctions:Introduction}}. <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> V nasledujúcom texte uvádzame konkrétny príklad, ako vytvoriť Implementáciu vo forme kódu v Pythone. Povedzme, že chceme vytvoriť implementáciu funkcie, ktorá spojí dva vstupné reťazce s medzerou medzi nimi, čím vráti výsledok. Predpokladajme, že ZID tejto funkcie je Z11057. </div> <div class="mw-translate-fuzzy"> Implementácia sa definuje pomocou ZID funkcie. Rovnako ako argumenty funkcie. Takže v prípade funkcie Z11057 s jej dvoma argumentmi by mala byť prvý riadok takto: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> Keďže ide o Python, nezabudnite tento riadok odsadiť. <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> Pamätajte, že vykonávanie funkcie nemá stavový charakter. Nepoužívajte globálne alebo statické premenné. Ak máte ďalšie otázky o tom, čo môžete a nemôžete robiť v Pythone, opýtajte sa na [[Wikifunctions:Python implementations]]. <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div class="mw-translate-fuzzy"> V nasledujúcom texte uvádzame konkrétny príklad, ako vytvoriť Implementáciu vo forme kódu v JavaScripte. Povedzme, že chceme vytvoriť implementáciu funkcie, ktorá spojí dva vstupné reťazce s medzerou medzi nimi, čím vráti výsledok. Predpokladajme, že ZID tejto funkcie je Z11057. </div> <div class="mw-translate-fuzzy"> Implementácia sa definuje pomocou ZID funkcie. Rovnako ako argumenty funkcie. Takže v prípade funkcie Z11057 s jej dvoma argumentmi by mala byť prvý riadok takto: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> Pamätajte, že vykonávanie funkcie nemá stavový charakter. Nepoužívajte globálne alebo statické premenné. Ak máte ďalšie otázky o tom, čo môžete a nemôžete robiť v JavaScript, opýtajte sa na [[Wikifunctions:JavaScript implementations]]. <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == Zloženie == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] t3qgt8wsea7pxm93xuzwc9dp8jsa0ov Category:Status updates/sd 14 35532 276560 119917 2026-05-20T06:24:49Z FuzzyBot 207 Updating to match new version of source page 276560 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Programming languages/de 4 35784 276479 199688 2026-05-20T06:20:33Z FuzzyBot 207 Updating to match new version of source page 276479 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <span lang="en" dir="ltr" class="mw-content-ltr">[[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Special:MyLanguage/WF:glossary#composition|Compositions]] are a kind of LISPish language, but aren't covered here.</span> <span id="Executable"></span> == Ausführbar == <span id="Implemented"></span> === Implementiert === Stand März 2024 werden die folgenden Sprachen zu [[meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25|WASM]] kompiliert, um vom [[Special:MyLanguage/WF:glossary#executor|Ausführer]] ausgeführt zu werden: * <span class="mw-translate-fuzzy">nicht-versioniertes JavaScript ([https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy W3C Software and Document Notice and License], [https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license src]), unter Verwendung von [https://github.com/second-state/wasmedge-quickjs WasmEdge-QuickJS] (unter Verwendung von [https://bellard.org/quickjs/ QuickJS 2024], kompatibel mit ES2023)</span> * <span class="mw-translate-fuzzy">nicht-versioniertes Python ([https://docs.python.org/3/license.html PSF-Lizenzvereinbarung], Zero-Clause BSD), unter Verwendung der Entwicklungsversion von [https://github.com/RustPython/RustPython RustPython] im WASI-Modus (dies soll mit CPython 3.12 kompatibel sein)</span> <span id="Planned"></span> === Geplant === * versioniertes JavaScript (ECMA202?+) * versioniertes Python (3+) <span id="Requested"></span> === Beantragt === Siehe das [[phab:tag/wikifunctions-new-language-requests|Workboard im Phabricator]], um weitere Programmiersprachen zu beantragen, die auf Wikifunctions unterstützt werden sollen. Neben anderen Kriterien für die Implementierung muss die verfügbare Software für den Interpreter/Compiler der Sprache frei lizenziert sein. * [[phab:T352589|T352589]]: LabView/G<!--[https://ni.com/en/support/downloads/activate.html proprietär]--> über pyLabView ([https://github.com/mefistotelis/pylabview/blob/master/LICENSE MIT]) * [[phab:T352588|T352588]]: Kotlin ([https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE Apache]) * [[phab:T307171|T307171]]: Lua ([https://lua.org/license.html MIT]) * [[phab:T301418|T301418]]: Scratch/Snap!/Logolike ([https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE BSD 3-Clause], GPLv2 und Scratch-Quellcode-Lizenz) * [[phab:T298633|T298633]]: Vlojure ([https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE MIT]) <span id="Former"></span> === Ehemalig === Früher führte der Funktionsauswerter Code direkt in seinem Container aus. Da er auf Debian Bullseye basierte, wurde die JavaScript-Ausführung von Node.js 16 und die Python-Ausführung von Python 3.9 bereitgestellt. Diese sind aufgrund des Neuaufbaus auf Web Assembler nicht mehr sofort verfügbar, könnten aber bei Bedarf über eine benutzerdefinierte Erstellung wieder aktiviert werden. <span id="Functions_for_manipulating"></span> == Funktionen zur Manipulation == * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] r46xrixdrq7jfcalc279y2bziii6j4a Wikifunctions:Wikidata/en 4 35893 276530 235356 2026-05-20T06:23:45Z FuzzyBot 207 Updating to match new version of source page 276530 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} Wikifunctions is represented on [[:d:Wikidata:Main page|Wikidata]] by {{Q|Q104587954}}. More Wikidata and Wikifunctions here, soon! == Functionality we will want == === Items === * Check if an item exists * Get item ** {{done}} {{Z|6821}} * Get labels ** {{done}} {{Z|22853}} * Get aliases ** {{done}} {{Z|23080}} * Get descriptions ** {{done}} {{Z|30120}} * Get statement ** {{done}} {{Z|22220}} * ''possibly'' Get sitelinks ** {{done}} {{Z|35207}} === Statements === * Get values of statement ** {{done}} {{Z|19308}} * Get rank ** {{done}} {{Z|20206}} * Get property of statement ** {{done}} {{Z|19306}} * Get qualifiers ** {{done}} {{Z|28278}} * Get references ** {{done}} {{Z|31984}} === Properties === * Check if a property exists * Get property ** {{done}} {{Z|6822}} * Get labels ** {{done}} {{Z|23223}} * Get aliases ** {{done}} {{Z|23227}} * Get descriptions ** {{done}} {{Z|23225}} * Get data type * Get statement ** {{done}} {{Z|23229}} === Lexemes === * Check if a lexeme exists * Get lexeme ** {{done}} {{Z|6825}} * Get lemmata ** {{done}} {{Z|19293}} * Get languages ** {{done}} {{Z|19276}} * Get category ** {{done}} {{Z|19298}} * Get statement ** {{done}} {{Z|19300}} * Get sense ** {{done}} {{Z|6826}} * Get form ** {{done}} {{Z|6824}} ==== Senses ==== * Get gloss ** {{done}} {{Z|23114}} * Get statement ** {{done}} {{Z|23116}} ==== Forms ==== * Get representation ** {{done}} {{Z|22399}} * Get grammatical features ** {{done}} {{Z|22487}} * Get statement ** {{done}} {{Z|23118}} === Entity schemas === * Check is Entity Schema exists * Get Entity Schema * Get labels * Get aliases * Get descriptions [[Category:Project{{#translation:}}]] [[Category:Wikidata]] eq6bbbao54oth6sb5plnrmam6b26xtt Category:Status updates/fa 14 35946 276546 120884 2026-05-20T06:24:44Z FuzzyBot 207 Updating to match new version of source page 276546 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Wikidata/de 4 36064 276529 235355 2026-05-20T06:23:44Z FuzzyBot 207 Updating to match new version of source page 276529 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} Wikifunctions wird durch {{Q|Q104587954}} auf [[:d:Wikidata:Main page|Wikidata]] repräsentiert. Mehr über Wikidata und Wikifunctions in Kürze hier! <span id="Functionality_we_will_want"></span> == Gewünschte Funktionen == <span id="Items"></span> === Datenobjekte === * Prüfen, ob ein Datenobjekt existiert * Datenobjekt erhalten ** {{done}} {{Z|6821}} * Bezeichnungen erhalten ** {{done}} {{Z|22853}} * Aliasse erhalten ** {{done}} {{Z|23080}} * Beschreibungen erhalten ** {{done}} {{Z|30120}} * Aussage erhalten ** {{done}} {{Z|22220}} * ''möglicherweise'' Seitenlinks erhalten ** {{done}} {{Z|35207}} <span id="Statements"></span> === Aussagen === * Werte von Aussagen erhalten ** {{done}} {{Z|19308}} * Rang erhalten ** {{done}} {{Z|20206}} * Eigenschaft der Aussage erhalten ** {{done}} {{Z|19306}} * Qualifikatoren erhalten ** {{done}} {{Z|28278}} * Fundstellen erhalten ** {{done}} {{Z|31984}} <span id="Properties"></span> === Eigenschaften === * Prüfen, ob eine Eigenschaft existiert * Eigenschaft erhalten ** {{done}} {{Z|6822}} * Bezeichnungen erhalten ** {{done}} {{Z|23223}} * Aliasse erhalten ** {{done}} {{Z|23227}} * Beschreibungen erhalten ** {{done}} {{Z|23225}} * Datentyp erhalten * Aussage erhalten ** {{done}} {{Z|23229}} <span id="Lexemes"></span> === Lexeme === * Prüfen, ob ein Lexem existiert * Lexem erhalten ** {{done}} {{Z|6825}} * Lemmata erhalten ** {{done}} {{Z|19293}} * Sprachen erhalten ** {{done}} {{Z|19276}} * Kategorie erhalten ** {{done}} {{Z|19298}} * Aussage erhalten ** {{done}} {{Z|19300}} * Sinn erhalten ** {{done}} {{Z|6826}} * Form erhalten ** {{done}} {{Z|6824}} <span id="Senses"></span> ==== Sinne ==== * Glosse erhalten ** {{done}} {{Z|23114}} * Aussage erhalten ** {{done}} {{Z|23116}} <span id="Forms"></span> ==== Formen ==== * Repräsentation erhalten ** {{done}} {{Z|22399}} * Grammatikalische Merkmale erhalten ** {{done}} {{Z|22487}} * Aussage erhalten ** {{done}} {{Z|23118}} <span id="Entity_schemas"></span> === Entitätsschemas === * Prüfen, ob ein Entitätsschema existiert * Entitätsschema erhalten * Bezeichnungen erhalten * Aliasse erhalten * Beschreibungen erhalten [[Category:Project{{#translation:}}]] [[Category:Wikidata]] e7q6jkpzzoxg6fcgz6rapl0zcy759vj Category:Status updates/he 14 36263 276549 121738 2026-05-20T06:24:45Z FuzzyBot 207 Updating to match new version of source page 276549 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Translations:Wikifunctions:Human languages/1/en 1198 36935 276467 257678 2026-05-20T06:16:58Z FuzzyBot 207 Importing a new version from external source 276467 wikitext text/x-wiki Supported by the Natural Language Generation Special Interest Group; see also $1 and $2. Many of these are morphological functions; morphology is the part of linguistics that studies how language parts are 'shaped' and change diachronically and when inflected. agjtd1pfghrnzqdo2sp5z6p4iitinze Wikifunctions:Human languages/en 4 37049 276470 270540 2026-05-20T06:17:01Z FuzzyBot 207 Updating to match new version of source page 276470 wikitext text/x-wiki <languages/> {{draft}} Supported by the Natural Language Generation Special Interest Group; see also {{ll|WF:PROG}} and {{ll|WF:Catalogue/Natural language operations}}. Many of these are morphological functions; morphology is the part of linguistics that studies how language parts are 'shaped' and change diachronically and when inflected. Hausa, Igbo, Malayalam, Bangla/Bengali and Dagbani are [[d:Special:MyLanguage/Wikidata:Lexicographical data/Focus languages|focus languages]] for Wikidata's lexicographic dataset, which is an important aspect of [[Special:MyLanguage/WF:glossary#Abstract Wikipedia|Abstract Wikipedia]]. == Related pages == * [[:Category:Natural languages]] — List of categories for languages * {{ll|Wikifunctions:Catalogue/Natural language operations}} — Lists of natural language functions * {{ll|Wikifunctions:NLG functions}} — A table of each supported language's NLG functions ** {{ll|Wikifunctions:Cardinal numbers}} — List of each language's cardinal number functions * {{ll|Wikifunctions:Reserved ZIDs/all#Z1000-Z1999}} — List of all languages in ZObject order == Afroasiatic == * {{z+|Z1472}} (zgh) — [[/Z1472]] * {{z+|Z1013}} (ha) — [[/Z1013]] * Semitic ** Arabic *** {{z+|Z1001}} (ar) — [[/Z1001]] *** {{z+|Z1045}} (ary) — [[/Z1045]] *** {{z+|Z1582}} (aeb) — [[/Z1582]] ** {{z+|Z1186}} (he) — [[/Z1186]] == Austroasiatic == * {{z+|Z1048}} (vi) — [[/Z1048]] * (Mundari, no code yet) (unr) == Austronesian == * Malayic ** {{z+|Z1531}} (ms) — [[/Z1531]] *** {{z+|Z1434}} (ms-arab) — [[/Z1434]] ** {{z+|Z1078}} (id) — [[/Z1078]] * {{z+|Z1471}} (su) — [[/Z1471]] == Constructed == * {{z+|Z1882}} (ldn) — [[/Z1882]] * {{z+|Z1576}} (eo) — [[/Z1576]] * {{z+|Z1534}} (tlh) — [[/Z1534]] * {{z+|Z1762}} (tok) — [[/Z1762]] == Dravidian == * {{z+|Z1293}} (brh) — [[/Z1293]] * South ** {{z+|Z1012}} (ml) — [[/Z1012]] ** {{z+|Z1429}} (te) — [[/Z1429]] == Indo-European == * {{z+|Z1541}} (hy) — [[/Z1541]] * Balto-Slavic ** {{z+|Z1709}} (lv) — [[/Z1709]] ** Slavic *** East Slavic **** {{z+|Z1005}} (ru) — [[/Z1005]] **** {{z+|Z1332}} (uk) — [[/Z1332]] **** {{z+|Z1622}} (by) — [[/Z1622]] *** West Slavic **** {{z+|Z1062}} (cs) — [[/Z1062]] **** {{z+|Z1025}} (pl) — [[/Z1025]] **** {{z+|Z1488}} (sk) — [[/Z1488]] *** South Slavic **** {{z+|Z1823}} (bg) — [[/Z1823]] **** {{z+|Z1105}} (cu) — [[/Z1105]] **** {{z+|Z1412}} (sh) — [[/Z1412]] ***** {{z+|Z1473}} (bs) — [[/Z1473]] ***** {{z+|Z1272}} (hr) — [[/Z1272]] ***** {{z+|Z1498}} (cnr) — [[/Z1498]] ***** {{z+|Z1158}} (sr) — [[/Z1158]] **** {{z+|Z1616}} (sl) — [[/Z1616]] * Celtic ** {{z+|Z1282}} (br) — [[/Z1282]] ** {{z+|Z1024}} (cy) — [[/Z1024]] ** {{z+|Z1339}} (gd) — [[/Z1282]] * Germanic ** North Germanic *** East Scandinavian **** {{z+|Z1061}} (dk) — [[/Z1061]] **** {{z+|Z1592}} (sv) — [[/Z1592]] *** {{z+|Z1021}} (no) — [[/Z1592]] ** West Germanic *** North Sea **** {{z+|Z1002}} (en) — [[/Z1002]] ***** North American ****** {{z+|Z1689}} (en-US) — [[/Z1689]] ****** {{z+|Z1437}} (en-CA) — [[/Z1437]] ***** {{z+|Z1113}} (en-AU) — [[/Z1113]] ***** {{z+|Z1199}} (en-GB) — [[/Z1199]] ***** {{z+|Z1966}} (en-IN) — [[/Z1966]] ***** {{z+|Z1881}} (en-x-piglatin) — [[/Z1881]] ***** {{z+|Z1124}} (en-x-simple) — [[/Z1124]] **** {{z+|Z1146}} (nds) — [[/Z1146]] *** High German **** {{z+|Z1099}} (lb) — [[/Z1099]] **** {{z+|Z1430}} (de) — [[/Z1430]] *** {{z+|Z1157}} (nl) — [[/Z1157]] * {{z+|Z1827}} (el) — [[/Z1827]] * Indo-Iranian ** Indo-Aryan *** Hindustani **** {{z+|Z1820}} (hi) — [[/Z1820]] **** {{z+|Z1717}} (ur) — [[/Z1717]] *** Northwestern **** Punjabic ***** {{z+|Z1657}} (pa) — [[/Z1657]] ***** {{z+|Z1083}} (pnb) — [[/Z1083]] **** {{z+|Z1191}} (sd) — [[/Z1191]] *** Eastern **** {{z+|Z1011}} (bn) — [[/Z1011]] **** Rohingya (rhg) ***** {{z+|Z1978}} (rhg-rohg) — [[/Z1978]] ***** {{z+|Z1979}} (rhb-arab) — [[/Z1979]] ** Iranian *** Northwestern **** {{z+|Z1747}} (bal) — [[/Z1747]] **** {{z+|Z1556}} (ku) — [[/Z1556]] ***** {{z+|Z1288}} (ckb) — [[/Z1288]] *** {{z+|Z1728}} (fa) — [[/Z1728]] **** {{z+|Z1207}} (tg) — [[/Z1207]] **** {{z+|Z1265}} (fa-AF / prs) — [[/Z1265]] **** {{z+|Z1277}} (jpr) — [[/Z1277]] * Italic ** {{z+|Z1403}} (la) — [[/Z1403]] ** Romance *** Continental Romance **** Western Romance ***** Ibero-Romance ****** {{z+|Z1037}} (pt) — [[/Z1037]] ******* {{z+|Z1381}} (pt-BR) — [[/Z1381]] ****** {{z+|Z1003}} (es) — [[/Z1003]] ***** Occitano-Romance ****** {{z+|Z1789}} (ca) — [[/Z1789]] ***** North Gallo-Romance ****** {{z+|Z1004}} (fr) — [[/Z1004]] ***** North Italian ****** {{Z+|Z1363}} (vec) — [[/Z1363]] ****** {{z+|Z1483}} (lad) — [[/Z1483]] **** South Romance ***** {{z+|Z1787}} (it) — [[/Z1787]] ***** {{z+|Z1329}} (co) — [[/Z1329]] ***** {{z+|Z1082}} (sdc) — [[/Z1082]] ***** {{z+|Z1491}} (nap) — [[/Z1491]] ***** {{z+|Z1298}} (scn) — [[/Z1298]] **** Balkan romance ***** {{z+|Z1664}} (ro) — [[/Z1664]] *** Island Romance **** {{z+|Z1342}} (sc) — [[/Z1342]] == Kra-Dai == * {{z+|Z1851}} (th) — [[/Z1851]] == Niger-Congo == * Atlantic-Congo ** {{z+|Z1015}} (dag) — [[/Z1015]] ** Volta-Congo *** Volta-Niger **** {{z+|Z1014}} (ig) — [[/Z1014]] **** {{z+|Z1818}} (ya) — [[/Z1818]] *** {{z+|Z1179}} (kcg) — [[/Z1179]] == Mixed and creoles == These languages are sorted under the language it is primarily based on. * {{Z|Z1531}} ** {{z+|Z1630}} (bew) — [[/Z1630]] * {{Z|Z1037}} ** {{z+|Z1806}} (kea) — [[/Z1806]] == Sign == * {{z+|Z1763}} (ase) — [[/Z1763]] * {{z+|Z1907}} (bzs) - [[/Z1907]] * {{z+|Z}}{{q|2107617}} (vgt) - [[/vgt]] == Sino-Tibetan == * {{z+|Z1147}} (dz) — [[/Z1147]] * Sinitic ** {{z+|Z1006}} (zh) — [[/Z1006]] *** {{z+|Z1645}} (zh-hans) — [[/Z1645]] **** {{z+|Z1411}} (zh-CN) — [[/Z1411]] *** {{z+|Z1672}} (zh-hant) — [[/Z1672]] **** {{z+|Z1589}} (zh-HK) — [[/Z1589]] ** {{z+|Z1202}} (zh-yue) — [[/Z1202]] *** {{z+|Z1901}} (yue-hans) — [[/Z1901]] *** {{z+|Z1902}} (yue-hant) — [[/Z1902]] == Turkic == * Oghuz ** {{z+|Z1237}} (tr) — [[/Z1237]] ** {{z+|Z1597}} (az) — [[/Z1597]] * {{z+|Z1120}} (uz) — [[/Z1120]] == Uralic == * {{z+|Z1051}} (fi) — [[/Z1051]] * {{z+|Z1513}} (hu) — [[/Z1513]] == Isolates and smaller families == * {{z+|Z1314}} (eu) — [[/Z1314]] * {{z+|Z1830}} (ja) — [[/Z1830]] ** {{z+|Z1444}} (ja-hkrt) — [[/Z1444]] ** Japanese rōmaji, no ZObject (ja-latn) * {{z+|Z1643}} (ko) — [[/Z1643]] * {{z+|Z1678}} (qu) — [[/Z1678]] == Other == * {{z+|Z1360}} (mul) — [[/Z1360]] [[Category:Natural languages| mul]] [[Category:WikiProjects]] kvfvjxvfpomqakmm1tqlt0vb3j4q507 Wikifunctions:Human languages/de 4 37053 276471 270554 2026-05-20T06:17:01Z FuzzyBot 207 Updating to match new version of source page 276471 wikitext text/x-wiki <languages/> {{draft}} <div class="mw-translate-fuzzy"> Unterstützt durch die Natural Language Generation Special Interest Group; siehe auch {{ll|WF:PROG}} und {{ll|WF:Catalogue/Natural language operations}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Hausa, Igbo, Malayalam, Bangla/Bengali and Dagbani are [[d:Special:MyLanguage/Wikidata:Lexicographical data/Focus languages|focus languages]] for Wikidata's lexicographic dataset, which is an important aspect of [[Special:MyLanguage/WF:glossary#Abstract Wikipedia|Abstract Wikipedia]]. </div> <span id="Related_pages"></span> == Verwandte Seiten == * [[:Category:Natural languages]] — Liste von Kategorien für Sprachen * {{ll|Wikifunctions:Catalogue/Natural language operations}} — Listen von Funktionen für natürliche Sprache * {{ll|Wikifunctions:NLG functions}} — Eine Tabelle der NLG-Funktionen jeder unterstützten Sprache ** {{ll|Wikifunctions:Cardinal numbers}} — Liste der Kardinalzahl-Funktionen jeder Sprache * {{ll|Wikifunctions:Reserved ZIDs/all#Z1000-Z1999}} — Liste aller Sprachen in Reihenfolge der ZObjekte <span id="Afroasiatic"></span> == Afroasiatisch == * {{z+|Z1472}} (zgh) — [[/Z1472]] * {{z+|Z1013}} (ha) — [[/Z1013]] * Semitisch ** Arabisch *** {{z+|Z1001}} (ar) — [[/Z1001]] *** {{z+|Z1045}} (ary) — [[/Z1045]] *** {{z+|Z1582}} (aeb) — [[/Z1582]] ** {{z+|Z1186}} (he) — [[/Z1186]] <span id="Austroasiatic"></span> == Austroasiatisch == * {{z+|Z1048}} (vi) — [[/Z1048]] * (Mundari, noch kein Code) (unr) <span id="Austronesian"></span> == Austronesisch == * Malaiisch ** {{z+|Z1531}} (ms) — [[/Z1531]] *** {{z+|Z1434}} (ms-arab) — [[/Z1434]] ** {{z+|Z1078}} (id) — [[/Z1078]] * {{z+|Z1471}} (su) — [[/Z1471]] <span id="Constructed"></span> == Konstruiert == * {{z+|Z1882}} (ldn) — [[/Z1882]] * {{z+|Z1576}} (eo) — [[/Z1576]] * {{z+|Z1534}} (tlh) — [[/Z1534]] * {{z+|Z1762}} (tok) — [[/Z1762]] <span id="Dravidian"></span> == Dravidisch == * {{z+|Z1293}} (brh) — [[/Z1293]] * Südlich ** {{z+|Z1012}} (ml) — [[/Z1012]] ** {{z+|Z1429}} (te) — [[/Z1429]] <span id="Indo-European"></span> == Indoeuropäisch == * {{z+|Z1541}} (hy) — [[/Z1541]] * Baltoslawisch ** {{z+|Z1709}} (lv) — [[/Z1709]] ** Slawisch *** Ostslawisch **** {{z+|Z1005}} (ru) — [[/Z1005]] **** {{z+|Z1332}} (uk) — [[/Z1332]] **** {{z+|Z1622}} (by) — [[/Z1622]] *** Westslawisch **** {{z+|Z1062}} (cs) — [[/Z1062]] **** {{z+|Z1025}} (pl) — [[/Z1025]] **** {{z+|Z1488}} (sk) — [[/Z1488]] *** Südslawisch **** {{z+|Z1823}} (bg) — [[/Z1823]] **** {{z+|Z1105}} (cu) — [[/Z1105]] **** {{z+|Z1412}} (sh) — [[/Z1412]] ***** {{z+|Z1473}} (bs) — [[/Z1473]] ***** {{z+|Z1272}} (hr) — [[/Z1272]] ***** {{z+|Z1498}} (cnr) — [[/Z1498]] ***** {{z+|Z1158}} (sr) — [[/Z1158]] **** {{z+|Z1616}} (sl) — [[/Z1616]] * Keltisch ** {{z+|Z1282}} (br) — [[/Z1282]] ** {{z+|Z1024}} (cy) — [[/Z1024]] ** {{z+|Z1339}} (gd) — [[/Z1282]] * Germanisch ** Nordgermanisch *** Ostskandinavisch **** {{z+|Z1061}} (dk) — [[/Z1061]] **** {{z+|Z1592}} (sv) — [[/Z1592]] *** {{z+|Z1021}} (no) — [[/Z1592]] ** Westgermanisch *** Nordsee **** {{z+|Z1002}} (en) — [[/Z1002]] ***** Nordamerika ****** {{z+|Z1689}} (en-US) — [[/Z1689]] ****** {{z+|Z1437}} (en-CA) — [[/Z1437]] ***** {{z+|Z1113}} (en-AU) — [[/Z1113]] ***** {{z+|Z1199}} (en-GB) — [[/Z1199]] ***** {{z+|Z1966}} (en-IN) — [[/Z1966]] ***** {{z+|Z1881}} (en-x-piglatin) — [[/Z1881]] ***** {{z+|Z1124}} (en-x-simple) — [[/Z1124]] **** {{z+|Z1146}} (nds) — [[/Z1146]] *** Hochdeutsch **** {{z+|Z1099}} (lb) — [[/Z1099]] **** {{z+|Z1430}} (de) — [[/Z1430]] *** {{z+|Z1157}} (nl) — [[/Z1157]] * {{z+|Z1827}} (el) — [[/Z1827]] * Indoiranisch ** Indogermanisch *** Hindustani **** {{z+|Z1820}} (hi) — [[/Z1820]] **** {{z+|Z1717}} (ur) — [[/Z1717]] *** Nordwestlich **** Punjabisch ***** {{z+|Z1657}} (pa) — [[/Z1657]] ***** {{z+|Z1083}} (pnb) — [[/Z1083]] **** {{z+|Z1191}} (sd) — [[/Z1191]] *** Östlich **** {{z+|Z1011}} (bn) — [[/Z1011]] **** Rohingya (rhg) ***** {{z+|Z1978}} (rhg-rohg) — [[/Z1978]] ***** {{z+|Z1979}} (rhb-arab) — [[/Z1979]] ** Iranisch *** Nordwestlich **** {{z+|Z1747}} (bal) — [[/Z1747]] **** {{z+|Z1556}} (ku) — [[/Z1556]] ***** {{z+|Z1288}} (ckb) — [[/Z1288]] *** {{z+|Z1728}} (fa) — [[/Z1728]] **** {{z+|Z1207}} (tg) — [[/Z1207]] **** {{z+|Z1265}} (fa-AF / prs) — [[/Z1265]] **** {{z+|Z1277}} (jpr) — [[/Z1277]] * Italisch ** {{z+|Z1403}} (la) — [[/Z1403]] ** Romanisch *** Kontinentalromanisch **** Westromanisch ***** Iberoromanisch ****** {{z+|Z1037}} (pt) — [[/Z1037]] ******* {{z+|Z1381}} (pt-BR) — [[/Z1381]] ****** {{z+|Z1003}} (es) — [[/Z1003]] ***** Okzitanoromanisch ****** {{z+|Z1789}} (ca) — [[/Z1789]] ***** Nord-Galloromanisch ****** {{z+|Z1004}} (fr) — [[/Z1004]] ***** Norditalienisch ****** {{Z+|Z1363}} (vec) — [[/Z1363]] ****** {{z+|Z1483}} (lad) — [[/Z1483]] **** Südromanisch ***** {{z+|Z1787}} (it) — [[/Z1787]] ***** {{z+|Z1329}} (co) — [[/Z1329]] ***** {{z+|Z1082}} (sdc) — [[/Z1082]] ***** {{z+|Z1491}} (nap) — [[/Z1491]] ***** {{z+|Z1298}} (scn) — [[/Z1298]] **** Balkanromanisch ***** {{z+|Z1664}} (ro) — [[/Z1664]] *** Islandromanisch **** {{z+|Z1342}} (sc) — [[/Z1342]] <span id="Kra-Dai"></span> == Tai-Kadai == * {{z+|Z1851}} (th) — [[/Z1851]] <span id="Niger-Congo"></span> == Niger-Kongo == * Atlantik-Kongo ** {{z+|Z1015}} (dag) — [[/Z1015]] ** Volta-Kongo *** Volta-Niger **** {{z+|Z1014}} (ig) — [[/Z1014]] **** {{z+|Z1818}} (ya) — [[/Z1818]] *** {{z+|Z1179}} (kcg) — [[/Z1179]] <span id="Mixed_and_creoles"></span> == Gemischt und Kreolisch == Diese Sprachen sind nach der Sprache sortiert, auf der sie primär basieren. * {{Z|Z1531}} ** {{z+|Z1630}} (bew) — [[/Z1630]] * {{Z|Z1037}} ** {{z+|Z1806}} (kea) — [[/Z1806]] <span id="Sign"></span> == Gebärden == * {{z+|Z1763}} (ase) — [[/Z1763]] * {{z+|Z1907}} (bzs) - [[/Z1907]] * {{z+|Z}}{{q|2107617}} (vgt) - [[/vgt]] <span id="Sino-Tibetan"></span> == Sinotibetisch == * {{z+|Z1147}} (dz) — [[/Z1147]] * Sinitisch ** {{z+|Z1006}} (zh) — [[/Z1006]] *** {{z+|Z1645}} (zh-hans) — [[/Z1645]] **** {{z+|Z1411}} (zh-CN) — [[/Z1411]] *** {{z+|Z1672}} (zh-hant) — [[/Z1672]] **** {{z+|Z1589}} (zh-HK) — [[/Z1589]] ** {{z+|Z1202}} (zh-yue) — [[/Z1202]] *** {{z+|Z1901}} (yue-hans) — [[/Z1901]] *** {{z+|Z1902}} (yue-hant) — [[/Z1902]] <span id="Turkic"></span> == Turksprachen == * Oghusisch ** {{z+|Z1237}} (tr) — [[/Z1237]] ** {{z+|Z1597}} (az) — [[/Z1597]] * {{z+|Z1120}} (uz) — [[/Z1120]] <span id="Uralic"></span> == Uralisch == * {{z+|Z1051}} (fi) — [[/Z1051]] * {{z+|Z1513}} (hu) — [[/Z1513]] <span id="Isolates_and_smaller_families"></span> == Isolate und kleinere Familien == * {{z+|Z1314}} (eu) — [[/Z1314]] * {{z+|Z1830}} (ja) — [[/Z1830]] ** {{z+|Z1444}} (ja-hkrt) — [[/Z1444]] ** Japanisches Rōmaji, kein ZObjekt (ja-latn) * {{z+|Z1643}} (ko) — [[/Z1643]] * {{z+|Z1678}} (qu) — [[/Z1678]] <span id="Other"></span> == Andere == * {{z+|Z1360}} (mul) — [[/Z1360]] [[Category:Natural languages| mul]] [[Category:WikiProjects]] 1n1ke1f2g7kkkf7oee9k1copbc7uhaq Wikifunctions:Type/pt-br 4 38426 276523 270491 2026-05-20T06:23:35Z FuzzyBot 207 Updating to match new version of source page 276523 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} Todo Objeto na Wikifunções pertence a um Tipo. Os Tipos decidem como os Objetos desse Tipo são estruturados e o que eles significam. Os Tipos também são usados para especificar os Argumentos de uma Função e o que uma Função retorna. <div class="mw-translate-fuzzy"> Atualmente, há dez Tipos disponíveis para especificar os Argumentos e o Tipo de retorno de uma Função: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div class="mw-translate-fuzzy"> Outros tipos podem ser usados, mas pode haver bugs. Para uma lista de todos os tipos, veja [[Special:ListObjectsByType/Z4|a lista de todos os tipos]] </div> Novos Tipos podem ser propostos em [[Wikifunctions:Type proposals]]. <span id="See_also"></span> == Ver também == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] jy2kogu56ce4guqa7s5zts3steci2hp Z18927 0 38659 276198 276168 2026-05-19T13:28:00Z Ameisenigel 44 de 276198 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18927" }, "Z2K2": "^[A-Za-z]+(?:\\s+[A-Za-z]+)*$", "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "phrase" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "^[A-Za-z]+(?:\\s+[A-Za-z]+)*$" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "one or more words constituting a grammatical unit" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "eines oder mehrere Wörter, die einen Satz ergeben" } ] } } fimqlj0xctbcppibmjnvg2wryw3l5p7 Z18928 0 38660 276199 264402 2026-05-19T13:28:45Z Ameisenigel 44 de 276199 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18928" }, "Z2K2": "^(?:(?:the|a|an|this|that|these|those|my|your|his|her|our|their)\\s+)?(?:[A-Za-z]+\\s+)*[A-Za-z]+$", "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "noun phrase" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Nominalphrase" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "a phrase headed by a noun" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "^(?:(?:the|a|an|this|that|these|those|my|your|his|her|our|their)\\s+)?(?:[A-Za-z]+\\s+)*[A-Za-z]+$" } ] } } flr4l3yjby9rbk3zwrhe8kgrxzzz5le 276283 276199 2026-05-19T19:20:36Z Jsamwrites 938 276283 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18928" }, "Z2K2": "^(?:(?:the|a|an|this|that|these|those|my|your|his|her|our|their)\\s+)?(?:[A-Za-z]+\\s+)*[A-Za-z]+$", "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "English noun phrase" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Nominalphrase" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "a phrase headed by a noun" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "^(?:(?:the|a|an|this|that|these|those|my|your|his|her|our|their)\\s+)?(?:[A-Za-z]+\\s+)*[A-Za-z]+$" } ] } } or0i3oyq1nbjkzpef0mkk5a38subqmz Z18929 0 38661 276200 264401 2026-05-19T13:29:37Z Ameisenigel 44 de 276200 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18929" }, "Z2K2": "^(?:(?:can|could|will|would|shall|should|may|might|must|have|has|had|is|are|was|were|be|been|being)\\s+)+\\w+$", "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "verb phrase" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Verbalphrase" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "phrase headed by a verb" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "^(?:(?:can|could|will|would|shall|should|may|might|must|have|has|had|is|are|was|were|be|been|being)\\s+)+\\w+$" } ] } } qi7j5o83opw6a17g9x0a2774sukz008 276202 276200 2026-05-19T15:09:44Z Dv103 11127 specified it's only valid for English; +it 276202 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18929" }, "Z2K2": "^(?:(?:can|could|will|would|shall|should|may|might|must|have|has|had|is|are|was|were|be|been|being)\\s+)+\\w+$", "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "English verb phrase" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Verbalphrase" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "sintagma verbale inglese" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "phrase headed by a verb" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "^(?:(?:can|could|will|would|shall|should|may|might|must|have|has|had|is|are|was|were|be|been|being)\\s+)+\\w+$" } ] } } ookch7ylrywq33o3laapwuyw4gcu65j Z18931 0 38663 276568 203381 2026-05-20T07:14:03Z Ameisenigel 44 de 276568 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18931" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z14311", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z14311", "Z14311K1": [ "Z14293", { "Z1K1": "Z14293", "Z14293K1": "Z18871", "Z14293K2": [ "Z60", "Z1002", "Z1113", "Z1199", "Z1437", "Z1124" ] } ], "Z14311K2": "Z801", "Z14311K3": "Z1002" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14562", "Z14562K2": "Z18871" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "pick en generator for imperative sentence (verb)" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Englischer Imperativsatz für Sprachliste" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "choose English generator function for imperative sentence (verb)" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "pick the English generator for imperative sentence of the form verb" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "wählt die Funktion für den englischen Imperativsatz aus" } ] } } 70giqca8wc0v3cozh9fx8i1t5zw65em Z18933 0 38666 276569 126506 2026-05-20T07:15:06Z Ameisenigel 44 de 276569 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18933" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z18932", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z18932", "Z18932K1": "H2O" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "18.02 g/mol" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "H2O = 18.02 g/mol" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "H2O = 18.02 g/mol" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } hv0jt2fa49n4lm68ytsfjqr9m7ttn9x Z18934 0 38667 276570 126512 2026-05-20T07:15:27Z Ameisenigel 44 de 276570 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18934" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z18932", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z18932", "Z18932K1": "H2SO4" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "98.07 g/mol" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "H2SO4 = 98.09 g/mol" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "H2SO4 = 98.09 g/mol" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } ilodlz2efgn4s2xj2ageduqin1i3hfj Z18935 0 38668 276571 126508 2026-05-20T07:15:48Z Ameisenigel 44 de 276571 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18935" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z18932", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z18932", "Z18932K1": "P" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "30.97 g/mol" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "P = 30.97 g/mol" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "P = 30.97 g/mol" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } gs10pcqk7ikf2e52y4pvqnnk6vs847l Z18936 0 38669 276572 126509 2026-05-20T07:16:06Z Ameisenigel 44 de 276572 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18936" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z18932", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z18932", "Z18932K1": "C27H46O" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "386.64 g/mol" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "C27H46O = 386.64 g/mol" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "C27H46O = 386.64 g/mol" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } mychqd88lq68u7b0uz654zhy0m3iz91 Category:Status updates/ckb 14 38882 276541 126890 2026-05-20T06:24:42Z FuzzyBot 207 Updating to match new version of source page 276541 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Z18939 0 38907 276574 203604 2026-05-20T07:18:36Z Ameisenigel 44 de 276574 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18939" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z18939K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string to convert first character to sign" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "untaian untuk mengonversi karakter pertama ke tand" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "carattere" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Zeichen" } ] } } ], "Z8K2": "Z16659", "Z8K3": [ "Z20", "Z18941", "Z18942", "Z18943", "Z18944" ], "Z8K4": [ "Z14", "Z18940", "Z23721" ], "Z8K5": "Z18939" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "character to sign" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "karakter ke tanda" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "carattere in segno" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Zeichen in Vorzeichen" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "first character to sign", "sign from first character" ] }, { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "primo carattere in segno" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first char \"+\" = positive, \"-\" = negative, \"0\" = neutral. Add other symbols. Default neutral." }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "karakter pertama \"+\" = positif, \"-\" = negatif, \"0\" = netral. Menambahkan 141 simbol lainnya. Bawaan netral." }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Controlla in base al primo carattere della stringa: \"+\": positivo, \"-\": negativo, \"0\": neutro. È possibile aggiungere nuovi simboli. Di default restituisce neutro." }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "+ = positiv\n- = negativ\n0 = neutral" } ] } } hh0e5jal5iqvi0vmeve1mwm9lb4b33g 276575 276574 2026-05-20T07:18:41Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276575 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18939" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z18939K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string to convert first character to sign" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "untaian untuk mengonversi karakter pertama ke tand" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "carattere" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Zeichen" } ] } } ], "Z8K2": "Z16659", "Z8K3": [ "Z20", "Z18941", "Z18942", "Z18943", "Z18944" ], "Z8K4": [ "Z14", "Z23721", "Z18940" ], "Z8K5": "Z18939" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "character to sign" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "karakter ke tanda" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "carattere in segno" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Zeichen in Vorzeichen" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "first character to sign", "sign from first character" ] }, { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "primo carattere in segno" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first char \"+\" = positive, \"-\" = negative, \"0\" = neutral. Add other symbols. Default neutral." }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "karakter pertama \"+\" = positif, \"-\" = negatif, \"0\" = netral. Menambahkan 141 simbol lainnya. Bawaan netral." }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Controlla in base al primo carattere della stringa: \"+\": positivo, \"-\": negativo, \"0\": neutro. È possibile aggiungere nuovi simboli. Di default restituisce neutro." }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "+ = positiv\n- = negativ\n0 = neutral" } ] } } 2ea3e2etjuqggidv6dq15p0v5odw6rz Z18940 0 38908 276576 126947 2026-05-20T07:19:06Z Ameisenigel 44 de 276576 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18940" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z18939", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z610", "Z16K2": "def Z18939(Z18939K1):\n\tif (Z18939K1[0]==\"+\"): return +1\n\tif (Z18939K1[0]==\"-\"): return -1\n\tif (Z18939K1[0]==\"−\"): return -1\n\treturn 0" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "character to sign, python" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Zeichen in Vorzeichen in Python" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 8chn081llqpdxv3di6fnx21nzhfjyyj Z18979 0 39115 276286 264400 2026-05-19T19:21:33Z Jsamwrites 938 276286 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z18979" }, "Z2K2": "^(?:(?:very|quite|too|so|rather|extremely|fairly)\\s+)*(?:\\w+ly|\\w+)$", "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "English adverb phrase" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "phrase headed by an adverb" } ] } } f5nw1ekyxaukmk421bxi1fefwbq7vlc Wikifunctions:Type/pl 4 41039 276524 270490 2026-05-20T06:23:34Z FuzzyBot 207 Updating to match new version of source page 276524 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <span id="Miscellaneous"></span> === Różne === * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <span id="Evaluation"></span> ==== Ewaluacja ==== * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == Zobacz też == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] 7xp8sqb7em1p2x0laxmoowoe28p3izf Z19308 0 41311 276214 236353 2026-05-19T15:55:03Z Dv103 11127 +it 276214 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z19308" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6003", "Z17K2": "Z19308K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "statement" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "বিবৃতি" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "déclaration" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "nkwupụta: nkwupụta Wikidata" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "dichiarazione" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z22895" ], "Z8K4": [ "Z14", "Z19309" ], "Z8K5": "Z19308" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value of Wikidata statement" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "উইকিউপাত্ত বিবৃতির মান" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "valeur de la déclaration Wikidata" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "uru nke nkwupụta Wikidata" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "위키데이터 정책의 값" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "valore di dichiarazione Wikidata" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "returns the value (Z6003K3) of a Wikidata statement as an object" }, { "Z1K1": "Z11", "Z11K1": "Z1011", "Z11K2": "একটি উইকিউপাত্ত বিবৃতির মান প্রদান করবে, বস্তু হিসেবে" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "renvoie la valeur (Z6003K3) d'une instruction Wikidata en tant qu'objet" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "weghachi uru (Z6003K3) nke nkwupụta Wikidata dịka ihe" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "객체로서 위키데이터 정책 값(Z6003K3)을 반환" } ] } } 8fgkfgmiibvne4i8mlpb8z97d5x0h34 Wikifunctions:Catalogue/Generic object operations 4 41961 276586 234670 2026-05-20T08:20:17Z YoshiRulz 10156 Add value by key or else 276586 wikitext text/x-wiki ''Note that due to handling all types of objects, some of these functions have bugs'' * {{Z+|Z801}} * {{Z+|Z803}} '''''[[phab:T389487]]''''' ** {{Z+|Z22475}} ** {{Z+|Z35428}} ** {{Z+|Z20165}} *** {{Z+|Z28439}} *** {{Z+|Z28442}} ** {{Z+|Z23439}} ** {{Z+|Z17225}} ** {{Z+|Z30433}} *** {{Z+|Z27430}} ** {{Z+|Z27413}} * {{Z+|Z804}} * {{Z+|Z805}} * {{Z+|Z808}} * {{Z+|Z16829}} '''''[[phab: T363623]]''''' * {{Z+|Z13052}} * {{Z+|Z23360}} * {{Z+|Z19108}} * {{Z+|Z15801}} ** {{Z+|Z19352}} * {{Z+|Z18683}} * {{Z+|Z23578}} * {{Z+|Z24542}} * {{Z+|Z899}} * {{Z+|Z16575}} * {{Z+|Z828}} ** {{Z+|Z29120}} * {{Z+|Z29102}} ** {{Z+|Z29113}} ===Search for=== [[Special:Search/: "Z8K2 Z1" OR "Z8K2 Z1K1 Z7 Z7K1 Z881 Z881K1 Z1" OR "Z17K1 Z1" OR "Z17K1 Z1K1 Z7 Z7K1 Z881 Z881K1 Z1" |All functions]] with {{Z|Z1}} arguments or return values * [[Special:Search/: !"Z8K2 Z1K1 Z7 Z7K1 Z881 Z881K1" !"Z17K1 Z1K1 Z7 Z7K1 Z881 Z881K1" "Z8K2 Z1" OR "Z17K1 Z1"|Not including list functions]] [[Category:Lists of functions]] 95ksosqi1lhwg4nvfudwmg98bngg55v Wikifunctions:Catalogue/Type handling 4 41962 276591 256897 2026-05-20T08:28:21Z YoshiRulz 10156 /* functions directly connected to type objects */ Add links to helper functions 276591 wikitext text/x-wiki ===functions directly connected to type objects=== {| class="wikitable sortable" |- ! connected to Type ! validator ! equality function ! display function ! reading function |- | {{Z|Z1}} || {{Z|Z101}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z2}} || {{Z|Z102}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z3}} || {{Z|Z103}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z4}} || {{Z|Z104}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z5}} || {{Z|Z105}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z6}} || {{Z|Z106}} || {{Z|Z866}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z7}} || {{Z|Z107}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z8}} || {{Z|Z108}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z9}} || {{Z|Z109}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z11}} || {{Z|Z111}} || {{Z|Z14392}} || {{Z|Z21583}} || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z12}} || {{Z|Z112}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z14}} || {{Z|Z114}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z16}} || {{Z|Z116}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z17}} || {{Z|Z117}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z18}} || {{Z|Z118}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z20}} || {{Z|Z120}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z13518}} || <small>{{Z|Z101}}</small> ||{{Z|Z13522}} || {{Z|Z14280}} || {{Z|Z14290}} |- | {{Z|Z16683}} || <small>{{Z|Z101}}</small> ||{{Z|Z16688}} || {{Z|Z16700}} || {{Z|Z16705}} |- | {{Z|Z19677}} || <small>{{Z|Z101}}</small> || {{Z|Z19686}} || {{Z|Z21971}} || {{Z|Z21930}} |- | {{Z|Z20838}} || <small>{{Z|Z101}}</small> || {{Z|Z20850}} || {{Z|Z21956}} || {{Z|Z21925}} |- | {{Z|Z6008}} || <small>{{Z|Z101}}</small> || {{Z|Z6808}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z6020}} || <small>{{Z|Z101}}</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z6095}} || <small>{{Z|Z101}}</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z6884}} (all cases) || {{Z|Z6184}} || {{Z|Z6894}} || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |- | {{Z|Z6039}} || <small>{{Z|Z101}}</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> || <small>''{{Z|Z6022}}''</small> |} ''<small>The Wikitext for additional rows can be produced using {{Z|Z28357}}.</small>'' These can be retrieved programmatically with these functions: * {{Z+|Z30890}} * {{Z+|Z31981}} ** {{Z+|Z35433}} * TODO display func * TODO reader func ===general tests=== *{{Z+|Z19084}} *{{Z+|Z16829}} *{{Z+|Z17893}} *{{Z+|Z22764}} *{{Z+|Z18626}} *{{Z+|Z18569}} *{{Z+|Z13220}} *{{Z+|Z17879}} *{{Z+|Z17900}} *{{Z+|Z10112}} *{{Z+|Z21174}} *{{Z+|Z21172}} *{{Z+|Z21177}} ===tests for specific types=== *{{Z+|Z15717}} *{{Z+|Z15777}} *{{Z+|Z15818}} *{{Z+|Z23645}} *{{Z+|Z23672}} ===conversion=== *{{Z+|Z10730}} *{{Z+|Z13713}} *{{Z+|Z23737}} *{{Z+|Z27854}} ===Keys=== *{{Z+|Z23318}} *{{Z+|Z23320}} *{{Z+|Z17359}} *{{Z+|Z23323}} *{{Z+|Z23327}} *{{Z+|Z22499}} *{{Z+|Z19108}} ===Key accessors=== *{{Z+|Z803}} *{{Z+|Z804}} <!-- convert to table when more complete --> **Z1K1: {{Z+|Z16829}} **Z3K1: {{Z+|Z23318}} **Z3K2: {{Z+|Z23320}} **Z3K3: {{Z+|Z23324}} **Z3K4: {{Z+|Z23328}} **Z4K1: {{Z+|Z19077}} **Z4K2: {{Z+|Z30833}} **Z4K3: {{Z+|Z30890}} **Z6039K1: {{Z+|Z31931}} **Z6039K2: {{Z+|Z31934}} **Z6039K3: {{Z+|Z31976}} **Z6039K4: {{Z+|Z31973}} **Z6039K5: {{Z+|Z31703}} *{{Z+|Z29535}} *{{Z+|Z16556}} [[Category:Lists of functions]] 9x7vq9s8l84o4uwi2myr3ljbcbm34dn Category:Status updates/fr 14 41967 276547 135873 2026-05-20T06:24:44Z FuzzyBot 207 Updating to match new version of source page 276547 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/az 14 42206 276539 136475 2026-05-20T06:24:41Z FuzzyBot 207 Updating to match new version of source page 276539 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/bn 14 42207 276538 136476 2026-05-20T06:24:41Z FuzzyBot 207 Updating to match new version of source page 276538 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/eo 14 42208 276544 136477 2026-05-20T06:24:43Z FuzzyBot 207 Updating to match new version of source page 276544 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/gu 14 42209 276548 136478 2026-05-20T06:24:44Z FuzzyBot 207 Updating to match new version of source page 276548 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/id 14 42210 276550 136479 2026-05-20T06:24:45Z FuzzyBot 207 Updating to match new version of source page 276550 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/pl 14 42211 276556 136480 2026-05-20T06:24:48Z FuzzyBot 207 Updating to match new version of source page 276556 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/su 14 42212 276561 136481 2026-05-20T06:24:50Z FuzzyBot 207 Updating to match new version of source page 276561 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/szl 14 42213 276563 136482 2026-05-20T06:24:51Z FuzzyBot 207 Updating to match new version of source page 276563 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Support for Wikidata content 4 42228 276486 272878 2026-05-20T06:21:31Z Ameisenigel 44 tvar 276486 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <translate> <!--T:1--> Wikifunctions provides support for retrieving and using Wikidata content, including encyclopedic content contained primarily in ''Items'' and lexicographic content contained in ''Lexemes, Lexeme forms'', and ''Lexeme senses''.</translate> <translate><!--T:165--> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. <!--T:2--> Documentation of Wikidata's lexicographic types can be found at [[<tvar name="1">:d:Special:MyLanguage/WD:Lexicographical data/Documentation</tvar>|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[<tvar name="2">mw:Special:MyLanguage/Wikibase/DataModel</tvar>|Wikibase/DataModel]]. <!--T:3--> '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. <!--T:4--> Implemented support currently includes: </translate> # <translate><!--T:5--> Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank''</translate> # <translate><!--T:141--> A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</translate> # <translate><!--T:142--> A built-in type "Claim" <sup>[ [[<tvar name="1">d:Special:MyLanguage/Wikidata:Glossary#Claim</tvar>|glossary]] ]</sup>, which corresponds to Wikidata's type <tvar name="2">{{Q|86719099}}</tvar> <sup>[ [[<tvar name="3">d:Special:MyLanguage/Wikidata:Glossary#Snak</tvar>|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</translate> # <translate><!--T:6--> Built-in ''reference types'' corresponding to the 5 entity types</translate> # <translate><!--T:7--> Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</translate> # <translate><!--T:143--> Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</translate> # <translate><!--T:8--> User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</translate> <translate> <!--T:9--> '''Terminology notes''': </translate> * <translate><!--T:10--> We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</translate> <translate><!--T:166--> When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]]).</translate> * <translate><!--T:11--> To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</translate> <translate><!--T:167--> For example, we will talk about the [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</translate> * <translate><!--T:144--> The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</translate> <translate><!--T:168--> (4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content. </translate> <translate> <!--T:12--> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. == Wikidata types == <!--T:13--> <!--T:14--> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </translate> * [[Z6005|<u><translate><!--T:15--> Wikidata lexeme</translate></u>]] * [[Z6004|<u><translate><!--T:16--> Wikidata lexeme form</translate></u>]] * [[Z6006|<u><translate><!--T:17--> Wikidata lexeme sense</translate></u>]] * [[Z6003|<u><translate><!--T:18--> Wikidata statement</translate></u>]] * [[Z6002|<u><translate><!--T:19--> Wikidata property</translate></u>]] * [[Z6001|<u><translate><!--T:20--> Wikidata item</translate></u>]] * [[Z6040|<u><translate><!--T:21--> Wikidata statement rank</translate></u>]] * [[Z6008|<u><translate><!--T:145--> Wikidata reference</translate></u>]] * <translate><!--T:146--> [[<tvar name="1">Z6007</tvar>|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</translate> * <translate><!--T:147--> [[<tvar name="1">Z6020</tvar>|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</translate> <translate> <!--T:22--> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[<tvar name="1">Z6040</tvar>|<u>Wikidata statement rank</u>]] and [[<tvar name="2">Z6020</tvar>|<u>Wikidata claim subtype</u>]]).</translate> <translate><!--T:169--> They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</translate> <translate><!--T:170--> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. <!--T:23--> [[<tvar name="1">Z6040</tvar>|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. <!--T:148--> [[<tvar name="1">Z6020</tvar>|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. <!--T:24--> Additional background, motivation, and examples of the Wikidata types may be found on the [[<tvar name="1">Wikifunctions:Type proposals/Wikidata based types</tvar>|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). === Example === <!--T:25--> <!--T:26--> An instance of [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] has these 7 parts: </translate> # <translate><!--T:27--> identity, with a value of type [[<tvar name="1">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]</translate> # <translate><!--T:28--> lemmas, with a value of type [[<tvar name="1">Z12</tvar>|Multilingual text]]</translate> # <translate><!--T:29--> language, with a value of type [[<tvar name="1">Z60</tvar>|Natural language]]</translate> # <translate><!--T:30--> lexical category, with a value of type [[<tvar name="1">Z6091</tvar>|<u>Wikidata item reference</u>]]</translate> # <translate><!--T:31--> statements, whose value is a list of [[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]]</translate> # <translate><!--T:32--> senses, whose value is a list of [[<tvar name="1">Z6006</tvar>|<u>Wikidata lexeme sense</u>]]</translate> # <translate><!--T:33--> forms, whose value is a list of [[<tvar name="1">Z6004</tvar>|<u>Wikidata lexeme form</u>]]</translate> <translate> <!--T:34--> Note, then, that each such instance contains instances of three other Wikidata types ([[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]], [[<tvar name="2">Z6006</tvar>|<u>Wikidata lexeme sense</u>]], and [[<tvar name="3">Z6004</tvar>|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section).</translate> <translate><!--T:171--> [[<tvar name="4">Z12</tvar>|Multilingual text]] and [[<tvar name="5">Z60</tvar>|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. <!--T:35--> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference.</translate> <translate><!--T:172--> For information about the content of each of the other parts, please see [[<tvar name="1">:d:Special:MyLanguage/d:Lexicographical data/Documentation</tvar>|d:Lexicographical data/Documentation]]. <!--T:36--> A specific instance, which has been fetched from [[<tvar name="1">:d:Lexeme:L3435</tvar>|L3435 on Wikidata]], is shown in the appendix. === Status of Wikidata types === <!--T:37--> <!--T:38--> All these types are defined and available for use; there are no outstanding tasks directly related to them.</translate> <translate><!--T:173--> They all have built-in equality functions.</translate> <translate><!--T:174--> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). === Notes about Wikidata statements === <!--T:122--> <!--T:41--> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses.</translate> <translate><!--T:175--> Each [[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </translate> # <translate><!--T:149--> a subject (an entity reference, discussed below)</translate> # <translate><!--T:150--> a predicate (a property reference, discussed below)</translate> # <translate><!--T:151--> a value</translate> # <translate><!--T:152--> a rank (an instance of [[<tvar name="1">Z6040</tvar>|<u>Wikidata statement rank</u>]])</translate> # <translate><!--T:153--> a list of qualifiers (each represented as a [[<tvar name="1">Z6003</tvar>|<u>Wikidata claim</u>]])</translate> # <translate><!--T:154--> a list of [[<tvar name="1">Z6008</tvar>|<u>Wikidata reference</u>]]</translate> # <translate><!--T:155--> an instance of [[<tvar name="1">Z6020</tvar>|<u>Wikidata claim subtype</u>]].</translate> <translate> <!--T:156--> The value, (3), may be of several different Wikifunctions types, including: </translate> * [[Z6|<u><translate><!--T:42--> String</translate></u>]] * [[Z11|<u><translate><!--T:47--> Monolingual text</translate></u>]] * [[Z6010|<u><translate><!--T:157--> Wikidata quantity</translate></u>]] * [[Z6011|<u><translate><!--T:158--> Wikidata geo-coordinate</translate></u>]] * [[Z6040|<u><translate><!--T:159--> Wikidata time</translate></u>]] * <translate><!--T:160--> one of the Wikidata reference types, discussed below.</translate> <translate> As noted in the introductory section, the word "reference" is overloaded. [[<tvar name="1">Z6008</tvar>|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. <!--T:123--> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) == Wikidata reference types == <!--T:50--> <!--T:51--> The following reference types provide the means to refer to Wikidata entities without including the details of their content.</translate> <translate><!--T:176--> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </translate> * [[Z6095|<u><translate><!--T:52--> Wikidata lexeme reference</translate></u>]] * [[Z6094|<u><translate><!--T:53--> Wikidata lexeme form reference</translate></u>]] * [[Z6096|<u><translate><!--T:54--> Wikidata lexeme sense reference</translate></u>]] * [[Z6092|<u><translate><!--T:55--> Wikidata property reference</translate></u>]] * [[Z6091|<u><translate><!--T:56--> Wikidata item reference</translate></u>]] <translate> <!--T:57--> '''Example''': a [[<tvar name="1">Z6091</tvar>|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following.</translate> <translate><!--T:177--> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</translate> <translate><!--T:178--> Wikifunctions’ ZObject representation is presented in <tvar name="2">{{ll|Wikifunctions:Function model}}</tvar>; we do not explain the details of the representation here. </translate> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <translate> <!--T:58--> '''Example uses''': </translate> * <translate><!--T:59--> Wikidata reference types are used with Wikidata fetch functions (see below).</translate> * <translate><!--T:60--> When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</translate> <translate><!--T:179--> For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[<tvar name="2">Z6091</tvar>|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</translate> <translate> === Status of Wikidata reference types === <!--T:61--> <!--T:62--> Ready for use. No outstanding tasks directly related to these types. == Wikidata fetch functions == <!--T:63--> <!--T:64--> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument.</translate> <translate><!--T:180--> As noted above, each such instance contains the ID of a Wikidata entity.</translate> <translate><!--T:181--> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. <!--T:65--> '''Example''': If [[<tvar name="1">Z6825</tvar>|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[<tvar name="2">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]: </translate> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <translate> <!--T:66--> it will return the instance of [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. === Status of Wikidata fetch functions === <!--T:67--> <!--T:68--> A fetch function exists for each of the entity types on Wikifunctions: </translate> * [[Z6825|<u><translate><!--T:69--> Fetch Wikidata lexeme</translate></u>]] * [[Z6824|<u><translate><!--T:71--> Fetch Wikidata lexeme form</translate></u>]] * [[Z6826|<u><translate><!--T:73--> Fetch Wikidata lexeme sense</translate></u>]] * [[Z6822|<u><translate><!--T:75--> Fetch Wikidata property</translate></u>]] * [[Z6821|<u><translate><!--T:78--> Fetch Wikidata item</translate></u>]] <translate> <!--T:81--> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched.</translate> <translate><!--T:182--> There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</translate> <translate><!--T:183--> The next section provides more information about selector components. == Wikidata search functions == <!--T:124--> <!--T:125--> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs.</translate> <translate><!--T:184--> Wikifunctions currently provides two built-in functions based on these search capabilities. === Function: [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] === <!--T:126--> </translate> * <translate><!--T:127--> Argument types: [[<tvar name="1">Z6091</tvar>|<u>Wikidata item reference</u>]], [[<tvar name="2">Z6092</tvar>|<u>Wikidata property reference</u>]], [[<tvar name="3">Z60</tvar>|<u>Natural language</u>]]</translate> * <translate><!--T:128--> Return value type: List of [[<tvar name="1">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]</translate> <translate> <!--T:129--> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </translate> * <translate><!--T:130--> [[<tvar name="1">d:Property:P5137</tvar>|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</translate> * <translate><!--T:131--> [[<tvar name="1">d:Property:P9970</tvar>|predicate for]], connecting a verb to an action or event</translate> * <translate><!--T:132--> [[<tvar name="1">d:Property:P6271</tvar>|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</translate> <translate> <!--T:133--> '''Example 1.''' The three senses of the lexeme [[<tvar name="1">d:Lexeme:L18379</tvar>|L18379/rose]] refer to the color, the flower, and the biological taxon.</translate> <translate><!--T:185--> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </translate> * <translate><!--T:134--> statement subject: [[<tvar name="1">d:Lexeme:L18379</tvar>|L18379-S1/rose sense 1]]</translate> * <translate><!--T:135--> statement property: [[<tvar name="1">d:Property:P5137</tvar>|P5137/item for this sense]]</translate> * <translate><!--T:136--> statement value: [[<tvar name="1">d:Q533047</tvar>|Q533047/rose]]</translate> <translate> <!--T:137--> [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) <!--T:138--> '''Example''' '''2''': Calling [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] with [[<tvar name="2">d:Q533047</tvar>|Q533047/rose]] (the color), [[<tvar name="3">d:Property:P5137</tvar>|P5137/item for this sense]], and [[<tvar name="4">Z1002</tvar>|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[<tvar name="5">d:Lexeme:L18379</tvar>|L18379/rose]].</translate> <translate><!--T:186--> Calling the function with [[<tvar name="6">d:Q102231</tvar>|Q102231/rose]] (the flower) or with [[<tvar name="7">d:Q34687</tvar>|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[<tvar name="8">d:Lexeme:L18379</tvar>|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. <!--T:139--> '''Example''' '''3''': Calling [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] with [[<tvar name="2">d:Q55</tvar>|Q55/Netherlands]], [[<tvar name="3">d:Property:P6271</tvar>|P6271/demonym of]], and [[<tvar name="4">Z1002</tvar>|<u>Z1002/English</u>]] returns a list containing the [[<tvar name="5">Z6095</tvar>|<u>Wikidata lexeme reference</u>]] for [[<tvar name="6">d:Lexeme:L34519</tvar>|L34519/Dutch]]. <!--T:140--> For an example in which [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in <tvar name="2">{{ll|Wikifunctions:Status updates/2025-02-26}}</tvar>. === Function: [[<tvar name="1">Z6831</tvar>|<u>Find lexemes for a Wikidata lexeme sense</u>]] === <!--T:161--> </translate> * <translate><!--T:162--> Argument types: [[<tvar name="1">Z6096</tvar>|<u>Wikidata lexeme sense reference</u>]], [[<tvar name="2">Z6092</tvar>|<u>Wikidata property reference</u>]], [[<tvar name="3">Z60</tvar>|<u>Natural language</u>]]</translate> * <translate><!--T:163--> Return value type: List of [[<tvar name="1">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]</translate> <translate> <!--T:164--> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[<tvar name="1">:d:Property:P8471</tvar>|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow).</translate> <translate><!--T:212--> [[<tvar name="2">Z6831</tvar>|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[<tvar name="1">:d:Property:P8471</tvar>|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) == User interface == <!--T:82--> === Selectors === <!--T:83--> </translate> [[File:Selecting a lexeme for "goose".png|thumb|<translate><!--T:84--> Fig. 1. Selecting a lexeme for "goose"</translate>]] <translate> <!--T:85--> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used.</translate> <translate><!--T:187--> For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</translate> <translate><!--T:188--> It shows up to 10 of the current matches, and allows the user to pick one of them.</translate> <translate><!--T:189--> It updates the matches list as more typing is done. <!--T:86--> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose".</translate> <translate><!--T:190--> At this point the user is presented with 4 matching lexemes to choose from.</translate> <translate><!--T:191--> For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in <tvar name="1">{{ll|Wikifunctions:Status updates/2024-10-17}}</tvar>.</translate> <translate><!--T:192--> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). <!--T:87--> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </translate> # <translate><!--T:88--> an instance of the appropriate Wikidata reference type, if that's all that's needed, or</translate> # <translate><!--T:89--> a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</translate> <translate> <!--T:90--> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context.</translate> <translate><!--T:193--> If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</translate> <translate><!--T:194--> In this case, no fetch is performed.</translate> <translate><!--T:195--> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. === Display elements === <!--T:91--> </translate> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<translate><!--T:92--> Fig. 2. Compact view of the lexeme form for "umbrellas"</translate>]] <translate> <!--T:93--> Wikifunctions also provides a simplified, compact view of Wikidata entities.</translate> <translate><!--T:196--> This view is displayed in read pages and when viewing the output of a function call.</translate> <translate><!--T:197--> This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</translate> <translate><!--T:198--> The word-form is linked to the Wikidata page from which the entity has been fetched. <!--T:94--> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[<tvar name="1">Z6824</tvar>|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form).</translate> <translate><!--T:199--> This is the initial appearance of the result of running a function that returns a lexeme form. </translate> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<translate><!--T:95--> Fig. 3. Expanded view of the lexeme form for "umbrellas"</translate>]] <translate> <!--T:96--> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element.</translate> <translate><!--T:200--> The expanded view allows the user to understand what kind of representation is being used for this entity.</translate> <translate><!--T:201--> The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</translate> <translate><!--T:202--> In any case, the user will be able to expand, explore and navigate through its content. <!--T:97--> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2.</translate> <translate><!--T:203--> Here we see the presentation of the entire instance of [[<tvar name="1">Z6824</tvar>|<u>Wikidata lexeme form</u>]].</translate> <translate><!--T:204--> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. === Status of UI components for Wikidata entity types === <!--T:98--> </translate> * [[Z6825|<u><translate><!--T:99--> Wikidata lexeme</translate></u>]] ** <translate><!--T:100--> Display and selector: available</translate> * [[Z6824|<u><translate><!--T:101--> Wikidata lexeme form</translate></u>]] ** <translate><!--T:102--> Display and selector: available</translate> * [[Z6826|<u><translate><!--T:103--> Wikidata lexeme sense</translate></u>]] ** <translate><!--T:104--> Display and selector: date of release not yet determined</translate> * [[Z6821|<u><translate><!--T:105--> Wikidata item</translate></u>]] ** <translate><!--T:106--> Display and selector: available</translate> * [[Z6822|<u><translate><!--T:107--> Wikidata property</translate></u>]] ** <translate><!--T:108--> Display and selector: available</translate> <translate> === Limitations of UI components for Wikidata entity types === <!--T:110--> <!--T:111--> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </translate> * <translate><!--T:112--> The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</translate> <translate><!--T:205--> There is no explicit indication of which type is being selected.</translate> ** <translate><!--T:113--> Workarounds: Usually one knows from context which type of thing is being selected.</translate> <translate><!--T:206--> In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</translate> <translate><!--T:207--> For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</translate> * <translate><!--T:114--> The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</translate> ** <translate><!--T:115--> Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</translate> <translate> <!--T:116--> '''Missing compact views'''. Because the display elements for [[<tvar name="1">Z6006</tvar>|<u>Wikidata lexeme sense</u>]] and [[<tvar name="2">Z6003</tvar>|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them.</translate> <translate><!--T:208--> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. <!--T:117--> '''Mismatch in status'''. Even though the fetch function is available for [[<tvar name="1">Z6826</tvar>|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. == Appendix: an instance of Wikidata lexeme == <!--T:118--> <!--T:119--> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section.</translate> <translate><!--T:209--> It shows a specific instance of Wikidata lexeme, which has been fetched from [[<tvar name="1">:d:Lexeme:L3435</tvar>|L3435 on Wikidata]]. <!--T:120--> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</translate> <translate><!--T:210--> Wikifunctions’ ZObject representation is presented in <tvar name="1">{{ll|Wikifunctions:Function model}}</tvar>; we do not explain the details of the representation here. <!--T:121--> The example has been shortened by omitting some content, as indicated by ellipses.</translate> <translate><!--T:211--> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </translate> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] mht9gef3eo1ehi3qs1da0dvxzxz2bbi 276487 276486 2026-05-20T06:21:39Z Ameisenigel 44 Marked this version for translation 276487 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <translate> <!--T:1--> Wikifunctions provides support for retrieving and using Wikidata content, including encyclopedic content contained primarily in ''Items'' and lexicographic content contained in ''Lexemes, Lexeme forms'', and ''Lexeme senses''.</translate> <translate><!--T:165--> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. <!--T:2--> Documentation of Wikidata's lexicographic types can be found at [[<tvar name="1">:d:Special:MyLanguage/WD:Lexicographical data/Documentation</tvar>|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[<tvar name="2">mw:Special:MyLanguage/Wikibase/DataModel</tvar>|Wikibase/DataModel]]. <!--T:3--> '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. <!--T:4--> Implemented support currently includes: </translate> # <translate><!--T:5--> Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank''</translate> # <translate><!--T:141--> A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</translate> # <translate><!--T:142--> A built-in type "Claim" <sup>[ [[<tvar name="1">d:Special:MyLanguage/Wikidata:Glossary#Claim</tvar>|glossary]] ]</sup>, which corresponds to Wikidata's type <tvar name="2">{{Q|86719099}}</tvar> <sup>[ [[<tvar name="3">d:Special:MyLanguage/Wikidata:Glossary#Snak</tvar>|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</translate> # <translate><!--T:6--> Built-in ''reference types'' corresponding to the 5 entity types</translate> # <translate><!--T:7--> Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</translate> # <translate><!--T:143--> Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</translate> # <translate><!--T:8--> User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</translate> <translate> <!--T:9--> '''Terminology notes''': </translate> * <translate><!--T:10--> We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</translate> <translate><!--T:166--> When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]]).</translate> * <translate><!--T:11--> To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</translate> <translate><!--T:167--> For example, we will talk about the [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</translate> * <translate><!--T:144--> The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</translate> <translate><!--T:168--> (4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content. </translate> <translate> <!--T:12--> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. == Wikidata types == <!--T:13--> <!--T:14--> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </translate> * [[Z6005|<u><translate><!--T:15--> Wikidata lexeme</translate></u>]] * [[Z6004|<u><translate><!--T:16--> Wikidata lexeme form</translate></u>]] * [[Z6006|<u><translate><!--T:17--> Wikidata lexeme sense</translate></u>]] * [[Z6003|<u><translate><!--T:18--> Wikidata statement</translate></u>]] * [[Z6002|<u><translate><!--T:19--> Wikidata property</translate></u>]] * [[Z6001|<u><translate><!--T:20--> Wikidata item</translate></u>]] * [[Z6040|<u><translate><!--T:21--> Wikidata statement rank</translate></u>]] * [[Z6008|<u><translate><!--T:145--> Wikidata reference</translate></u>]] * <translate><!--T:146--> [[<tvar name="1">Z6007</tvar>|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</translate> * <translate><!--T:147--> [[<tvar name="1">Z6020</tvar>|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</translate> <translate> <!--T:22--> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[<tvar name="1">Z6040</tvar>|<u>Wikidata statement rank</u>]] and [[<tvar name="2">Z6020</tvar>|<u>Wikidata claim subtype</u>]]).</translate> <translate><!--T:169--> They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</translate> <translate><!--T:170--> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. <!--T:23--> [[<tvar name="1">Z6040</tvar>|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. <!--T:148--> [[<tvar name="1">Z6020</tvar>|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. <!--T:24--> Additional background, motivation, and examples of the Wikidata types may be found on the [[<tvar name="1">Wikifunctions:Type proposals/Wikidata based types</tvar>|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). === Example === <!--T:25--> <!--T:26--> An instance of [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] has these 7 parts: </translate> # <translate><!--T:27--> identity, with a value of type [[<tvar name="1">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]</translate> # <translate><!--T:28--> lemmas, with a value of type [[<tvar name="1">Z12</tvar>|Multilingual text]]</translate> # <translate><!--T:29--> language, with a value of type [[<tvar name="1">Z60</tvar>|Natural language]]</translate> # <translate><!--T:30--> lexical category, with a value of type [[<tvar name="1">Z6091</tvar>|<u>Wikidata item reference</u>]]</translate> # <translate><!--T:31--> statements, whose value is a list of [[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]]</translate> # <translate><!--T:32--> senses, whose value is a list of [[<tvar name="1">Z6006</tvar>|<u>Wikidata lexeme sense</u>]]</translate> # <translate><!--T:33--> forms, whose value is a list of [[<tvar name="1">Z6004</tvar>|<u>Wikidata lexeme form</u>]]</translate> <translate> <!--T:34--> Note, then, that each such instance contains instances of three other Wikidata types ([[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]], [[<tvar name="2">Z6006</tvar>|<u>Wikidata lexeme sense</u>]], and [[<tvar name="3">Z6004</tvar>|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section).</translate> <translate><!--T:171--> [[<tvar name="4">Z12</tvar>|Multilingual text]] and [[<tvar name="5">Z60</tvar>|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. <!--T:35--> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference.</translate> <translate><!--T:172--> For information about the content of each of the other parts, please see [[<tvar name="1">:d:Special:MyLanguage/d:Lexicographical data/Documentation</tvar>|d:Lexicographical data/Documentation]]. <!--T:36--> A specific instance, which has been fetched from [[<tvar name="1">:d:Lexeme:L3435</tvar>|L3435 on Wikidata]], is shown in the appendix. === Status of Wikidata types === <!--T:37--> <!--T:38--> All these types are defined and available for use; there are no outstanding tasks directly related to them.</translate> <translate><!--T:173--> They all have built-in equality functions.</translate> <translate><!--T:174--> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). === Notes about Wikidata statements === <!--T:122--> <!--T:41--> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses.</translate> <translate><!--T:175--> Each [[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </translate> # <translate><!--T:149--> a subject (an entity reference, discussed below)</translate> # <translate><!--T:150--> a predicate (a property reference, discussed below)</translate> # <translate><!--T:151--> a value</translate> # <translate><!--T:152--> a rank (an instance of [[<tvar name="1">Z6040</tvar>|<u>Wikidata statement rank</u>]])</translate> # <translate><!--T:153--> a list of qualifiers (each represented as a [[<tvar name="1">Z6003</tvar>|<u>Wikidata claim</u>]])</translate> # <translate><!--T:154--> a list of [[<tvar name="1">Z6008</tvar>|<u>Wikidata reference</u>]]</translate> # <translate><!--T:155--> an instance of [[<tvar name="1">Z6020</tvar>|<u>Wikidata claim subtype</u>]].</translate> <translate> <!--T:156--> The value, (3), may be of several different Wikifunctions types, including: </translate> * [[Z6|<u><translate><!--T:42--> String</translate></u>]] * [[Z11|<u><translate><!--T:47--> Monolingual text</translate></u>]] * [[Z6010|<u><translate><!--T:157--> Wikidata quantity</translate></u>]] * [[Z6011|<u><translate><!--T:158--> Wikidata geo-coordinate</translate></u>]] * [[Z6040|<u><translate><!--T:159--> Wikidata time</translate></u>]] * <translate><!--T:160--> one of the Wikidata reference types, discussed below.</translate> <translate> <!--T:213--> As noted in the introductory section, the word "reference" is overloaded. [[<tvar name="1">Z6008</tvar>|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. <!--T:123--> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[<tvar name="1">Z6003</tvar>|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) == Wikidata reference types == <!--T:50--> <!--T:51--> The following reference types provide the means to refer to Wikidata entities without including the details of their content.</translate> <translate><!--T:176--> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </translate> * [[Z6095|<u><translate><!--T:52--> Wikidata lexeme reference</translate></u>]] * [[Z6094|<u><translate><!--T:53--> Wikidata lexeme form reference</translate></u>]] * [[Z6096|<u><translate><!--T:54--> Wikidata lexeme sense reference</translate></u>]] * [[Z6092|<u><translate><!--T:55--> Wikidata property reference</translate></u>]] * [[Z6091|<u><translate><!--T:56--> Wikidata item reference</translate></u>]] <translate> <!--T:57--> '''Example''': a [[<tvar name="1">Z6091</tvar>|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following.</translate> <translate><!--T:177--> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</translate> <translate><!--T:178--> Wikifunctions’ ZObject representation is presented in <tvar name="2">{{ll|Wikifunctions:Function model}}</tvar>; we do not explain the details of the representation here. </translate> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <translate> <!--T:58--> '''Example uses''': </translate> * <translate><!--T:59--> Wikidata reference types are used with Wikidata fetch functions (see below).</translate> * <translate><!--T:60--> When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</translate> <translate><!--T:179--> For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[<tvar name="2">Z6091</tvar>|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</translate> <translate> === Status of Wikidata reference types === <!--T:61--> <!--T:62--> Ready for use. No outstanding tasks directly related to these types. == Wikidata fetch functions == <!--T:63--> <!--T:64--> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument.</translate> <translate><!--T:180--> As noted above, each such instance contains the ID of a Wikidata entity.</translate> <translate><!--T:181--> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. <!--T:65--> '''Example''': If [[<tvar name="1">Z6825</tvar>|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[<tvar name="2">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]: </translate> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <translate> <!--T:66--> it will return the instance of [[<tvar name="1">Z6005</tvar>|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. === Status of Wikidata fetch functions === <!--T:67--> <!--T:68--> A fetch function exists for each of the entity types on Wikifunctions: </translate> * [[Z6825|<u><translate><!--T:69--> Fetch Wikidata lexeme</translate></u>]] * [[Z6824|<u><translate><!--T:71--> Fetch Wikidata lexeme form</translate></u>]] * [[Z6826|<u><translate><!--T:73--> Fetch Wikidata lexeme sense</translate></u>]] * [[Z6822|<u><translate><!--T:75--> Fetch Wikidata property</translate></u>]] * [[Z6821|<u><translate><!--T:78--> Fetch Wikidata item</translate></u>]] <translate> <!--T:81--> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched.</translate> <translate><!--T:182--> There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</translate> <translate><!--T:183--> The next section provides more information about selector components. == Wikidata search functions == <!--T:124--> <!--T:125--> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs.</translate> <translate><!--T:184--> Wikifunctions currently provides two built-in functions based on these search capabilities. === Function: [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] === <!--T:126--> </translate> * <translate><!--T:127--> Argument types: [[<tvar name="1">Z6091</tvar>|<u>Wikidata item reference</u>]], [[<tvar name="2">Z6092</tvar>|<u>Wikidata property reference</u>]], [[<tvar name="3">Z60</tvar>|<u>Natural language</u>]]</translate> * <translate><!--T:128--> Return value type: List of [[<tvar name="1">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]</translate> <translate> <!--T:129--> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </translate> * <translate><!--T:130--> [[<tvar name="1">d:Property:P5137</tvar>|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</translate> * <translate><!--T:131--> [[<tvar name="1">d:Property:P9970</tvar>|predicate for]], connecting a verb to an action or event</translate> * <translate><!--T:132--> [[<tvar name="1">d:Property:P6271</tvar>|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</translate> <translate> <!--T:133--> '''Example 1.''' The three senses of the lexeme [[<tvar name="1">d:Lexeme:L18379</tvar>|L18379/rose]] refer to the color, the flower, and the biological taxon.</translate> <translate><!--T:185--> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </translate> * <translate><!--T:134--> statement subject: [[<tvar name="1">d:Lexeme:L18379</tvar>|L18379-S1/rose sense 1]]</translate> * <translate><!--T:135--> statement property: [[<tvar name="1">d:Property:P5137</tvar>|P5137/item for this sense]]</translate> * <translate><!--T:136--> statement value: [[<tvar name="1">d:Q533047</tvar>|Q533047/rose]]</translate> <translate> <!--T:137--> [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) <!--T:138--> '''Example''' '''2''': Calling [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] with [[<tvar name="2">d:Q533047</tvar>|Q533047/rose]] (the color), [[<tvar name="3">d:Property:P5137</tvar>|P5137/item for this sense]], and [[<tvar name="4">Z1002</tvar>|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[<tvar name="5">d:Lexeme:L18379</tvar>|L18379/rose]].</translate> <translate><!--T:186--> Calling the function with [[<tvar name="6">d:Q102231</tvar>|Q102231/rose]] (the flower) or with [[<tvar name="7">d:Q34687</tvar>|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[<tvar name="8">d:Lexeme:L18379</tvar>|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. <!--T:139--> '''Example''' '''3''': Calling [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] with [[<tvar name="2">d:Q55</tvar>|Q55/Netherlands]], [[<tvar name="3">d:Property:P6271</tvar>|P6271/demonym of]], and [[<tvar name="4">Z1002</tvar>|<u>Z1002/English</u>]] returns a list containing the [[<tvar name="5">Z6095</tvar>|<u>Wikidata lexeme reference</u>]] for [[<tvar name="6">d:Lexeme:L34519</tvar>|L34519/Dutch]]. <!--T:140--> For an example in which [[<tvar name="1">Z6830</tvar>|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in <tvar name="2">{{ll|Wikifunctions:Status updates/2025-02-26}}</tvar>. === Function: [[<tvar name="1">Z6831</tvar>|<u>Find lexemes for a Wikidata lexeme sense</u>]] === <!--T:161--> </translate> * <translate><!--T:162--> Argument types: [[<tvar name="1">Z6096</tvar>|<u>Wikidata lexeme sense reference</u>]], [[<tvar name="2">Z6092</tvar>|<u>Wikidata property reference</u>]], [[<tvar name="3">Z60</tvar>|<u>Natural language</u>]]</translate> * <translate><!--T:163--> Return value type: List of [[<tvar name="1">Z6095</tvar>|<u>Wikidata lexeme reference</u>]]</translate> <translate> <!--T:164--> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[<tvar name="1">:d:Property:P8471</tvar>|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow).</translate> <translate><!--T:212--> [[<tvar name="2">Z6831</tvar>|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[<tvar name="1">:d:Property:P8471</tvar>|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) == User interface == <!--T:82--> === Selectors === <!--T:83--> </translate> [[File:Selecting a lexeme for "goose".png|thumb|<translate><!--T:84--> Fig. 1. Selecting a lexeme for "goose"</translate>]] <translate> <!--T:85--> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used.</translate> <translate><!--T:187--> For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</translate> <translate><!--T:188--> It shows up to 10 of the current matches, and allows the user to pick one of them.</translate> <translate><!--T:189--> It updates the matches list as more typing is done. <!--T:86--> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose".</translate> <translate><!--T:190--> At this point the user is presented with 4 matching lexemes to choose from.</translate> <translate><!--T:191--> For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in <tvar name="1">{{ll|Wikifunctions:Status updates/2024-10-17}}</tvar>.</translate> <translate><!--T:192--> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). <!--T:87--> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </translate> # <translate><!--T:88--> an instance of the appropriate Wikidata reference type, if that's all that's needed, or</translate> # <translate><!--T:89--> a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</translate> <translate> <!--T:90--> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context.</translate> <translate><!--T:193--> If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</translate> <translate><!--T:194--> In this case, no fetch is performed.</translate> <translate><!--T:195--> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. === Display elements === <!--T:91--> </translate> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<translate><!--T:92--> Fig. 2. Compact view of the lexeme form for "umbrellas"</translate>]] <translate> <!--T:93--> Wikifunctions also provides a simplified, compact view of Wikidata entities.</translate> <translate><!--T:196--> This view is displayed in read pages and when viewing the output of a function call.</translate> <translate><!--T:197--> This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</translate> <translate><!--T:198--> The word-form is linked to the Wikidata page from which the entity has been fetched. <!--T:94--> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[<tvar name="1">Z6824</tvar>|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form).</translate> <translate><!--T:199--> This is the initial appearance of the result of running a function that returns a lexeme form. </translate> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<translate><!--T:95--> Fig. 3. Expanded view of the lexeme form for "umbrellas"</translate>]] <translate> <!--T:96--> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element.</translate> <translate><!--T:200--> The expanded view allows the user to understand what kind of representation is being used for this entity.</translate> <translate><!--T:201--> The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</translate> <translate><!--T:202--> In any case, the user will be able to expand, explore and navigate through its content. <!--T:97--> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2.</translate> <translate><!--T:203--> Here we see the presentation of the entire instance of [[<tvar name="1">Z6824</tvar>|<u>Wikidata lexeme form</u>]].</translate> <translate><!--T:204--> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. === Status of UI components for Wikidata entity types === <!--T:98--> </translate> * [[Z6825|<u><translate><!--T:99--> Wikidata lexeme</translate></u>]] ** <translate><!--T:100--> Display and selector: available</translate> * [[Z6824|<u><translate><!--T:101--> Wikidata lexeme form</translate></u>]] ** <translate><!--T:102--> Display and selector: available</translate> * [[Z6826|<u><translate><!--T:103--> Wikidata lexeme sense</translate></u>]] ** <translate><!--T:104--> Display and selector: date of release not yet determined</translate> * [[Z6821|<u><translate><!--T:105--> Wikidata item</translate></u>]] ** <translate><!--T:106--> Display and selector: available</translate> * [[Z6822|<u><translate><!--T:107--> Wikidata property</translate></u>]] ** <translate><!--T:108--> Display and selector: available</translate> <translate> === Limitations of UI components for Wikidata entity types === <!--T:110--> <!--T:111--> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </translate> * <translate><!--T:112--> The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</translate> <translate><!--T:205--> There is no explicit indication of which type is being selected.</translate> ** <translate><!--T:113--> Workarounds: Usually one knows from context which type of thing is being selected.</translate> <translate><!--T:206--> In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</translate> <translate><!--T:207--> For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</translate> * <translate><!--T:114--> The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</translate> ** <translate><!--T:115--> Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</translate> <translate> <!--T:116--> '''Missing compact views'''. Because the display elements for [[<tvar name="1">Z6006</tvar>|<u>Wikidata lexeme sense</u>]] and [[<tvar name="2">Z6003</tvar>|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them.</translate> <translate><!--T:208--> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. <!--T:117--> '''Mismatch in status'''. Even though the fetch function is available for [[<tvar name="1">Z6826</tvar>|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. == Appendix: an instance of Wikidata lexeme == <!--T:118--> <!--T:119--> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section.</translate> <translate><!--T:209--> It shows a specific instance of Wikidata lexeme, which has been fetched from [[<tvar name="1">:d:Lexeme:L3435</tvar>|L3435 on Wikidata]]. <!--T:120--> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</translate> <translate><!--T:210--> Wikifunctions’ ZObject representation is presented in <tvar name="1">{{ll|Wikifunctions:Function model}}</tvar>; we do not explain the details of the representation here. <!--T:121--> The example has been shortened by omitting some content, as indicated by ellipses.</translate> <translate><!--T:211--> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </translate> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] idxiwab40ndflwpyb2cm24ueo3b93g0 Category:Status updates/ru 14 42365 276558 136995 2026-05-20T06:24:49Z FuzzyBot 207 Updating to match new version of source page 276558 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/es 14 42520 276545 137444 2026-05-20T06:24:43Z FuzzyBot 207 Updating to match new version of source page 276545 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/ar 14 42957 276540 138611 2026-05-20T06:24:41Z FuzzyBot 207 Updating to match new version of source page 276540 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Wikidata/lb 4 43469 276534 235358 2026-05-20T06:23:48Z FuzzyBot 207 Updating to match new version of source page 276534 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} Wikifunctions gëtt op [[:d:Wikidata:Main page|Wikidata]] duerch {{Q|Q104587954}} representéiert. Hei fannt Dir geschwë méi iwwer Wikidata a Wikifunctions! <span id="Functionality_we_will_want"></span> == Funktionalitéit, déi mir eis wënschen == <span id="Items"></span> === Elementer === * Iwwerpréiwen, ob en Element existéiert * Element kréien ** {{done}} {{Z|6821}} * Etikette kréien ** {{done}} {{Z|22853}} * Aliase kréien ** {{done}} {{Z|23080}} * Beschreiwung kréien ** {{done}} {{Z|30120}} * Ausso kréien ** {{done}} {{Z|22220}} * ''méiglecherweis'' Säitelinke kréien ** {{done}} {{Z|35207}} <span id="Statements"></span> === Aussoen === * Wäerter vun Aussoe kréien ** {{done}} {{Z|19308}} * Bewäertung kréien ** {{done}} {{Z|20206}} * Eegenschaft vun enger Ausso kréien ** {{done}} {{Z|19306}} * Qualifikatore kréien ** {{done}} {{Z|28278}} * Referenze kréien ** {{done}} {{Z|31984}} <span id="Properties"></span> === Eegenschaften === * Iwwerpréiwen, ob eng Eegenschaft existéiert * Eegenschaft kréien ** {{done}} {{Z|6822}} * Etikette kréien ** {{done}} {{Z|23223}} * Aliase kréien ** {{done}} {{Z|23227}} * Beschreiwunge kréien ** {{done}} {{Z|23225}} * Datentyp kréien * Ausso kréien ** {{done}} {{Z|23229}} <span id="Lexemes"></span> === Lexeemen === * Iwwerpréiwen, ob e Lexeem existéiert * Lexeem kréien ** {{done}} {{Z|6825}} * Lemmata kréien ** {{done}} {{Z|19293}} * Sprooch kréien ** {{done}} {{Z|19276}} * Kategorie kréien ** {{done}} {{Z|19298}} * Ausso kréien ** {{done}} {{Z|19300}} * Bedeitung kréien ** {{done}} {{Z|6826}} * Form kréien ** {{done}} {{Z|6824}} <span id="Senses"></span> ==== Bedeitungen ==== * Gloss kréien ** {{done}} {{Z|23114}} * Ausso kréien ** {{done}} {{Z|23116}} <span id="Forms"></span> ==== Formen ==== * Representéierung kréien ** {{done}} {{Z|22399}} * Grammatesch Eegenschafte kréien ** {{done}} {{Z|22487}} * Ausso kréien ** {{done}} {{Z|23118}} <span id="Entity_schemas"></span> === Entitéitsscheemaen === * Iwwerpréiwen, ob en Entitéitsscheema existéiert * Entitéitsscheema kréien * Etikette kréien * Aliase kréien * Beschreiwunge kréien [[Category:Project{{#translation:}}]] [[Category:Wikidata]] 0x15yfrmbaisuo6p39l3o9v6aebojh0 Wikifunctions:Tools 4 45165 276501 273261 2026-05-20T06:22:46Z Ameisenigel 44 tvar 276501 wikitext text/x-wiki <languages/> <translate> <!--T:1--> This page is a list of tools you can use to work with Wikifunctions more quickly and comfortably. If you have written a script, feel free to add it so that others can use it. == Dump related tools == <!--T:6--> </translate> * <translate><!--T:7--> [<tvar name="1">https://github.com/marius851000/wikifunction_intepreter</tvar> experimental Wikifunction Rust interpreter] that work on the dump. Written in Rust.</translate> * <translate><!--T:8--> [[<tvar name="1">Wikifunctions:Tools/wf-dump-scripts</tvar>|wf-dump-scripts]] - pipeline for creating statistical wikitables based on dump and the internal Wikifunctions API. Written in [[w:Python (programming language)|Python]]</translate> * <translate><!--T:2--> [<tvar name="1">//wf-query.replit.app</tvar> wf-query]: tool that allows you to run JSONata queries on a dump of Wikifunctions, with the table output itself also being customizable with JSONata queries. Written in [[w:Node.js|NodeJS]] Express and [[w:JavaScript|vanilla JS]]</translate> * <translate><!--T:4--> [<tvar name="1">//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl</tvar> Dumpextract]: a program to extract info from the dump of Wikifunctions. Written in [[w:COBOL|COBOL]].</translate> * <translate><!--T:12--> [<tvar name="1">https://github.com/99of9/WikifunctionsAnalysis</tvar> WikifunctionsAnalysis]: some code which helps analyse Wikifunctions dumps</translate> * <translate>[[<tvar name="1">User:Amire80/wikifunctionsanalytics#Example_queries</tvar>|wikifunctionsanalytics]]: A simplified dump, queryable through [[<tvar name="2">meta:Special:MyLanguage/Research:Quarry</tvar>|Quarry]].</translate> * <translate>[[<tvar name="1">toolforge:abstract-data/functions</tvar>]]: Tracking Function usage on [[<tvar name="2">abstract:</tvar>|Abstract Wikipedia]].</translate> <translate> == User interface == <!--T:9--> </translate> *<translate><!--T:5--> [[<tvar name="1">User:Feeglgeef/wikilambda editsource.js</tvar>|wikilambda editsource.js]]: User script that allows you to edit the raw JSON content of ZObjects.</translate> * <translate><!--T:10--> [<tvar name="1">https://yoshirulz.gitlab.io/WikiLambdaBlockly</tvar> WikiLambdaBlockly]: Web app demonstrating a block-based editing interface for compositions. Uses [[w:Blockly|Blockly]] from [[w:TypeScript|TS]].</translate> <translate> == Others == <!--T:11--> </translate> * <translate><!--T:3--> [<tvar name="1">//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3</tvar> find constants]: tool that represents a f64 using Wikifunctions representation. Prints, comma separated, the sign of the float (-1, 0, 1), the exponent of the float, and the fraction of the float. Written in [[w:Rust (programming language)|Rust]].</translate> [[Category:Project{{#translation:}}]] 2475xnheavisttp2e9h7alc42eql79v 276502 276501 2026-05-20T06:22:54Z Ameisenigel 44 Marked this version for translation 276502 wikitext text/x-wiki <languages/> <translate> <!--T:1--> This page is a list of tools you can use to work with Wikifunctions more quickly and comfortably. If you have written a script, feel free to add it so that others can use it. == Dump related tools == <!--T:6--> </translate> * <translate><!--T:7--> [<tvar name="1">https://github.com/marius851000/wikifunction_intepreter</tvar> experimental Wikifunction Rust interpreter] that work on the dump. Written in Rust.</translate> * <translate><!--T:8--> [[<tvar name="1">Wikifunctions:Tools/wf-dump-scripts</tvar>|wf-dump-scripts]] - pipeline for creating statistical wikitables based on dump and the internal Wikifunctions API. Written in [[w:Python (programming language)|Python]]</translate> * <translate><!--T:2--> [<tvar name="1">//wf-query.replit.app</tvar> wf-query]: tool that allows you to run JSONata queries on a dump of Wikifunctions, with the table output itself also being customizable with JSONata queries. Written in [[w:Node.js|NodeJS]] Express and [[w:JavaScript|vanilla JS]]</translate> * <translate><!--T:4--> [<tvar name="1">//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl</tvar> Dumpextract]: a program to extract info from the dump of Wikifunctions. Written in [[w:COBOL|COBOL]].</translate> * <translate><!--T:12--> [<tvar name="1">https://github.com/99of9/WikifunctionsAnalysis</tvar> WikifunctionsAnalysis]: some code which helps analyse Wikifunctions dumps</translate> * <translate><!--T:13--> [[<tvar name="1">User:Amire80/wikifunctionsanalytics#Example_queries</tvar>|wikifunctionsanalytics]]: A simplified dump, queryable through [[<tvar name="2">meta:Special:MyLanguage/Research:Quarry</tvar>|Quarry]].</translate> * <translate><!--T:14--> [[<tvar name="1">toolforge:abstract-data/functions</tvar>]]: Tracking Function usage on [[<tvar name="2">abstract:</tvar>|Abstract Wikipedia]].</translate> <translate> == User interface == <!--T:9--> </translate> *<translate><!--T:5--> [[<tvar name="1">User:Feeglgeef/wikilambda editsource.js</tvar>|wikilambda editsource.js]]: User script that allows you to edit the raw JSON content of ZObjects.</translate> * <translate><!--T:10--> [<tvar name="1">https://yoshirulz.gitlab.io/WikiLambdaBlockly</tvar> WikiLambdaBlockly]: Web app demonstrating a block-based editing interface for compositions. Uses [[w:Blockly|Blockly]] from [[w:TypeScript|TS]].</translate> <translate> == Others == <!--T:11--> </translate> * <translate><!--T:3--> [<tvar name="1">//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3</tvar> find constants]: tool that represents a f64 using Wikifunctions representation. Prints, comma separated, the sign of the float (-1, 0, 1), the exponent of the float, and the fraction of the float. Written in [[w:Rust (programming language)|Rust]].</translate> [[Category:Project{{#translation:}}]] e7qo4mccyhs2p2zoapof2we79ungr5c Wikifunctions:Tools/en 4 45961 276505 239973 2026-05-20T06:22:56Z FuzzyBot 207 Updating to match new version of source page 276505 wikitext text/x-wiki <languages/> This page is a list of tools you can use to work with Wikifunctions more quickly and comfortably. If you have written a script, feel free to add it so that others can use it. == Dump related tools == * [https://github.com/marius851000/wikifunction_intepreter experimental Wikifunction Rust interpreter] that work on the dump. Written in Rust. * [[Wikifunctions:Tools/wf-dump-scripts|wf-dump-scripts]] - pipeline for creating statistical wikitables based on dump and the internal Wikifunctions API. Written in [[w:Python (programming language)|Python]] * [//wf-query.replit.app wf-query]: tool that allows you to run JSONata queries on a dump of Wikifunctions, with the table output itself also being customizable with JSONata queries. Written in [[w:Node.js|NodeJS]] Express and [[w:JavaScript|vanilla JS]] * [//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl Dumpextract]: a program to extract info from the dump of Wikifunctions. Written in [[w:COBOL|COBOL]]. * [https://github.com/99of9/WikifunctionsAnalysis WikifunctionsAnalysis]: some code which helps analyse Wikifunctions dumps * [[User:Amire80/wikifunctionsanalytics#Example_queries|wikifunctionsanalytics]]: A simplified dump, queryable through [[meta:Special:MyLanguage/Research:Quarry|Quarry]]. * [[toolforge:abstract-data/functions]]: Tracking Function usage on [[abstract:|Abstract Wikipedia]]. == User interface == *[[User:Feeglgeef/wikilambda editsource.js|wikilambda editsource.js]]: User script that allows you to edit the raw JSON content of ZObjects. * [https://yoshirulz.gitlab.io/WikiLambdaBlockly WikiLambdaBlockly]: Web app demonstrating a block-based editing interface for compositions. Uses [[w:Blockly|Blockly]] from [[w:TypeScript|TS]]. == Others == * [//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3 find constants]: tool that represents a f64 using Wikifunctions representation. Prints, comma separated, the sign of the float (-1, 0, 1), the exponent of the float, and the fraction of the float. Written in [[w:Rust (programming language)|Rust]]. [[Category:Project{{#translation:}}]] j00sn1mnmizxj6ucn16zcibkzr71qcy Wikifunctions:Support for Wikidata content/en 4 46308 276493 262461 2026-05-20T06:21:48Z FuzzyBot 207 Updating to match new version of source page 276493 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} Wikifunctions provides support for retrieving and using Wikidata content, including encyclopedic content contained primarily in ''Items'' and lexicographic content contained in ''Lexemes, Lexeme forms'', and ''Lexeme senses''. Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. Documentation of Wikidata's lexicographic types can be found at [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]]. '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. Implemented support currently includes: # Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank'' # A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type # A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements # Built-in ''reference types'' corresponding to the 5 entity types # Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types # Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities # User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content. '''Terminology notes''': * We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''. When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]). * To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''. For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata. * The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2). (4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content. This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. == Wikidata types == The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: * [[Z6005|<u>Wikidata lexeme</u>]] * [[Z6004|<u>Wikidata lexeme form</u>]] * [[Z6006|<u>Wikidata lexeme sense</u>]] * [[Z6003|<u>Wikidata statement</u>]] * [[Z6002|<u>Wikidata property</u>]] * [[Z6001|<u>Wikidata item</u>]] * [[Z6040|<u>Wikidata statement rank</u>]] * [[Z6008|<u>Wikidata reference</u>]] * [[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type * [[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata Instances of these types are never made persistent on Wikifunctions (except for the instances of [[Z6040|<u>Wikidata statement rank</u>]] and [[Z6020|<u>Wikidata claim subtype</u>]]). They are constructed on the fly, when needed, using content retrieved directly from Wikidata. Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). === Example === An instance of [[Z6005|<u>Wikidata lexeme</u>]] has these 7 parts: # identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]] # lemmas, with a value of type [[Z12|Multilingual text]] # language, with a value of type [[Z60|Natural language]] # lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]] # statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]] # senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]] # forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]] Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. === Status of Wikidata types === All these types are defined and available for use; there are no outstanding tasks directly related to them. They all have built-in equality functions. Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). === Notes about Wikidata statements === Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: # a subject (an entity reference, discussed below) # a predicate (a property reference, discussed below) # a value # a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]]) # a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]]) # a list of [[Z6008|<u>Wikidata reference</u>]] # an instance of [[Z6020|<u>Wikidata claim subtype</u>]]. The value, (3), may be of several different Wikifunctions types, including: * [[Z6|<u>String</u>]] * [[Z11|<u>Monolingual text</u>]] * [[Z6010|<u>Wikidata quantity</u>]] * [[Z6011|<u>Wikidata geo-coordinate</u>]] * [[Z6040|<u>Wikidata time</u>]] * one of the Wikidata reference types, discussed below. As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) == Wikidata reference types == The following reference types provide the means to refer to Wikidata entities without including the details of their content. Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. * [[Z6095|<u>Wikidata lexeme reference</u>]] * [[Z6094|<u>Wikidata lexeme form reference</u>]] * [[Z6096|<u>Wikidata lexeme sense reference</u>]] * [[Z6092|<u>Wikidata property reference</u>]] * [[Z6091|<u>Wikidata item reference</u>]] '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} '''Example uses''': * Wikidata reference types are used with Wikidata fetch functions (see below). * When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types. For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''. === Status of Wikidata reference types === Ready for use. No outstanding tasks directly related to these types. == Wikidata fetch functions == A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. As noted above, each such instance contains the ID of a Wikidata entity. Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. === Status of Wikidata fetch functions === A fetch function exists for each of the entity types on Wikifunctions: * [[Z6825|<u>Fetch Wikidata lexeme</u>]] * [[Z6824|<u>Fetch Wikidata lexeme form</u>]] * [[Z6826|<u>Fetch Wikidata lexeme sense</u>]] * [[Z6822|<u>Fetch Wikidata property</u>]] * [[Z6821|<u>Fetch Wikidata item</u>]] To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions). The next section provides more information about selector components. == Wikidata search functions == In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. Wikifunctions currently provides two built-in functions based on these search capabilities. === Function: [[Z6830|<u>Find lexemes for an item</u>]] === * Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]] * Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]] Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: * [[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata * [[d:Property:P9970|predicate for]], connecting a verb to an action or event * [[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place. '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): * statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]] * statement property: [[d:Property:P5137|P5137/item for this sense]] * statement value: [[d:Q533047|Q533047/rose]] [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === * Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]] * Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]] Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) == User interface == === Selectors === [[File:Selecting a lexeme for "goose".png|thumb|Fig. 1. Selecting a lexeme for "goose"]] Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.) It shows up to 10 of the current matches, and allows the user to pick one of them. It updates the matches list as more typing is done. '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". At this point the user is presented with 4 matching lexemes to choose from. For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}. Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: # an instance of the appropriate Wikidata reference type, if that's all that's needed, or # a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call. Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1). In this case, no fetch is performed. If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. === Display elements === [[File:Compact view of lexeme form for "umbrellas".png|thumb|Fig. 2. Compact view of the lexeme form for "umbrellas"]] Wikifunctions also provides a simplified, compact view of Wikidata entities. This view is displayed in read pages and when viewing the output of a function call. This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available. The word-form is linked to the Wikidata page from which the entity has been fetched. '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). This is the initial appearance of the result of running a function that returns a lexeme form. [[File:Expanded view of lexeme form for "umbrellas".png|thumb|Fig. 3. Expanded view of the lexeme form for "umbrellas"]] If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. The expanded view allows the user to understand what kind of representation is being used for this entity. The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call. In any case, the user will be able to expand, explore and navigate through its content. '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]]. Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. === Status of UI components for Wikidata entity types === * [[Z6825|<u>Wikidata lexeme</u>]] ** Display and selector: available * [[Z6824|<u>Wikidata lexeme form</u>]] ** Display and selector: available * [[Z6826|<u>Wikidata lexeme sense</u>]] ** Display and selector: date of release not yet determined * [[Z6821|<u>Wikidata item</u>]] ** Display and selector: available * [[Z6822|<u>Wikidata property</u>]] ** Display and selector: available === Limitations of UI components for Wikidata entity types === '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: * The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1. There is no explicit indication of which type is being selected. ** Workarounds: Usually one knows from context which type of thing is being selected. In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected. For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme. * The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.) ** Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3. '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. == Appendix: an instance of Wikidata lexeme == This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. The example has been shortened by omitting some content, as indicated by ellipses. For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] daf8lb42q29fyizkkzkpwrgfkp3pk2v Category:Status updates/pt-br 14 46353 276557 150189 2026-05-20T06:24:48Z FuzzyBot 207 Updating to match new version of source page 276557 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Tools/de 4 46377 276507 239972 2026-05-20T06:22:56Z FuzzyBot 207 Updating to match new version of source page 276507 wikitext text/x-wiki <languages/> Diese Seite ist eine Liste der Werkzeuge, die du benutzen kannst, um schneller und einfacher auf Wikifunctions zu arbeiten. Wenn du ein Skript geschrieben hast, füge es einfach an die Liste an, damit andere es nutzen können. <span id="Dump_related_tools"></span> == Werkzeuge für Dumps == * [https://github.com/marius851000/wikifunction_intepreter Experimenteller Wikifunctions Rust-Interpreter], der mit dem Dump arbeitet. Geschrieben in Rust. * [[Wikifunctions:Tools/wf-dump-scripts|wf-dump-scripts]]: Pipeline zur Erstellung statistischer Wikitabellen basierend auf Dumps und der internen Wikifunctions-API. Geschrieben in [[:de:Python (Programmiersprache)|Python]]. * [//wf-query.replit.app wf-query]: Werkzeug, mit dem du JSONata-Abfragen auf einem Dump von Wikifunctions ausführen kannst, wobei die Tabellenausgabe selbst auch mit JSONata-Abfragen anpassbar ist. Geschrieben in [[:de:Node.js|NodeJS]] Express und [[:de:JavaScript|Vanilla JS]] * [//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl Dumpextract]: Ein Programm zum Extrahieren von Informationen aus dem Dump von Wikifunctions. Geschrieben in [[:de:COBOL|COBOL]]. * [https://github.com/99of9/WikifunctionsAnalysis WikifunctionsAnalysis]: Code, der bei der Analyse von Wikifunctions-Dumps hilft * <span lang="en" dir="ltr" class="mw-content-ltr">[[User:Amire80/wikifunctionsanalytics#Example_queries|wikifunctionsanalytics]]: A simplified dump, queryable through [[meta:Special:MyLanguage/Research:Quarry|Quarry]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[toolforge:abstract-data/functions]]: Tracking Function usage on [[abstract:|Abstract Wikipedia]].</span> <span id="User_interface"></span> == Benutzeroberfläche == *[[User:Feeglgeef/wikilambda editsource.js|wikilambda editsource.js]]: Benutzerskript, mit dem du den rohen JSON-Inhalt von ZObjekten bearbeiten kannst. * [https://yoshirulz.gitlab.io/WikiLambdaBlockly WikiLambdaBlockly]: Webanwendung, die eine blockbasierte Bearbeitungsoberfläche für Kompositionen demonstriert. Verwendet [[:de:Blockly|Blockly]] aus [[:de:TypeScript|TS]]. <span id="Others"></span> == Weitere == * [//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3 find constants]: Werkzeug, das eine f64 mithilfe der Wikifunctions-Darstellung darstellt. Gibt kommagetrennt das Vorzeichen der Gleitkommazahl (-1, 0, 1), den Exponenten der Gleitkommazahl und den Bruchteil der Gleitkommazahl aus. Geschrieben in [[:de:Rust (Programmiersprache)|Rust]]. [[Category:Project{{#translation:}}]] 75bnrb82xmu9vxl4h3wlcsw6xfx3zo5 Wikifunctions:Support for Wikidata content/de 4 46414 276491 262507 2026-05-20T06:21:45Z FuzzyBot 207 Updating to match new version of source page 276491 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} Wikifunctions bietet Unterstützung für das Abrufen und Verwenden von Wikidata-Inhalten, darunter enzyklopädische Inhalte, die hauptsächlich in ''Datenobjekten'' enthalten sind, und lexikografische Inhalte, die in ''Lexemen'', ''Lexemformen'' und ''Lexemsinnen'' enthalten sind. Da Instanzen dieser vier Inhaltstypen ''Aussagen'' enthalten können, umfasst Wikifunctions auch Unterstützung für ''Aussagen'' und ihre Komponenten, einschließlich ''Eigenschaften'', ''Aussagerängen'', ''Qualifikatoren'' und (demnächst) ''Fundstellen''. Die Dokumentation der lexikographischen Typen von Wikidata findet sich in der [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|Dokumentation lexikographische Daten]] und die Dokumentation der anderen Wikidata-Typen findet sich unter [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/Datenmodell]]. '''Hinweis zur Terminologie''': Auf Wikidata sind ''Datenobjekt, Eigenschaft, Lexem, Lexemform'' und ''Lexemsinn'' alles Typen von ''Entitäten'', deshalb bezeichnen wir diese als ''Entitätstypen''. Zurzeit implementierte Unterstützung umfasst: # Integrierte Typen entsprechend den 5 Entitätstypen, ''Aussage'' und ''Aussagerang'' # Ein integrierter Typ "Referenz", der dem Wikidata-Typ ''ReferenceRecord'' entspricht # Ein integrierter Typ "Behauptung" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|Glossar]] ]</sup>, der dem Wikidata-Typ {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|Glossar]] ]</sup> entspricht und in der Darstellung von Qualifikatoren und Fundstellen innerhalb von Aussagen aus Wikifunctions verwendet wird # Integrierte ''Referenztypen'' entsprechend den 5 Entitätstypen # Integrierte ''Funktionen zum Erhalten'' für jeden Entitätstyp, die Inhalte aus Wikidata abrufen und in Instanzen der integrierten Typen umwandeln # Integrierte ''Suchfunktionen'', die Methoden zum Auffinden von Lexemen anhand ihrer Beziehungen zu anderen Entitäten bereitstellen # Benutzeroberflächenkomponenten zum Auswählen des zu erhaltenden Wikidata-Inhalts und zum Anzeigen des erhaltenen Inhalts. '''Hinweise zur Terminologie''': * Wir bezeichnen die integrierten Typen von (1) -- (3) als “Wikidata-Typen” und die integrierten Typen von (4) als “Wikidata-Referenz-Typen”. Beachte jedoch, dass es sich dabei um Typen '''auf Wikifunctions''' handelt, die zum Arbeiten mit Inhalten '''aus Wikidata''' verwendet werden. Wenn wir einen dieser Typen unten erwähnen, wird er unterstrichen und es wird auch ein Link sein, wenn er derzeit auf Wikifunctions definiert ist (z. B. [[Z6005|<u>Wikidata-Lexem</u>]]). * Wenn wir einen Typ ''in Kursivschrift'' erwähnen (wie etwa ''Lexem'' oder ''Datenobjekt''), sprechen wir von einem Typ, der '''auf Wikidata''' existiert. Beispielsweise sprechen wir über den Typ [[Z6005|<u>Wikidata-Lexem</u>]], der auf Wikifunctions erstellt wurde und dem Typ ''Lexem'' auf Wikidata entspricht. * Die in (4) genannten ''Referenztypen'' stehen in keinem Zusammenhang mit dem in (2) genannten Typ "Referenz". (4) bietet eine Möglichkeit, auf Wikidata-Entitäten anhand ihrer Identifikatoren zu verweisen, während (2) die Quellen erfasst, die bestimmte Inhalte belegen. Auf dieser Seite werden die oben genannten Bereiche der Unterstützung beschrieben. Alles, was hier beschrieben wird, ist bereitgestellt und verfügbar, mit Ausnahme der an einigen Stellen angegebenen Ausnahmen. <span id="Wikidata_types"></span> == Wikidata-Typen == Die folgenden Typen, deren Struktur weitgehend der Struktur der entsprechenden Typen auf Wikidata entspricht, wurden definiert: * [[Z6005|<u>Wikidata-Lexem</u>]] * [[Z6004|<u>Wikidata-Lexemform</u>]] * [[Z6006|<u>Wikidata-Lexemsinn</u>]] * [[Z6003|<u>Wikidata-Aussage</u>]] * [[Z6002|<u>Wikidata-Eigenschaft</u>]] * [[Z6001|<u>Wikidata-Datenobjekt</u>]] * [[Z6040|<u>Rang der Wikidata-Aussage</u>]] * [[Z6008|<u>Wikidata-Referenz</u>]] * [[Z6007|<u>Wikidata-Behauptung</u>]], die dem ''Snak''-Typ von Wikidata entspricht * [[Z6020|<u>Untertyp der Wikidata-Behauptung</u>]], was die 3 Typen von Snaks auf Wikidata abbildet Instanzen dieser Typen werden auf Wikifunctions niemals dauerhaft gespeichert (mit Ausnahme der Instanzen von [[Z6040|<u>Rang der Wikidata-Aussage</u>]] und [[Z6020|<u>Untertyp der Wikidata-Behauptung</u>]]). Sie werden bei Bedarf kurzfristig und mit direkt aus Wikidata abgerufenen Inhalten erstellt. Instanzen der Entitätstypen tragen die Kennung der Wikidata-Entität in sich, aus der sie abgerufen wurden. [[Z6040|<u>Rang der Wikidata-Aussage</u>]] ist ein Aufzählungstyp, der nur die drei festen Instanzen <u>bevorzugt</u>, <u>normal</u> und <u>missbilligt</u> hat. [[Z6020|<u>Untertyp der Wikidata-Behauptung</u>]] ist ein Aufzählungstyp, der nur die drei festen Instanzen <u>Wert</u>, <u>unbekannter Wert</u> und <u>kein Wert</u> hat. Weitere Hintergründe, Motivationen und Beispiele zu den Wikidata-Typen finden sich auf der [[Wikifunctions:Type proposals/Wikidata based types|Diskussionsseite zum Typenvorschlag]] (bitte beachte jedoch, dass die Seite nicht mehr aktiv ist und nicht unbedingt in allen Details auf dem neuesten Stand ist). <span id="Example"></span> === Beispiel === Eine Instanz von [[Z6005|<u>Wikidata-Lexem</u>]] besteht aus den folgenden 7 Teilen: # Identität, mit einem Wert vom Typ [[Z6095|<u>Wikidata-Lexem-Referenz</u>]] # Lemmata, mit einem Wert vom Typ [[Z12|Mehrsprachiger Text]] # Sprache, mit einem Wert vom Typ [[Z60|Natürliche Sprache]] # lexikalische Kategorie, mit einem Wert vom Typ [[Z6091|<u>Wikidata-Datenobjekt-Referenz</u>]] # Aussagen, deren Wert eine Liste von [[Z6003|<u>Wikidata-Aussagen</u>]] ist # Sinne, deren Wert eine Liste von [[Z6006|<u>Wikidata-Lexemsinnen</u>]] ist. # Formen, deren Wert eine Liste von [[Z6004|<u>Wikidata-Lexemformen</u>]] ist. Beachte, dass jede solche Instanz Instanzen von drei anderen Wikidata-Typen ([[Z6003|<u>Wikidata-Aussage</u>]], [[Z6006|<u>Wikidata-Lexemsinn</u>]] und [[Z6004|<u>Wikidata-Lexemform</u>]]) sowie zwei Wikidata-Referenztypen (die im nächsten Abschnitt besprochen werden) enthält. [[Z12|Mehrsprachiger Text]] und [[Z60|Natürliche Sprache]] sind Mehrzwecktypen von Wikifunctions, die nicht speziell für die Handhabung von Wikidata-Inhalten erstellt wurden. Der Identitätsteil speichert den mit dem Lexem verknüpften Wikidata-Identifikator und dient als Selbstreferenz. Für Informationen zum Inhalt der anderen Teile siehe bitte [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|Wikidata:Lexikographische Daten/Dokumentation]]. Eine konkrete Instanz, die aus [[:d:Lexeme:L3435|L3435 auf Wikidata]] abgerufen wurde, ist im Anhang zu sehen. <span id="Status_of_Wikidata_types"></span> === Status von Wikidata-Typen === Alle diese Typen sind definiert und zur Verwendung verfügbar; es gibt keine ausstehenden Aufgaben, die direkt mit ihnen in Zusammenhang stehen. Sie alle haben integrierte Gleichheitsfunktionen. Jeder der fünf Entitätstypen hat eine integrierte Abruffunktion, wie unten beschrieben, mit der seine Instanzen direkt abgerufen werden können (von Wikidata abgerufen und auf Wikifunctions instanziiert). <span id="Notes_about_Wikidata_statements"></span> === Anmerkungen zu Wikidata-Aussagen === Aussagen erscheinen innerhalb von Wikidata-Datenobjekten, Eigenschaften, Lexemen, Lexemformen und Lexemsinnen. Jede aus Wikidata importierte [[Z6003|<u>Wikidata-Aussage</u>]] enthält sieben Teile: # ein Subjekt (eine Entitätsreferenz, siehe unten) # ein Prädikat (eine Eigenschaftsreferenz, siehe unten) # ein Wert # ein Rang (eine Instanz von [[Z6040|<u>Rang der Wikidata-Aussage</u>]]) # eine Liste von Qualifikatoren (jeder wird als [[Z6003|<u>Wikidata-Behauptung</u>]] dargestellt) # eine Liste von [[Z6008|<u>Wikidata-Referenzen</u>]] # eine Instanz von [[Z6020|<u>Untertyp der Wikidata-Behauptung</u>]]. Der Wert, (3), kann einer von mehreren verschiedenen Wikifunctions-Typen sein, darunter: * [[Z6|<u>Zeichenkette</u>]] * [[Z11|<u>Einsprachiger Text</u>]] * [[Z6010|<u>Wikidata-Menge</u>]] * [[Z6011|<u>Wikidata-Geokoordinaten</u>]] * [[Z6040|<u>Wikidata-Zeit</u>]] * einer der Wikidata-Referenztypen, siehe unten. <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> Da ''Aussagen'' in Wikidata keine öffentlichen Identifikatoren haben, hat [[Z6003|<u>Wikidata-Aussage</u>]] in Wikifunctions weder einen Referenztyp noch eine Abruffunktion. (Diese werden weiter unten ausführlicher beschrieben.) <span id="Wikidata_reference_types"></span> == Wikidata-Referenztypen == Die folgenden Referenztypen bieten die Möglichkeit, auf Wikidata-Entitäten zu verweisen, ohne die Details ihres Inhalts anzugeben. Instanzen dieser Referenztypen enthalten ''nur'' die Wikidata-ID einer Entität als Z6/Zeichenkette. * [[Z6095|<u>Wikidata-Lexem-Referenz</u>]] * [[Z6094|<u>Wikidata-Lexemform-Referenz</u>]] * [[Z6096|<u>Wikidata-Lexemsinn-Referenz</u>]] * [[Z6092|<u>Wikidata-Eigenschaft-Referenz</u>]] * [[Z6091|<u>Wikidata-Datenobjekt-Referenz</u>]] '''Beispiel''': Eine [[Z6091|<u>Wikidata-Datenobjekt-Referenz</u>]] zum Datenobjekt ''Q1084'' (das auf Wikidata das Konzept ''Substantiv'' darstellt) sieht folgendermaßen aus. Die rechte Spalte zeigt die formale ZObjekt-Darstellung (in kanonischer Form); die linke Spalte zeigt der besseren Lesbarkeit halber denselben Inhalt mit englischen Bezeichnungen für jedes der Elemente des ZObjekts. Die ZObjekt-Darstellung von Wikifunctions wird in {{ll|Wikifunctions:Function model}} dargestellt; wir erklären die Details der Darstellung hier nicht. {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} '''Anwendungsbeispiele''': * Wikidata-Referenztypen werden mit Wikidata-Abruffunktionen verwendet (siehe unten). * Wenn Entitäts-IDs und ''Eigenschaft''-IDs in Wikidata-Lexemen, Wikidata-Lexemformen, Wikidata-Lexemsinnen oder Wikidata-Aussagen erscheinen, erscheinen sie als Instanzen der entsprechenden Wikidata-Referenztypen. Um beispielsweise anzugeben, dass ''Lexem L3435'' (“umbrella”) die lexikalische Kategorie ''Substantiv'' (mit der Entitäts-ID ''Q1084'') hat, enthält das [[Z6005|<u>Wikidata-Lexem</u>]] für ''L3435'' die oben gezeigte [[Z6091|<u>Wikidata-Datenobjekt-Referenz</u>]] in dem '''Beispiel'''. <span id="Status_of_Wikidata_reference_types"></span> === Status von Wikidata-Referenztypen === Bereit zur Verwendung. Keine ausstehenden Aufgaben, die direkt mit diesen Typen zusammenhängen. <span id="Wikidata_fetch_functions"></span> == Wikidata-Abruffunktionen == Eine Abruffunktion ist eine integrierte Wikifunctions-Funktion, die eine Instanz eines der Wikidata-Referenztypen als Eingabeargument verwendet. Wie oben erwähnt, enthält jede dieser Instanzen die ID einer Wikidata-Entität. Daraufhin ruft sie den Inhalt dieser Entität aus Wikidata ab und wandelt ihn in eine Instanz des entsprechenden Wikidata-Typs um. '''Beispiel''': Wenn [[Z6825|<u>erhalte Wikidata-Lexem</u>]] mit dieser Instanz von [[Z6095|<u>Wikidata-Lexem-Referenz</u>]] aufgerufen wird: {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} Es wird die Instanz des [[Z6005|<u>Wikidata-Lexems</u>]] zurückgegeben, die im Unterabschnitt ''Beispiel'' des Abschnitts ''Wikidata-Typen'' oben eingeführt und im Anhang ausführlicher gezeigt wird. <span id="Status_of_Wikidata_fetch_functions"></span> === Status von Wikidata-Abruffunktionen === Für jeden der Entitätstypen auf Wikifunctions ist eine Abruffunktion vorhanden: * [[Z6825|<u>erhalte Wikidata-Lexem</u>]] * [[Z6824|<u>erhalte Wikidata-Lexemform</u>]] * [[Z6826|<u>erhalte Wikidata-Lexemsinn</u>]] * [[Z6822|<u>erhalte Wikidata-Eigenschaft</u>]] * [[Z6821|<u>erhalte Wikidata-Datenobjekt</u>]] Um den Aufruf der Abruffunktionen über die Benutzeroberfläche zu ermöglichen, stellt Wikifunctions Auswahlkomponenten bereit, mit denen eine abzurufende Entität ausgewählt werden kann. Es wird schließlich für jeden Entitätstyp (und damit für jede Abruffunktion) einen Selektor geben. Der nächste Abschnitt enthält weitere Informationen zu Auswahlkomponenten. <span id="Wikidata_search_functions"></span> == Wikidata-Suchfunktionen == Neben dem Abrufen von Inhalten aus Wikidata ist es auch möglich, Wikidata-Inhalte mithilfe der APIs auf verschiedene Weise zu durchsuchen. Wikifunctions bietet derzeit zwei eingebaute Funktionen basierend auf diesen Suchmöglichkeiten. <span id="Function:_Find_lexemes_for_an_item"></span> === Funktion: [[Z6830|<u>Finde Lexeme für Wikidata-Datenobjekt</u>]] === * Argumenttypen: [[Z6091|<u>Wikidata-Datenobjekt-Referenz</u>]], [[Z6092|<u>Wikidata-Eigenschaft-Referenz</u>]], [[Z60|<u>Natürliche Sprache</u>]] * Rückgabewerttyp: Liste von [[Z6095|<u>Wikidata-Lexem-Referenz</u>]] Wikidata erfasst nützliche Beziehungen zwischen Lexemsinnen (die die Bedeutungen eines Lexems darstellen) und Datenobjekten. Dazu gehören: * [[d:Property:P5137|Objekt für diesen Sinn]], was meistens ein Nomen mit einem Ding oder einer Klasse von Dingen in Wikidata verbindet * [[d:Property:P9970|Prädikat für]], was ein Verb mit einer Handlung oder einem Ereignis verbindet * [[d:Property:P6271|Demonym zu]], was ein Nomen oder Adjektiv mit einem Ort verbindet und die Menschen und Dinge beschreibt, die an diesem Ort leben oder von dort stammen. '''Beispiel 1.''' Die drei Sinne des Lexems [[d:Lexeme:L18379|L18379/rose]] beziehen sich auf die Farbe, die Blume und das biologische Taxon. Jeder dieser 3 Sinne ist in Wikidata durch eine Aussage mit einem anderen Datenobjekt verknüpft, wie diese (für den ersten Sinn): * Subjekt der Aussage: [[d:Lexeme:L18379|L18379-S1/rose Sinn 1]] * Eigenschaft der Aussage: [[d:Property:P5137|P5137/Objekt für diesen Sinn]] * Wert der Aussage: [[d:Q533047|Q533047/Rosé]] [[Z6830|<u>Finde Lexeme für Wikidata-Datenobjekt</u>]] sucht nach Lexemen, die durch eine bestimmte Eigenschaft mit einem bestimmten Datenobjekt in Beziehung stehen. (Auch wenn Beziehungen zwischen einem ''Lexemsinn'' und einem Datenobjekt bestehen, geben die API von Wikidata und diese Funktion Referenzen auf das ''Lexem'' zurück, das die Bedeutung(en) enthält.) '''Beispiel''' '''2''':  Der Aufruf von [[Z6830|<u>Finde Lexeme für Wikidata-Datenobjekt</u>]] mit [[d:Q533047|Q533047/Rosé]] (der Farbe), [[d:Property:P5137|P5137/Objekt für diesen Sinn]] und [[Z1002|<u>Z1002/Englisch</u>]] gibt eine Liste mit der Lexem-Referenz für [[d:Lexeme:L18379|L18379/rose]] zurück. Der Aufruf der Funktion mit [[d:Q102231|Q102231/Rose]] (der Blume) oder mit [[d:Q34687|Q34687/Rosen]] (dem biologischen Taxon) als erstem Argument gibt auch das Lexem [[d:Lexeme:L18379|L18379/rose]] zurück, da dieses Lexem (über seine 3 Sinne) mit allen 3 dieser Datenobjekte verwandt ist. '''Beispiel''' '''3''': Der Aufruf von [[Z6830|<u>Finde Lexeme für Wikidata-Datenobjekt</u>]] mit [[d:Q55|Q55/Niederlande]], [[d:Property:P6271|P6271/Demonym zu]] und [[Z1002|<u>Z1002/Englisch</u>]] gibt eine Liste mit der [[Z6095|<u>Wikidata-Lexem-Referenz</u>]] für [[d:Lexeme:L34519|L34519/Niederländisch]] zurück. Für ein Beispiel, in dem [[Z6830|<u>Finde Lexeme für Wikidata-Datenobjekt</u>]] zum Generieren einer Phrase in einer natürlichen Sprache verwendet wird, siehe bitte den Abschnitt ''Funktion der Woche'' in {{ll|Wikifunctions:Status updates/2025-02-26}}. <span id="Function:_Find_lexemes_for_a_Wikidata_lexeme_sense"></span> === Funktion: [[Z6831|<u>Finde Lexeme für Wikidata-Lexemsinne</u>]] === * Argumenttypen: [[Z6096|<u>Wikidata-Lexemsinn-Referenz</u>]], [[Z6092|<u>Wikidata-Eigenschaft-Referenz</u>]], [[Z60|<u>Natürliche Sprache</u>]] * Rückgabewerttyp: Liste von [[Z6095|<u>Wikidata-Lexem-Referenz</u>]] Wikidata erfasst auch nützliche Beziehungen zwischen Lexemsinnen und anderen Lexemsinnen, wie etwa die Beziehungen, die mit der Eigenschaft [[:d:Property:P8471|Pertainym von]] ausgedrückt werden, die eine Adjektivbedeutung mit einer verwandten Nomenbedeutung (z. B. lunar → Mond) oder eine Adverbbedeutung mit einer verwandten Adjektivbedeutung (z. B. langsam → langsam) verknüpft. [[Z6831|<u>Finde Lexeme für Wikidata-Lexemsinn</u>]] sucht nach Lexemen, die mit einem bestimmten Lexemsinn durch eine bestimmte Eigenschaft wie [[:d:Property:P8471|Pertainym von]] verwandt sind. (Obwohl die Beziehungen zwischen Paaren von ''Lexemsinnen'' bestehen, geben die API von Wikidata und diese Funktion Referenzen auf die ''Lexeme'' zurück, die die Zielsinne enthalten.) <span id="User_interface"></span> == Benutzeroberfläche == <span id="Selectors"></span> === Selektoren === [[File:Selecting a lexeme for "goose".png|thumb|Abb. 1. Auswahl eines Lexems für "goose"]] Selektoren ermöglichen es, in der Benutzeroberfläche von Wikifunctions eine zu verwendende Entität auszuwählen. Wenn der Benutzer beispielsweise ein Teilschlüsselwort in den Lexem-Selektor von Wikifunctions eingibt, fragt der Selektor Wikidata nach Lexemen ab, die mit diesem Teilschlüsselwort übereinstimmen. (Die Suche gleicht das Teilschlüsselwort mit den Lemmata aller Lexeme in Wikidata ab.) Es werden bis zu 10 der aktuellen Übereinstimmungen angezeigt und der Benutzer kann eine davon auswählen. Die Übereinstimmungsliste wird aktualisiert, während weitere Eingaben erfolgen. '''Beispiel''': Abbildung 1 zeigt das Aussehen eines Lexem-Selektors, nachdem die 5 Zeichen "goose" eingegeben wurden. An dieser Stelle werden dem Benutzer 4 passende Lexeme zur Auswahl angezeigt. Für ein Beispiel, in dem dieser Lexem-Selektor zur Vorbereitung eines Funktionsaufrufs verwendet wird, siehe bitte den Abschnitt ''Funktion der Woche'' in {{ll|Wikifunctions:Status updates/2024-10-17}}. Beachte, dass das Vorhandensein eines Wikidata-Selektors durch das Wikidata-Symbol (mit vertikalen Balken in Rot, Grün und Blau) angezeigt wird. Sobald der Benutzer eine Auswahl getroffen hat, generiert der Selektor je nach Kontext die entsprechende interne Darstellung des ausgewählten Objekts: # Eine Instanz des entsprechenden Wikidata-Referenztyps, wenn das alles ist, was benötigt wird, oder # Ein Aufruf der entsprechenden Abruffunktion mit einer Instanz des Referenztyps als Argument, das an diesen Aufruf übergeben wird. Selektoren werden hauptsächlich verwendet, wenn in der Benutzeroberfläche die Argumente für einen Funktionsaufruf bereitgestellt werden und die aufgerufene Funktion den relevanten Kontext bereitstellt. Wenn der Benutzer einen Wert für ein Argument angibt, das einen Wikidata-Referenztyp als Typ hat, gibt der Selektor (1) aus. In diesem Fall wird kein Abruf ausgeführt. Wenn das betreffende Argument einen Wikidata-Typ als Typ hat, gibt der Selektor (2) aus, wodurch das gesamte Objekt intern abgerufen und der aufgerufenen Funktion zur Verfügung gestellt wird. <span id="Display_elements"></span> === Anzeige von Elementen === [[File:Compact view of lexeme form for "umbrellas".png|thumb|Abb. 2. Kompakte Ansicht der Lexemform für "umbrellas"]] Wikifunctions bietet auch eine vereinfachte, kompakte Ansicht von Wikidata-Entitäten. Diese Ansicht wird auf gelesenen Seiten und beim Anzeigen der Ausgabe eines Funktionsaufrufs angezeigt. Diese kompakte Ansicht zeigt das Wikidata-Symbol gefolgt von einer Wortform, die mit der Wikidata-Entität verknüpft ist (z. B. ein Lemma aus einem Lexem, eine Darstellung aus einer Lexemform oder eine Bezeichnung aus einer Entität), in der Sprache des Benutzers, sofern verfügbar. Die Wortform ist mit der Wikidata-Seite verknüpft, von der die Entität abgerufen wurde. '''Beispiel:''' Abbildung 2 zeigt die kompakte Ansicht unterhalb des Wortes '''Result''' der [[Z6824|<u>Wikidata-Lexemform</u>]] für ''umbrellas'' (die als ''Darstellung'' der Form bezeichnet wird). Dies ist das anfängliche Erscheinungsbild des Ergebnisses der Ausführung einer Funktion, die eine Lexemform zurückgibt. [[File:Expanded view of lexeme form for "umbrellas".png|thumb|Abb. 3. Erweiterte Ansicht der Lexemform für "umbrellas"]] Wenn die Entität und ihre Details untersucht werden müssen, kann sie mithilfe der rechten ''Chevron''-Schaltfläche (die wie '>' aussieht) vor dem Element erweitert werden. Die erweiterte Ansicht ermöglicht dem Benutzer zu verstehen, welche Art von Darstellung für diese Entität verwendet wird. Die Darstellung kann einen Wikidata-Referenztyp, einen Funktionsaufruf der entsprechenden Wikidata-Abruffunktion oder die gesamte Entitätsinstanz verwenden, die von diesem Funktionsaufruf zurückgegeben wird. In jedem Fall kann der Benutzer den Inhalt erweitern, erkunden und darin navigieren. '''Beispiel:''' Abbildung 3 zeigt die erweiterte Ansicht der Lexemform für ''umbrellas'', die sich durch Klicken auf den Chevron in Abbildung 2 ergibt. Hier sehen wir die Darstellung der gesamten Instanz der [[Z6824|<u>Wikidata-Lexemform</u>]]. Jede der verschachtelten Komponenten der Form mit einem Chevron (z. B. <code>Identität</code>, <code>Lexem</code>, etc.) kann zur weiteren Untersuchung erweitert werden. <span id="Status_of_UI_components_for_Wikidata_entity_types"></span> === Status der UI-Komponenten für Wikidata-Entitätstypen === * [[Z6825|<u>Wikidata-Lexem</u>]] ** Anzeige und Selektor: verfügbar * [[Z6824|<u>Wikidata-Lexemform</u>]] ** Anzeige und Selektor: verfügbar * [[Z6826|<u>Wikidata-Lexemsinn</u>]] ** Anzeige und Selektor: Datum der Veröffentlichung noch nicht festgelegt * [[Z6821|<u>Wikidata-Datenobjekt</u>]] ** Anzeige und Selektor: verfügbar * [[Z6822|<u>Wikidata-Eigenschaft</u>]] ** Anzeige und Selektor: verfügbar <span id="Limitations_of_UI_components_for_Wikidata_entity_types"></span> === Begrenzung der UI-Komponenten für Wikidata-Entitätstypen === '''Visuelle Unterscheidung'''. Derzeit fehlt der Wikifunctions-UI die visuelle Unterscheidung zwischen den verschiedenen Wikidata-Entitätstypen: * Die Selektoren für die anderen Entitätstypen ähneln sehr denen für Wikidata-Lexeme, zu sehen in Abbildung 1. Es gibt keinen expliziten Hinweis darauf, welcher Typ ausgewählt wird. ** Problemumgehungen: Normalerweise weiß man aus dem Kontext, welche Art von Sache ausgewählt wird. Darüber hinaus variiert der Inhalt der Auswahlmöglichkeiten (in der ausklappbaren Liste) je nach Art der ausgewählten Sache. Beispielsweise zeigt in einem ''Lexem''-Selektor jede Auswahlmöglichkeit ihr Lemma, ihre Sprache und Wortart (wie in Abbildung 1 dargestellt), während in einem ''Lexemform''-Selektor jede Auswahlmöglichkeit ihre Wortform und grammatikalischen Funktionen zusammen mit Informationen anzeigt, die das enthaltene Lexem identifizieren. * Die kompakten Ansichten für die anderen Entitätstypen sehen genauso aus wie die für Wikidata-Lexeme, zu sehen in Abbildung 2. (Das heißt, sie zeigen nur das Wikidata-Symbol und eine einzelne Wortform.) ** Problemumgehung: Wenn es aus dem Kontext nicht offensichtlich ist, kann man auf den Chevron klicken, um die erweiterte Ansicht der Entität zu erhalten, in der ihr Typ explizit angegeben ist, zu sehen in Abbildung 3. '''Fehlende kompakte Ansichten'''. Da die Anzeigeelemente für [[Z6006|<u>Wikidata-Lexemsinn</u>]] und [[Z6003|<u>Wikidata-Aussage</u>]] noch nicht vollständig eingeführt wurden, kann die Darstellung von Elementen dieser Art ziemlich platzraubend sein und die Lesbarkeit größerer Entitäten, die sie enthalten, beeinträchtigen. Dies gilt insbesondere dann, wenn ein Lexem, eine Lexemform oder ein Lexemsinn eine beträchtliche Liste von Aussagen enthält. '''Nichtübereinstimmung des Status'''. Obwohl die Abruffunktion für [[Z6826|<u>Wikidata-Lexemsinn</u>]] verfügbar ist, ist der Selektor für diesen Typ noch nicht verfügbar. <span id="Appendix:_an_instance_of_Wikidata_lexeme"></span> == Anhang: Eine Instanz von Wikidata-Lexem == Dieses Beispiel wird im Unterabschnitt ''Beispiel'' des Abschnitts ''Wikidata-Typen'' vorgestellt. Es zeigt eine bestimmte Instanz eines Wikidata-Lexems, das von [[:d:Lexeme:L3435|L3435 auf Wikidata]] abgerufen wurde. Die rechte Spalte zeigt die formale ZObjekt-Darstellung (in kanonischer Form); die linke Spalte zeigt der besseren Lesbarkeit halber denselben Inhalt mit englischen Bezeichnungen für jedes der Elemente des ZObjekts. Die ZObjekt-Darstellung von Wikifunctions wird in {{ll|Wikifunctions:Function model}} dargestellt; wir erklären die Details der Darstellung hier nicht. Das Beispiel wurde gekürzt, indem einige Inhalte weggelassen wurden, wie durch Auslassungspunkte angezeigt. Aus Gründen der Lesbarkeit wurde auch die Angabe des Elementtypen weggelassen, die in kanonischer Form normalerweise an der ersten Position jeder Liste erscheint. {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] 32tzw8d14rbd22m8h5c07gmrncot1ch Wikifunctions:How to create implementations/th 4 46527 276462 240263 2026-05-20T06:15:47Z FuzzyBot 207 Updating to match new version of source page 276462 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Compositions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] gqduotf6d59h7zdhzx2eqwlcgy8hdq8 User:Theki/functions 2 47433 276278 275878 2026-05-19T19:05:15Z Theki 2389 /* infoboxes */ 276278 wikitext text/x-wiki * <div style="display:inline-block;background:#e5e5e5;aspect-ratio:1/1;width:10px;"></div> nonexistent but should logically exist * <div style="display:inline-block;background:#555;aspect-ratio:1/1;width:10px;"></div> shouldnt logically exist __TOC__ == data == === conversions === {| class="wikitable" ! style="line-height:1.2;padding:0.1em 0.4em;background:var(--background-color-neutral,#eaecf0);background-image:linear-gradient(to top right,var(--background-color-neutral,#eaecf0) 49%,var(--border-color-base,#a2a9b1) 49.5%,var(--border-color-base,#a2a9b1) 50.5%,var(--background-color-neutral,#eaecf0) 51%);" | <div style="margin-left:2em;">from</div><div style="margin-right:2em;">to</div> ! [[Z40|boolean]] !! [[Z20838|float64]]!! [[Z16683|integer]] !! [[Z13518|natural number]] ![[Z19677|rational number]]!! [[Z6|string]] |- ! scope = "row" | boolean | [[Z10215|Z​10215]] | colspan="5" style="text-align:center;" | [[Z15684|Z​15684]] |- ! scope="row" | float64 | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="3" style="background:#e5e5e5;border:0;" | | [[Z20937|Z​20937]] | [[Z20936|Z​20936]] | [[Z20854|Z​20854]] | [[Z20915|Z​20915]] |- ! scope="row" | integer | style="background:#e5e5e5;border:0;" | | [[Z17101|Z​17101]] | [[Z19682|Z​19682]] | base n: [[Z18467|Z​18467]]<br>base 10: [[Z16705|Z​16705]] |- ! scope = "row" | natural number | [[Z17065|Z​17065]] | [[Z20391|Z​20391]] | [[Z13636|Z​13636]] | style="background:#e5e5e5;border:0;" | | base n: [[Z13806|Z​13806]]<br>base 10: [[Z14290|Z​14290]] |- !rational number | style="background:#e5e5e5;border:0;" | | [[Z21071|Z​21071]] | [[Z19744|Z​19744]] | [[Z21653|Z​21653]] | [[Z20112|Z​20112]] | [[Z19866|Z​19866]] |- ! scope = "row" | string | [[Z10730|Z​10730]] |[[Z20844|Z​20844]] | base n: [[Z18592|Z​18592]]<br>base 10: [[Z16700|Z​16700]] | base n: [[Z15671|Z​15671]]<br>base 10: [[Z14280|Z​14280]] | [[Z19827|Z​19827]] | [[Z11602|Z​11602]] |} * [[Z17352|(int as nat)]] * [[Z17355|(nat as int)]] * [[Z21402|(rat as f64)]] === operations === {| class="wikitable" ! !! float64!! integer !! natural number !rational number!! string !! list |- ! scope = "row" | == |same value: [[Z20924|Z​20924]]<br>same object: [[Z20850|Z​20850]] | [[Z16688|Z​16688]] || [[Z13522|Z​13522]] |same value: [[Z19686|Z​19686]]<br>same object: [[Z19892|Z​19892]] | [[Z866|Z​866]] | [[Z889|Z​889]] |- !> | [[Z20943|Z​20943]] | [[Z17132|Z​17132]] | [[Z13676|Z​13676]] | [[Z19751|Z​19751]] | rowspan="4" style="background:#555;border:0;" | | rowspan="4" style="background:#555;border:0;" | |- !< | [[Z20940|Z​20940]] | [[Z17140|Z​17140]] | [[Z13689|Z​13689]] | [[Z19753|Z​19753]] |- !>= | [[Z20944|Z​20944]] | [[Z17173|Z​17173]] | [[Z13682|Z​13682]] | [[Z19752|Z​19752]] |- !<= | [[Z20941|Z​20941]] | [[Z17363|Z​17363]] | [[Z13695|Z​13695]] | [[Z19754|Z​19754]] |- ! scope="row" | + |[[Z20849|Z​20849]]|| [[Z16693|Z​16693]] || [[Z13521|Z​13521]] |[[Z19679|Z​19679]]|| [[Z10000|Z​10000]] || typed: [[Z12961|Z​12961]]<br>untyped: [[Z18597|Z​18597]] |- ! scope = "row" | − |[[Z21031|​Z​21031]] | [[Z17111|Z​17111]] || as integer: [[Z17315|Z​17315]] <br>as natural number: [[Z13569|Z​13569]] |[[Z19699|Z​19699]]|| rowspan="9" style="background:#555;border:0;" | || first: [[Z812|Z​812]]<br>last: [[Z12967|Z​12967]] |- ! scope = "row" | × | [[Z21032|Z​21032]] | [[Z17120|Z​17120]] || [[Z13539|Z​13539]] | [[Z19706|Z​19706]] | rowspan="8" style="background:#555;border:0;" | |- ! scope = "row" | ÷ | [[Z21033|Z​21033]] | [[Z17291|Z​17291]] || [[Z13546|Z​13546]] | [[Z19708|Z​19708]] |- ! scope = "row" | % | [[Z22236|Z​22236]] | [[Z17167|Z​17167]] || [[Z13551|Z​13551]] | [[Z20006|Z​20006]] |- !>> | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | | [[Z13813|Z​13813]] | rowspan="2" style="background:#e5e5e5;border:0;" | |- !<< | [[Z13812|Z​13812]] |- ! scope = "row" | abs | [[Z21041|Z​21041]] | as integer: [[Z17128|Z​17128]]<br>as natural number: [[Z17144|Z​17144]] || style="background:#555;border:0;" | | [[Z21692|Z​21692]] |- !pow | [[Z21028|Z​21028]] | [[Z17263|Z​17263]] | [[Z13647|Z​13647]] | [[Z19953|Z​19953]] |- !sqrt |[[Z22600|Z​22600]] |[[Z24591|Z​24591]] |[[Z15256|Z​15256]] |[[Z20902|Z​20902]] |} === boolean operations === {| class="wikitable" ! !! [[Z40|boolean]] (tf) !! [[Z22112|kleenean]] (mtf) !! bitwise |- ! scope = "row" | [[w:Logical conjunction|AND]] | [[Z10174|Z​10174]] | [[Z22143|Z​22143]] | natural number: [[Z13651|Z​13651]] |- ! scope = "row" | [[w:Logical disjunction|OR]] | [[Z10184|Z​10184]] | [[Z22168|Z​22168]] | natural number: [[Z13652|Z​13652]] |- ! scope = "row" | [[w:Negation|NOT]] | [[Z10216|Z​10216]] | [[Z22207|Z​22207]] | byte: [[Z22529|Z​22529]]<br>integer: [[Z17794|Z​17794]] |- ! scope = "row" | [[w:Sheffer stroke|NAND]] | [[Z10243|Z​10243]] | [[Z24749|Z​24749]] | byte: [[Z24716|Z​24716]] |- ! scope = "row" | [[w:Exclusive or|XOR]] (≠) | [[Z10237|Z​10237]] | [[Z22231|Z​22231]] | natural number: [[Z13653|Z​13653]] |- ! scope = "row" | [[w:Logical NOR|NOR]] | [[Z10231|Z​10231]] | style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | |- ! scope = "row" | [[w:Logical biconditional|XNOR]] (=) | [[Z844|Z​844]] | [[Z22120|Z​22120]] |} == list functions == {{Z+|Z881}} * '''generate (range)''': {{Z+|Z21821}} * '''generate (replicated object)''': {{Z+|Z21389}} * '''map''' {{Z+|Z873}} * '''map(list, const)''': {{Z+|Z13464}} * '''map(const, list)''': {{Z+|Z13436}} * '''match tail''': {{Z+|Z16199}} * '''type''': {{Z+|Z18475}} === typed? === * '''concatenate''': {{Z+|Z18755}} * '''deduplicate''': {{Z+|Z19202}} * '''flatten''': {{Z+|Z23606}} * '''generate (natural number range)''': {{Z+|Z13831}} * '''reverse''': {{Z+|Z18479}} * '''untype''': {{Z+|Z17895}} == map functions == {{Z+|Z883}}<!--these don't seem to work at the moment--> * '''empty?''': {{Z+|Z24609}} * '''from list''': {{Z+|Z24646}} * '''get value''': {{Z+|Z24606}} * '''identity''': {{Z+|Z24603}} * '''map''': {{Z+|Z24608}} * '''parse JSON''': {{Z+|Z24602}} === returns (no map inputs) === * '''values of Object as map''': {{Z+|Z804}} == language == :''see also [[Wikifunctions:NLG functions|Natural language generation functions]], [[abstract:Abstract Wikipedia:Useful functions for article composition|Useful functions for article composition]]'' {|class=wikitable !A |adjective |- !C |class |- !N |noun |- !V |verb |} {|class=wikitable !sentence type !multilingual function !config !monolingual text !language parameter in English implementation |- |(a A N)||{{Z|Z22664}}||{{Z|Z21733}} |{{/no|2}} |{{/no|7}} |- |N is a C.||{{Z|Z26039}}||{{Z|Z26043}} |- |An N is a C.||{{Z|Z26095}}||{{Z|Z26096}} |{{/yes|3}} |- |N is a C in N.||{{Z|Z26570}}||{{Z|Z29843}} |- |Cs are Cs.||{{Z|Z26627}}||{{Z|Z27126}} |- |C is A C.||{{Z|Z27173}}||{{Z|Z29628}} |{{/no}} |- |N is the Aest C in N.||{{Z|Z27243}}||{{Z|Z29841}} |{{/yes|12}} |- |N is the N of N.||{{Z|Z28016}}||{{Z|Z28020}} |{{/yes|3}} |- |Ns are Ns of N.||{{Z|Z32326}}||{{Z|Z32255}} |- |Ns V Ns.||{{Z|Z32531}}||{{Z|Z32530}} |- |N is a C by N.||{{Z|Z32581}}||{{Z|Z32534}} |{{/no}} |- |N is a C and C. |rowspan=2|{{Z|Z32643}} |rowspan=2|{{Z|Z32660}} |{{/yes|5}} |- |N is a C, C, and C. |- |N Vs N.||{{Z|Z33185}}||{{Z|Z33184}} |- |N is a C from N.||{{Z|Z33975}}||{{Z|Z33981}} |- |N is the #th C by N.||{{Z|Z34253}}||{{Z|Z34255}} |- |N is a C. (automatic based on Wikidata class)||{{Z|Z34282}}||{{Z|Z34281}} |{{/no}} |- |N is a A N.||{{Z|Z29591}}||{{Z|Z29597}} |{{/yes}} |} == personal functions == * {{Z|Z24629}} * {{Z|Z24632}} * {{Z|Z24649}} * {{Z|Z24660}} * {{Z|Z24665}} * {{Z|Z33834}} * {{Z|Z33836}} * {{Z|Z33890}} * {{Z|Z35188}} * {{Z|Z35190}} * {{Z|Z35192}} * {{Z|Z35199}} === date/time === * {{Z+|Z23246}} * {{Z+|Z23783}} * {{Z+|Z23801}} * {{Z+|Z23808}} * {{Z+|Z23833}} * {{Z+|Z23865}} === [[Z1762|toki pona]] === : ''see [[Wikifunctions:Catalogue/Natural language operations/Toki Pona]]'' * {{Z|Z22455}} * {{Z|Z22571}} * {{Z|Z24721}} * {{Z|Z33828}} * {{Z|Z33831}} * {{Z|Z33873}} === infoboxes === * {{Z|Z35167}} ** {{Z|Z35371}} ** '''implementations depend on these bespoke functions''' *** '''{{Z|Z35175}}''' *** {{Z|Z35176}} *** {{Z|Z35188}} **** {{Z|Z35362}} *** {{Z|Z35192}} *** {{Z|Z35199}} *** {{Z|Z35374}} *** {{Z|Z35376}} ==== creation ==== * '''{{Z|Z35175}}''' * {{Z|Z35176}} == todo == * add toki pona to {{Z|Z33855}} * move certain uses of {{Z|Z10771}} to {{Z|Z34096}} * make sure English sentence generation functions have a language parameter to allow for rendering of certain words in e.g. British English (use {{Z|Z34039}}) ** {{Z|Z33059}} cqu1lq8v9w9ssxoh9t3vdbaapy78cfw 276281 276278 2026-05-19T19:08:31Z Theki 2389 /* infoboxes */ 276281 wikitext text/x-wiki * <div style="display:inline-block;background:#e5e5e5;aspect-ratio:1/1;width:10px;"></div> nonexistent but should logically exist * <div style="display:inline-block;background:#555;aspect-ratio:1/1;width:10px;"></div> shouldnt logically exist __TOC__ == data == === conversions === {| class="wikitable" ! style="line-height:1.2;padding:0.1em 0.4em;background:var(--background-color-neutral,#eaecf0);background-image:linear-gradient(to top right,var(--background-color-neutral,#eaecf0) 49%,var(--border-color-base,#a2a9b1) 49.5%,var(--border-color-base,#a2a9b1) 50.5%,var(--background-color-neutral,#eaecf0) 51%);" | <div style="margin-left:2em;">from</div><div style="margin-right:2em;">to</div> ! [[Z40|boolean]] !! [[Z20838|float64]]!! [[Z16683|integer]] !! [[Z13518|natural number]] ![[Z19677|rational number]]!! [[Z6|string]] |- ! scope = "row" | boolean | [[Z10215|Z​10215]] | colspan="5" style="text-align:center;" | [[Z15684|Z​15684]] |- ! scope="row" | float64 | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="3" style="background:#e5e5e5;border:0;" | | [[Z20937|Z​20937]] | [[Z20936|Z​20936]] | [[Z20854|Z​20854]] | [[Z20915|Z​20915]] |- ! scope="row" | integer | style="background:#e5e5e5;border:0;" | | [[Z17101|Z​17101]] | [[Z19682|Z​19682]] | base n: [[Z18467|Z​18467]]<br>base 10: [[Z16705|Z​16705]] |- ! scope = "row" | natural number | [[Z17065|Z​17065]] | [[Z20391|Z​20391]] | [[Z13636|Z​13636]] | style="background:#e5e5e5;border:0;" | | base n: [[Z13806|Z​13806]]<br>base 10: [[Z14290|Z​14290]] |- !rational number | style="background:#e5e5e5;border:0;" | | [[Z21071|Z​21071]] | [[Z19744|Z​19744]] | [[Z21653|Z​21653]] | [[Z20112|Z​20112]] | [[Z19866|Z​19866]] |- ! scope = "row" | string | [[Z10730|Z​10730]] |[[Z20844|Z​20844]] | base n: [[Z18592|Z​18592]]<br>base 10: [[Z16700|Z​16700]] | base n: [[Z15671|Z​15671]]<br>base 10: [[Z14280|Z​14280]] | [[Z19827|Z​19827]] | [[Z11602|Z​11602]] |} * [[Z17352|(int as nat)]] * [[Z17355|(nat as int)]] * [[Z21402|(rat as f64)]] === operations === {| class="wikitable" ! !! float64!! integer !! natural number !rational number!! string !! list |- ! scope = "row" | == |same value: [[Z20924|Z​20924]]<br>same object: [[Z20850|Z​20850]] | [[Z16688|Z​16688]] || [[Z13522|Z​13522]] |same value: [[Z19686|Z​19686]]<br>same object: [[Z19892|Z​19892]] | [[Z866|Z​866]] | [[Z889|Z​889]] |- !> | [[Z20943|Z​20943]] | [[Z17132|Z​17132]] | [[Z13676|Z​13676]] | [[Z19751|Z​19751]] | rowspan="4" style="background:#555;border:0;" | | rowspan="4" style="background:#555;border:0;" | |- !< | [[Z20940|Z​20940]] | [[Z17140|Z​17140]] | [[Z13689|Z​13689]] | [[Z19753|Z​19753]] |- !>= | [[Z20944|Z​20944]] | [[Z17173|Z​17173]] | [[Z13682|Z​13682]] | [[Z19752|Z​19752]] |- !<= | [[Z20941|Z​20941]] | [[Z17363|Z​17363]] | [[Z13695|Z​13695]] | [[Z19754|Z​19754]] |- ! scope="row" | + |[[Z20849|Z​20849]]|| [[Z16693|Z​16693]] || [[Z13521|Z​13521]] |[[Z19679|Z​19679]]|| [[Z10000|Z​10000]] || typed: [[Z12961|Z​12961]]<br>untyped: [[Z18597|Z​18597]] |- ! scope = "row" | − |[[Z21031|​Z​21031]] | [[Z17111|Z​17111]] || as integer: [[Z17315|Z​17315]] <br>as natural number: [[Z13569|Z​13569]] |[[Z19699|Z​19699]]|| rowspan="9" style="background:#555;border:0;" | || first: [[Z812|Z​812]]<br>last: [[Z12967|Z​12967]] |- ! scope = "row" | × | [[Z21032|Z​21032]] | [[Z17120|Z​17120]] || [[Z13539|Z​13539]] | [[Z19706|Z​19706]] | rowspan="8" style="background:#555;border:0;" | |- ! scope = "row" | ÷ | [[Z21033|Z​21033]] | [[Z17291|Z​17291]] || [[Z13546|Z​13546]] | [[Z19708|Z​19708]] |- ! scope = "row" | % | [[Z22236|Z​22236]] | [[Z17167|Z​17167]] || [[Z13551|Z​13551]] | [[Z20006|Z​20006]] |- !>> | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | | [[Z13813|Z​13813]] | rowspan="2" style="background:#e5e5e5;border:0;" | |- !<< | [[Z13812|Z​13812]] |- ! scope = "row" | abs | [[Z21041|Z​21041]] | as integer: [[Z17128|Z​17128]]<br>as natural number: [[Z17144|Z​17144]] || style="background:#555;border:0;" | | [[Z21692|Z​21692]] |- !pow | [[Z21028|Z​21028]] | [[Z17263|Z​17263]] | [[Z13647|Z​13647]] | [[Z19953|Z​19953]] |- !sqrt |[[Z22600|Z​22600]] |[[Z24591|Z​24591]] |[[Z15256|Z​15256]] |[[Z20902|Z​20902]] |} === boolean operations === {| class="wikitable" ! !! [[Z40|boolean]] (tf) !! [[Z22112|kleenean]] (mtf) !! bitwise |- ! scope = "row" | [[w:Logical conjunction|AND]] | [[Z10174|Z​10174]] | [[Z22143|Z​22143]] | natural number: [[Z13651|Z​13651]] |- ! scope = "row" | [[w:Logical disjunction|OR]] | [[Z10184|Z​10184]] | [[Z22168|Z​22168]] | natural number: [[Z13652|Z​13652]] |- ! scope = "row" | [[w:Negation|NOT]] | [[Z10216|Z​10216]] | [[Z22207|Z​22207]] | byte: [[Z22529|Z​22529]]<br>integer: [[Z17794|Z​17794]] |- ! scope = "row" | [[w:Sheffer stroke|NAND]] | [[Z10243|Z​10243]] | [[Z24749|Z​24749]] | byte: [[Z24716|Z​24716]] |- ! scope = "row" | [[w:Exclusive or|XOR]] (≠) | [[Z10237|Z​10237]] | [[Z22231|Z​22231]] | natural number: [[Z13653|Z​13653]] |- ! scope = "row" | [[w:Logical NOR|NOR]] | [[Z10231|Z​10231]] | style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | |- ! scope = "row" | [[w:Logical biconditional|XNOR]] (=) | [[Z844|Z​844]] | [[Z22120|Z​22120]] |} == list functions == {{Z+|Z881}} * '''generate (range)''': {{Z+|Z21821}} * '''generate (replicated object)''': {{Z+|Z21389}} * '''map''' {{Z+|Z873}} * '''map(list, const)''': {{Z+|Z13464}} * '''map(const, list)''': {{Z+|Z13436}} * '''match tail''': {{Z+|Z16199}} * '''type''': {{Z+|Z18475}} === typed? === * '''concatenate''': {{Z+|Z18755}} * '''deduplicate''': {{Z+|Z19202}} * '''flatten''': {{Z+|Z23606}} * '''generate (natural number range)''': {{Z+|Z13831}} * '''reverse''': {{Z+|Z18479}} * '''untype''': {{Z+|Z17895}} == map functions == {{Z+|Z883}}<!--these don't seem to work at the moment--> * '''empty?''': {{Z+|Z24609}} * '''from list''': {{Z+|Z24646}} * '''get value''': {{Z+|Z24606}} * '''identity''': {{Z+|Z24603}} * '''map''': {{Z+|Z24608}} * '''parse JSON''': {{Z+|Z24602}} === returns (no map inputs) === * '''values of Object as map''': {{Z+|Z804}} == language == :''see also [[Wikifunctions:NLG functions|Natural language generation functions]], [[abstract:Abstract Wikipedia:Useful functions for article composition|Useful functions for article composition]]'' {|class=wikitable !A |adjective |- !C |class |- !N |noun |- !V |verb |} {|class=wikitable !sentence type !multilingual function !config !monolingual text !language parameter in English implementation |- |(a A N)||{{Z|Z22664}}||{{Z|Z21733}} |{{/no|2}} |{{/no|7}} |- |N is a C.||{{Z|Z26039}}||{{Z|Z26043}} |- |An N is a C.||{{Z|Z26095}}||{{Z|Z26096}} |{{/yes|3}} |- |N is a C in N.||{{Z|Z26570}}||{{Z|Z29843}} |- |Cs are Cs.||{{Z|Z26627}}||{{Z|Z27126}} |- |C is A C.||{{Z|Z27173}}||{{Z|Z29628}} |{{/no}} |- |N is the Aest C in N.||{{Z|Z27243}}||{{Z|Z29841}} |{{/yes|12}} |- |N is the N of N.||{{Z|Z28016}}||{{Z|Z28020}} |{{/yes|3}} |- |Ns are Ns of N.||{{Z|Z32326}}||{{Z|Z32255}} |- |Ns V Ns.||{{Z|Z32531}}||{{Z|Z32530}} |- |N is a C by N.||{{Z|Z32581}}||{{Z|Z32534}} |{{/no}} |- |N is a C and C. |rowspan=2|{{Z|Z32643}} |rowspan=2|{{Z|Z32660}} |{{/yes|5}} |- |N is a C, C, and C. |- |N Vs N.||{{Z|Z33185}}||{{Z|Z33184}} |- |N is a C from N.||{{Z|Z33975}}||{{Z|Z33981}} |- |N is the #th C by N.||{{Z|Z34253}}||{{Z|Z34255}} |- |N is a C. (automatic based on Wikidata class)||{{Z|Z34282}}||{{Z|Z34281}} |{{/no}} |- |N is a A N.||{{Z|Z29591}}||{{Z|Z29597}} |{{/yes}} |} == personal functions == * {{Z|Z24629}} * {{Z|Z24632}} * {{Z|Z24649}} * {{Z|Z24660}} * {{Z|Z24665}} * {{Z|Z33834}} * {{Z|Z33836}} * {{Z|Z33890}} * {{Z|Z35188}} * {{Z|Z35190}} * {{Z|Z35192}} * {{Z|Z35199}} === date/time === * {{Z+|Z23246}} * {{Z+|Z23783}} * {{Z+|Z23801}} * {{Z+|Z23808}} * {{Z+|Z23833}} * {{Z+|Z23865}} === [[Z1762|toki pona]] === : ''see [[Wikifunctions:Catalogue/Natural language operations/Toki Pona]]'' * {{Z|Z22455}} * {{Z|Z22571}} * {{Z|Z24721}} * {{Z|Z33828}} * {{Z|Z33831}} * {{Z|Z33873}} === infoboxes === * {{Z|Z35370}} ** {{Z|Z35371}} ** '''implementations depend on these bespoke functions''' *** {{Z|Z35167}} **** '''{{Z|Z35175}}''' **** {{Z|Z35176}} **** {{Z|Z35188}} ***** {{Z|Z35362}} **** {{Z|Z35192}} **** {{Z|Z35199}} **** {{Z|Z35374}} **** {{Z|Z35376}} ==== creation ==== * '''{{Z|Z35175}}''' * {{Z|Z35176}} == todo == * add toki pona to {{Z|Z33855}} * move certain uses of {{Z|Z10771}} to {{Z|Z34096}} * make sure English sentence generation functions have a language parameter to allow for rendering of certain words in e.g. British English (use {{Z|Z34039}}) ** {{Z|Z33059}} tvpqv4b9sh62js5tux1biuz76lcjjf7 276282 276281 2026-05-19T19:09:58Z Theki 2389 /* infoboxes */ 276282 wikitext text/x-wiki * <div style="display:inline-block;background:#e5e5e5;aspect-ratio:1/1;width:10px;"></div> nonexistent but should logically exist * <div style="display:inline-block;background:#555;aspect-ratio:1/1;width:10px;"></div> shouldnt logically exist __TOC__ == data == === conversions === {| class="wikitable" ! style="line-height:1.2;padding:0.1em 0.4em;background:var(--background-color-neutral,#eaecf0);background-image:linear-gradient(to top right,var(--background-color-neutral,#eaecf0) 49%,var(--border-color-base,#a2a9b1) 49.5%,var(--border-color-base,#a2a9b1) 50.5%,var(--background-color-neutral,#eaecf0) 51%);" | <div style="margin-left:2em;">from</div><div style="margin-right:2em;">to</div> ! [[Z40|boolean]] !! [[Z20838|float64]]!! [[Z16683|integer]] !! [[Z13518|natural number]] ![[Z19677|rational number]]!! [[Z6|string]] |- ! scope = "row" | boolean | [[Z10215|Z​10215]] | colspan="5" style="text-align:center;" | [[Z15684|Z​15684]] |- ! scope="row" | float64 | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="3" style="background:#e5e5e5;border:0;" | | [[Z20937|Z​20937]] | [[Z20936|Z​20936]] | [[Z20854|Z​20854]] | [[Z20915|Z​20915]] |- ! scope="row" | integer | style="background:#e5e5e5;border:0;" | | [[Z17101|Z​17101]] | [[Z19682|Z​19682]] | base n: [[Z18467|Z​18467]]<br>base 10: [[Z16705|Z​16705]] |- ! scope = "row" | natural number | [[Z17065|Z​17065]] | [[Z20391|Z​20391]] | [[Z13636|Z​13636]] | style="background:#e5e5e5;border:0;" | | base n: [[Z13806|Z​13806]]<br>base 10: [[Z14290|Z​14290]] |- !rational number | style="background:#e5e5e5;border:0;" | | [[Z21071|Z​21071]] | [[Z19744|Z​19744]] | [[Z21653|Z​21653]] | [[Z20112|Z​20112]] | [[Z19866|Z​19866]] |- ! scope = "row" | string | [[Z10730|Z​10730]] |[[Z20844|Z​20844]] | base n: [[Z18592|Z​18592]]<br>base 10: [[Z16700|Z​16700]] | base n: [[Z15671|Z​15671]]<br>base 10: [[Z14280|Z​14280]] | [[Z19827|Z​19827]] | [[Z11602|Z​11602]] |} * [[Z17352|(int as nat)]] * [[Z17355|(nat as int)]] * [[Z21402|(rat as f64)]] === operations === {| class="wikitable" ! !! float64!! integer !! natural number !rational number!! string !! list |- ! scope = "row" | == |same value: [[Z20924|Z​20924]]<br>same object: [[Z20850|Z​20850]] | [[Z16688|Z​16688]] || [[Z13522|Z​13522]] |same value: [[Z19686|Z​19686]]<br>same object: [[Z19892|Z​19892]] | [[Z866|Z​866]] | [[Z889|Z​889]] |- !> | [[Z20943|Z​20943]] | [[Z17132|Z​17132]] | [[Z13676|Z​13676]] | [[Z19751|Z​19751]] | rowspan="4" style="background:#555;border:0;" | | rowspan="4" style="background:#555;border:0;" | |- !< | [[Z20940|Z​20940]] | [[Z17140|Z​17140]] | [[Z13689|Z​13689]] | [[Z19753|Z​19753]] |- !>= | [[Z20944|Z​20944]] | [[Z17173|Z​17173]] | [[Z13682|Z​13682]] | [[Z19752|Z​19752]] |- !<= | [[Z20941|Z​20941]] | [[Z17363|Z​17363]] | [[Z13695|Z​13695]] | [[Z19754|Z​19754]] |- ! scope="row" | + |[[Z20849|Z​20849]]|| [[Z16693|Z​16693]] || [[Z13521|Z​13521]] |[[Z19679|Z​19679]]|| [[Z10000|Z​10000]] || typed: [[Z12961|Z​12961]]<br>untyped: [[Z18597|Z​18597]] |- ! scope = "row" | − |[[Z21031|​Z​21031]] | [[Z17111|Z​17111]] || as integer: [[Z17315|Z​17315]] <br>as natural number: [[Z13569|Z​13569]] |[[Z19699|Z​19699]]|| rowspan="9" style="background:#555;border:0;" | || first: [[Z812|Z​812]]<br>last: [[Z12967|Z​12967]] |- ! scope = "row" | × | [[Z21032|Z​21032]] | [[Z17120|Z​17120]] || [[Z13539|Z​13539]] | [[Z19706|Z​19706]] | rowspan="8" style="background:#555;border:0;" | |- ! scope = "row" | ÷ | [[Z21033|Z​21033]] | [[Z17291|Z​17291]] || [[Z13546|Z​13546]] | [[Z19708|Z​19708]] |- ! scope = "row" | % | [[Z22236|Z​22236]] | [[Z17167|Z​17167]] || [[Z13551|Z​13551]] | [[Z20006|Z​20006]] |- !>> | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | | [[Z13813|Z​13813]] | rowspan="2" style="background:#e5e5e5;border:0;" | |- !<< | [[Z13812|Z​13812]] |- ! scope = "row" | abs | [[Z21041|Z​21041]] | as integer: [[Z17128|Z​17128]]<br>as natural number: [[Z17144|Z​17144]] || style="background:#555;border:0;" | | [[Z21692|Z​21692]] |- !pow | [[Z21028|Z​21028]] | [[Z17263|Z​17263]] | [[Z13647|Z​13647]] | [[Z19953|Z​19953]] |- !sqrt |[[Z22600|Z​22600]] |[[Z24591|Z​24591]] |[[Z15256|Z​15256]] |[[Z20902|Z​20902]] |} === boolean operations === {| class="wikitable" ! !! [[Z40|boolean]] (tf) !! [[Z22112|kleenean]] (mtf) !! bitwise |- ! scope = "row" | [[w:Logical conjunction|AND]] | [[Z10174|Z​10174]] | [[Z22143|Z​22143]] | natural number: [[Z13651|Z​13651]] |- ! scope = "row" | [[w:Logical disjunction|OR]] | [[Z10184|Z​10184]] | [[Z22168|Z​22168]] | natural number: [[Z13652|Z​13652]] |- ! scope = "row" | [[w:Negation|NOT]] | [[Z10216|Z​10216]] | [[Z22207|Z​22207]] | byte: [[Z22529|Z​22529]]<br>integer: [[Z17794|Z​17794]] |- ! scope = "row" | [[w:Sheffer stroke|NAND]] | [[Z10243|Z​10243]] | [[Z24749|Z​24749]] | byte: [[Z24716|Z​24716]] |- ! scope = "row" | [[w:Exclusive or|XOR]] (≠) | [[Z10237|Z​10237]] | [[Z22231|Z​22231]] | natural number: [[Z13653|Z​13653]] |- ! scope = "row" | [[w:Logical NOR|NOR]] | [[Z10231|Z​10231]] | style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | |- ! scope = "row" | [[w:Logical biconditional|XNOR]] (=) | [[Z844|Z​844]] | [[Z22120|Z​22120]] |} == list functions == {{Z+|Z881}} * '''generate (range)''': {{Z+|Z21821}} * '''generate (replicated object)''': {{Z+|Z21389}} * '''map''' {{Z+|Z873}} * '''map(list, const)''': {{Z+|Z13464}} * '''map(const, list)''': {{Z+|Z13436}} * '''match tail''': {{Z+|Z16199}} * '''type''': {{Z+|Z18475}} === typed? === * '''concatenate''': {{Z+|Z18755}} * '''deduplicate''': {{Z+|Z19202}} * '''flatten''': {{Z+|Z23606}} * '''generate (natural number range)''': {{Z+|Z13831}} * '''reverse''': {{Z+|Z18479}} * '''untype''': {{Z+|Z17895}} == map functions == {{Z+|Z883}}<!--these don't seem to work at the moment--> * '''empty?''': {{Z+|Z24609}} * '''from list''': {{Z+|Z24646}} * '''get value''': {{Z+|Z24606}} * '''identity''': {{Z+|Z24603}} * '''map''': {{Z+|Z24608}} * '''parse JSON''': {{Z+|Z24602}} === returns (no map inputs) === * '''values of Object as map''': {{Z+|Z804}} == language == :''see also [[Wikifunctions:NLG functions|Natural language generation functions]], [[abstract:Abstract Wikipedia:Useful functions for article composition|Useful functions for article composition]]'' {|class=wikitable !A |adjective |- !C |class |- !N |noun |- !V |verb |} {|class=wikitable !sentence type !multilingual function !config !monolingual text !language parameter in English implementation |- |(a A N)||{{Z|Z22664}}||{{Z|Z21733}} |{{/no|2}} |{{/no|7}} |- |N is a C.||{{Z|Z26039}}||{{Z|Z26043}} |- |An N is a C.||{{Z|Z26095}}||{{Z|Z26096}} |{{/yes|3}} |- |N is a C in N.||{{Z|Z26570}}||{{Z|Z29843}} |- |Cs are Cs.||{{Z|Z26627}}||{{Z|Z27126}} |- |C is A C.||{{Z|Z27173}}||{{Z|Z29628}} |{{/no}} |- |N is the Aest C in N.||{{Z|Z27243}}||{{Z|Z29841}} |{{/yes|12}} |- |N is the N of N.||{{Z|Z28016}}||{{Z|Z28020}} |{{/yes|3}} |- |Ns are Ns of N.||{{Z|Z32326}}||{{Z|Z32255}} |- |Ns V Ns.||{{Z|Z32531}}||{{Z|Z32530}} |- |N is a C by N.||{{Z|Z32581}}||{{Z|Z32534}} |{{/no}} |- |N is a C and C. |rowspan=2|{{Z|Z32643}} |rowspan=2|{{Z|Z32660}} |{{/yes|5}} |- |N is a C, C, and C. |- |N Vs N.||{{Z|Z33185}}||{{Z|Z33184}} |- |N is a C from N.||{{Z|Z33975}}||{{Z|Z33981}} |- |N is the #th C by N.||{{Z|Z34253}}||{{Z|Z34255}} |- |N is a C. (automatic based on Wikidata class)||{{Z|Z34282}}||{{Z|Z34281}} |{{/no}} |- |N is a A N.||{{Z|Z29591}}||{{Z|Z29597}} |{{/yes}} |} == personal functions == * {{Z|Z24629}} * {{Z|Z24632}} * {{Z|Z24649}} * {{Z|Z24660}} * {{Z|Z24665}} * {{Z|Z33834}} * {{Z|Z33836}} * {{Z|Z33890}} * {{Z|Z35188}} * {{Z|Z35190}} * {{Z|Z35192}} * {{Z|Z35199}} === date/time === * {{Z+|Z23246}} * {{Z+|Z23783}} * {{Z+|Z23801}} * {{Z+|Z23808}} * {{Z+|Z23833}} * {{Z+|Z23865}} === [[Z1762|toki pona]] === : ''see [[Wikifunctions:Catalogue/Natural language operations/Toki Pona]]'' * {{Z|Z22455}} * {{Z|Z22571}} * {{Z|Z24721}} * {{Z|Z33828}} * {{Z|Z33831}} * {{Z|Z33873}} === infoboxes === * {{Z|Z35370}} ** {{Z|Z35167}} *** '''{{Z|Z35371}}''' *** '''implementations depend on these bespoke functions''' **** '''{{Z|Z35175}}''' **** {{Z|Z35176}} **** {{Z|Z35188}} ***** {{Z|Z35362}} **** {{Z|Z35192}} **** {{Z|Z35199}} **** {{Z|Z35374}} **** {{Z|Z35376}} ==== creation ==== * '''{{Z|Z35175}}''' * {{Z|Z35176}} == todo == * add toki pona to {{Z|Z33855}} * move certain uses of {{Z|Z10771}} to {{Z|Z34096}} * make sure English sentence generation functions have a language parameter to allow for rendering of certain words in e.g. British English (use {{Z|Z34039}}) ** {{Z|Z33059}} s4gcok54guw6s1z1mn42iyg0c1dtizz 276382 276282 2026-05-20T02:51:02Z Theki 2389 /* personal functions */ 276382 wikitext text/x-wiki * <div style="display:inline-block;background:#e5e5e5;aspect-ratio:1/1;width:10px;"></div> nonexistent but should logically exist * <div style="display:inline-block;background:#555;aspect-ratio:1/1;width:10px;"></div> shouldnt logically exist __TOC__ == data == === conversions === {| class="wikitable" ! style="line-height:1.2;padding:0.1em 0.4em;background:var(--background-color-neutral,#eaecf0);background-image:linear-gradient(to top right,var(--background-color-neutral,#eaecf0) 49%,var(--border-color-base,#a2a9b1) 49.5%,var(--border-color-base,#a2a9b1) 50.5%,var(--background-color-neutral,#eaecf0) 51%);" | <div style="margin-left:2em;">from</div><div style="margin-right:2em;">to</div> ! [[Z40|boolean]] !! [[Z20838|float64]]!! [[Z16683|integer]] !! [[Z13518|natural number]] ![[Z19677|rational number]]!! [[Z6|string]] |- ! scope = "row" | boolean | [[Z10215|Z​10215]] | colspan="5" style="text-align:center;" | [[Z15684|Z​15684]] |- ! scope="row" | float64 | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="3" style="background:#e5e5e5;border:0;" | | [[Z20937|Z​20937]] | [[Z20936|Z​20936]] | [[Z20854|Z​20854]] | [[Z20915|Z​20915]] |- ! scope="row" | integer | style="background:#e5e5e5;border:0;" | | [[Z17101|Z​17101]] | [[Z19682|Z​19682]] | base n: [[Z18467|Z​18467]]<br>base 10: [[Z16705|Z​16705]] |- ! scope = "row" | natural number | [[Z17065|Z​17065]] | [[Z20391|Z​20391]] | [[Z13636|Z​13636]] | style="background:#e5e5e5;border:0;" | | base n: [[Z13806|Z​13806]]<br>base 10: [[Z14290|Z​14290]] |- !rational number | style="background:#e5e5e5;border:0;" | | [[Z21071|Z​21071]] | [[Z19744|Z​19744]] | [[Z21653|Z​21653]] | [[Z20112|Z​20112]] | [[Z19866|Z​19866]] |- ! scope = "row" | string | [[Z10730|Z​10730]] |[[Z20844|Z​20844]] | base n: [[Z18592|Z​18592]]<br>base 10: [[Z16700|Z​16700]] | base n: [[Z15671|Z​15671]]<br>base 10: [[Z14280|Z​14280]] | [[Z19827|Z​19827]] | [[Z11602|Z​11602]] |} * [[Z17352|(int as nat)]] * [[Z17355|(nat as int)]] * [[Z21402|(rat as f64)]] === operations === {| class="wikitable" ! !! float64!! integer !! natural number !rational number!! string !! list |- ! scope = "row" | == |same value: [[Z20924|Z​20924]]<br>same object: [[Z20850|Z​20850]] | [[Z16688|Z​16688]] || [[Z13522|Z​13522]] |same value: [[Z19686|Z​19686]]<br>same object: [[Z19892|Z​19892]] | [[Z866|Z​866]] | [[Z889|Z​889]] |- !> | [[Z20943|Z​20943]] | [[Z17132|Z​17132]] | [[Z13676|Z​13676]] | [[Z19751|Z​19751]] | rowspan="4" style="background:#555;border:0;" | | rowspan="4" style="background:#555;border:0;" | |- !< | [[Z20940|Z​20940]] | [[Z17140|Z​17140]] | [[Z13689|Z​13689]] | [[Z19753|Z​19753]] |- !>= | [[Z20944|Z​20944]] | [[Z17173|Z​17173]] | [[Z13682|Z​13682]] | [[Z19752|Z​19752]] |- !<= | [[Z20941|Z​20941]] | [[Z17363|Z​17363]] | [[Z13695|Z​13695]] | [[Z19754|Z​19754]] |- ! scope="row" | + |[[Z20849|Z​20849]]|| [[Z16693|Z​16693]] || [[Z13521|Z​13521]] |[[Z19679|Z​19679]]|| [[Z10000|Z​10000]] || typed: [[Z12961|Z​12961]]<br>untyped: [[Z18597|Z​18597]] |- ! scope = "row" | − |[[Z21031|​Z​21031]] | [[Z17111|Z​17111]] || as integer: [[Z17315|Z​17315]] <br>as natural number: [[Z13569|Z​13569]] |[[Z19699|Z​19699]]|| rowspan="9" style="background:#555;border:0;" | || first: [[Z812|Z​812]]<br>last: [[Z12967|Z​12967]] |- ! scope = "row" | × | [[Z21032|Z​21032]] | [[Z17120|Z​17120]] || [[Z13539|Z​13539]] | [[Z19706|Z​19706]] | rowspan="8" style="background:#555;border:0;" | |- ! scope = "row" | ÷ | [[Z21033|Z​21033]] | [[Z17291|Z​17291]] || [[Z13546|Z​13546]] | [[Z19708|Z​19708]] |- ! scope = "row" | % | [[Z22236|Z​22236]] | [[Z17167|Z​17167]] || [[Z13551|Z​13551]] | [[Z20006|Z​20006]] |- !>> | rowspan="2" style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | | [[Z13813|Z​13813]] | rowspan="2" style="background:#e5e5e5;border:0;" | |- !<< | [[Z13812|Z​13812]] |- ! scope = "row" | abs | [[Z21041|Z​21041]] | as integer: [[Z17128|Z​17128]]<br>as natural number: [[Z17144|Z​17144]] || style="background:#555;border:0;" | | [[Z21692|Z​21692]] |- !pow | [[Z21028|Z​21028]] | [[Z17263|Z​17263]] | [[Z13647|Z​13647]] | [[Z19953|Z​19953]] |- !sqrt |[[Z22600|Z​22600]] |[[Z24591|Z​24591]] |[[Z15256|Z​15256]] |[[Z20902|Z​20902]] |} === boolean operations === {| class="wikitable" ! !! [[Z40|boolean]] (tf) !! [[Z22112|kleenean]] (mtf) !! bitwise |- ! scope = "row" | [[w:Logical conjunction|AND]] | [[Z10174|Z​10174]] | [[Z22143|Z​22143]] | natural number: [[Z13651|Z​13651]] |- ! scope = "row" | [[w:Logical disjunction|OR]] | [[Z10184|Z​10184]] | [[Z22168|Z​22168]] | natural number: [[Z13652|Z​13652]] |- ! scope = "row" | [[w:Negation|NOT]] | [[Z10216|Z​10216]] | [[Z22207|Z​22207]] | byte: [[Z22529|Z​22529]]<br>integer: [[Z17794|Z​17794]] |- ! scope = "row" | [[w:Sheffer stroke|NAND]] | [[Z10243|Z​10243]] | [[Z24749|Z​24749]] | byte: [[Z24716|Z​24716]] |- ! scope = "row" | [[w:Exclusive or|XOR]] (≠) | [[Z10237|Z​10237]] | [[Z22231|Z​22231]] | natural number: [[Z13653|Z​13653]] |- ! scope = "row" | [[w:Logical NOR|NOR]] | [[Z10231|Z​10231]] | style="background:#e5e5e5;border:0;" | | rowspan="2" style="background:#e5e5e5;border:0;" | |- ! scope = "row" | [[w:Logical biconditional|XNOR]] (=) | [[Z844|Z​844]] | [[Z22120|Z​22120]] |} == list functions == {{Z+|Z881}} * '''generate (range)''': {{Z+|Z21821}} * '''generate (replicated object)''': {{Z+|Z21389}} * '''map''' {{Z+|Z873}} * '''map(list, const)''': {{Z+|Z13464}} * '''map(const, list)''': {{Z+|Z13436}} * '''match tail''': {{Z+|Z16199}} * '''type''': {{Z+|Z18475}} === typed? === * '''concatenate''': {{Z+|Z18755}} * '''deduplicate''': {{Z+|Z19202}} * '''flatten''': {{Z+|Z23606}} * '''generate (natural number range)''': {{Z+|Z13831}} * '''reverse''': {{Z+|Z18479}} * '''untype''': {{Z+|Z17895}} == map functions == {{Z+|Z883}}<!--these don't seem to work at the moment--> * '''empty?''': {{Z+|Z24609}} * '''from list''': {{Z+|Z24646}} * '''get value''': {{Z+|Z24606}} * '''identity''': {{Z+|Z24603}} * '''map''': {{Z+|Z24608}} * '''parse JSON''': {{Z+|Z24602}} === returns (no map inputs) === * '''values of Object as map''': {{Z+|Z804}} == language == :''see also [[Wikifunctions:NLG functions|Natural language generation functions]], [[abstract:Abstract Wikipedia:Useful functions for article composition|Useful functions for article composition]]'' {|class=wikitable !A |adjective |- !C |class |- !N |noun |- !V |verb |} {|class=wikitable !sentence type !multilingual function !config !monolingual text !language parameter in English implementation |- |(a A N)||{{Z|Z22664}}||{{Z|Z21733}} |{{/no|2}} |{{/no|7}} |- |N is a C.||{{Z|Z26039}}||{{Z|Z26043}} |- |An N is a C.||{{Z|Z26095}}||{{Z|Z26096}} |{{/yes|3}} |- |N is a C in N.||{{Z|Z26570}}||{{Z|Z29843}} |- |Cs are Cs.||{{Z|Z26627}}||{{Z|Z27126}} |- |C is A C.||{{Z|Z27173}}||{{Z|Z29628}} |{{/no}} |- |N is the Aest C in N.||{{Z|Z27243}}||{{Z|Z29841}} |{{/yes|12}} |- |N is the N of N.||{{Z|Z28016}}||{{Z|Z28020}} |{{/yes|3}} |- |Ns are Ns of N.||{{Z|Z32326}}||{{Z|Z32255}} |- |Ns V Ns.||{{Z|Z32531}}||{{Z|Z32530}} |- |N is a C by N.||{{Z|Z32581}}||{{Z|Z32534}} |{{/no}} |- |N is a C and C. |rowspan=2|{{Z|Z32643}} |rowspan=2|{{Z|Z32660}} |{{/yes|5}} |- |N is a C, C, and C. |- |N Vs N.||{{Z|Z33185}}||{{Z|Z33184}} |- |N is a C from N.||{{Z|Z33975}}||{{Z|Z33981}} |- |N is the #th C by N.||{{Z|Z34253}}||{{Z|Z34255}} |- |N is a C. (automatic based on Wikidata class)||{{Z|Z34282}}||{{Z|Z34281}} |{{/no}} |- |N is a A N.||{{Z|Z29591}}||{{Z|Z29597}} |{{/yes}} |} == personal functions == * {{Z|Z24629}} * {{Z|Z24632}} * {{Z|Z24649}} * {{Z|Z24660}} * {{Z|Z24665}} * {{Z|Z33834}} * {{Z|Z33836}} * {{Z|Z33890}} * {{Z|Z35188}} * {{Z|Z35190}} * {{Z|Z35192}} * {{Z|Z35199}} * {{Z|Z35418}} === date/time === * {{Z+|Z23246}} * {{Z+|Z23783}} * {{Z+|Z23801}} * {{Z+|Z23808}} * {{Z+|Z23833}} * {{Z+|Z23865}} === [[Z1762|toki pona]] === : ''see [[Wikifunctions:Catalogue/Natural language operations/Toki Pona]]'' * {{Z|Z22455}} * {{Z|Z22571}} * {{Z|Z24721}} * {{Z|Z33828}} * {{Z|Z33831}} * {{Z|Z33873}} === infoboxes === * {{Z|Z35370}} ** {{Z|Z35167}} *** '''{{Z|Z35371}}''' *** '''implementations depend on these bespoke functions''' **** '''{{Z|Z35175}}''' **** {{Z|Z35176}} **** {{Z|Z35188}} ***** {{Z|Z35362}} **** {{Z|Z35192}} **** {{Z|Z35199}} **** {{Z|Z35374}} **** {{Z|Z35376}} ==== creation ==== * '''{{Z|Z35175}}''' * {{Z|Z35176}} == todo == * add toki pona to {{Z|Z33855}} * move certain uses of {{Z|Z10771}} to {{Z|Z34096}} * make sure English sentence generation functions have a language parameter to allow for rendering of certain words in e.g. British English (use {{Z|Z34039}}) ** {{Z|Z33059}} ixk7j8w3cl7e1x0rgyu6jeu2vq3uva2 Wikifunctions:Support for Wikidata content/ar 4 48115 276490 262459 2026-05-20T06:21:45Z FuzzyBot 207 Updating to match new version of source page 276490 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions provides support for retrieving and using Wikidata content, including encyclopedic content contained primarily in ''Items'' and lexicographic content contained in ''Lexemes, Lexeme forms'', and ''Lexeme senses''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Documentation of Wikidata's lexicographic types can be found at [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Implemented support currently includes: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank''</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''reference types'' corresponding to the 5 entity types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # <span lang="en" dir="ltr" class="mw-content-ltr">User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology notes''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </div> * [[Z6005|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] * [[Z6004|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] * [[Z6006|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] * [[Z6003|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement</span></u>]] * [[Z6002|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] * [[Z6001|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement rank</span></u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[Z6040|<u>Wikidata statement rank</u>]] and [[Z6020|<u>Wikidata claim subtype</u>]]). </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Example === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An instance of [[Z6005|<u>Wikidata lexeme</u>]] has these 7 parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lemmas, with a value of type [[Z12|Multilingual text]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata reference types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example uses''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Selectors === </div> [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u>عنصر ويكي بيانات</u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u>استعلام ويكي بيانات</u>]] ** العرض والمرشح: متاح <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] r5auzxzwlrk2qguq1z2x25yqr5i887z Category:Status updates/ja 14 49835 276552 166216 2026-05-20T06:24:46Z FuzzyBot 207 Updating to match new version of source page 276552 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Z22683 0 50996 276573 272771 2026-05-20T07:17:49Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276573 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z22683" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z86", "Z17K2": "Z22683K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "this" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "première saisie" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Mbụ" }, { "Z1K1": "Z11", "Z11K1": "Z1381", "Z11K2": "esse" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z86", "Z17K2": "Z22683K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "that" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "seconde saisie" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Nke abụọ" }, { "Z1K1": "Z11", "Z11K1": "Z1381", "Z11K2": "aquele" } ] } } ], "Z8K2": "Z40", "Z8K3": [ "Z20", "Z22684", "Z22685", "Z22686", "Z22687", "Z22688", "Z22689", "Z22690" ], "Z8K4": [ "Z14", "Z34895", "Z22691", "Z22692" ], "Z8K5": "Z22683" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Code point equality" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "égalité des points de code" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "Usoro akara nha nhata" }, { "Z1K1": "Z11", "Z11K1": "Z1157", "Z11K2": "codepuntgelijkheid" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Codepunkt-Gleichheit" }, { "Z1K1": "Z11", "Z11K1": "Z1381", "Z11K2": "Igualdade de ponto de código" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "Unicode code point equals other", "same Unicode code point as other" ] }, { "Z1K1": "Z31", "Z31K1": "Z1381", "Z31K2": [ "Z6", "igual a", "mesmo que" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "tests whether two code-point realisations (as entered) have identical Unicode code-point representations" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "vérifie si deux réalisations de points de code (telles que saisies) ont des représentations de points de code Unicode strictement identiques" }, { "Z1K1": "Z11", "Z11K1": "Z1014", "Z11K2": "na-anwale ma njirimara koodu abụọ (dị ka etinyere) nwere ihe nnochite anya koodu Unicode" }, { "Z1K1": "Z11", "Z11K1": "Z1381", "Z11K2": "testa se os dois pontos de código inseridos possuem uma representação Unicode idêntica" } ] } } 1b55yu5pc38bgq7yg5h1g2on06onaxf Wikifunctions:Support for Wikidata content/pl 4 52215 276497 262466 2026-05-20T06:21:52Z FuzzyBot 207 Updating to match new version of source page 276497 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions provides support for retrieving and using Wikidata content, including encyclopedic content contained primarily in ''Items'' and lexicographic content contained in ''Lexemes, Lexeme forms'', and ''Lexeme senses''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Documentation of Wikidata's lexicographic types can be found at [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Implemented support currently includes: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank''</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''reference types'' corresponding to the 5 entity types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # <span lang="en" dir="ltr" class="mw-content-ltr">User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology notes''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </div> * [[Z6005|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] * [[Z6004|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] * [[Z6006|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] * [[Z6003|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement</span></u>]] * [[Z6002|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] * [[Z6001|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement rank</span></u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[Z6040|<u>Wikidata statement rank</u>]] and [[Z6020|<u>Wikidata claim subtype</u>]]). </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Example === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An instance of [[Z6005|<u>Wikidata lexeme</u>]] has these 7 parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lemmas, with a value of type [[Z12|Multilingual text]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata reference types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example uses''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <span id="Wikidata_search_functions"></span> == Funkcje wyszukiwania w Wikidanych == <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <span id="Function:_Find_lexemes_for_an_item"></span> === Funkcja: [[Z6830|<u>Znajdź leksemy dla elementu</u>]] === * Typy argumentów: [[Z6091|<u>Odwołanie do elementu Wikidata</u>]], [[Z6092|<u>Odwołanie do właściwości Wikidanych</u>]], [[Z60|<u>Język naturalny</u>]] * Typ zwracanej wartości: Lista [[Z6095|<u>odwołań do leksemów Wikidanych</u>]] Wikidane rejestrują przydatne relacje między sensami leksemów (które reprezentują znaczenia leksemu) a elementami. Obejmują one: * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * [[d:Property:P9970|predykat dla]], łączący czasownik z czynnością lub wydarzeniem * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Selectors === </div> [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> '''Niezgodność statusu'''. Chociaż funkcja pobierania jest dostępna dla [[Z6826|<u>leksemu Wikidanych</u>]], selektor dla tego typu nie jest jeszcze dostępny. <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] 8nyi3l4elxvxal1ssxry00bovs8tyrf Wikifunctions:Support for Wikidata content/uk 4 53158 276499 262935 2026-05-20T06:21:54Z FuzzyBot 207 Updating to match new version of source page 276499 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} Вікіфункції забезпечують підтримку для отримання та використання вмісту Вікіданих, включаючи енциклопедичний вміст, що міститься переважно в ''елементах'', та лексикографічний вміст, що міститься в ''лексемах, формах лексем'' і ''смислах лексем''. Оскільки екземпляри цих чотирьох типів вмісту можуть містити ''твердження'', Вікіфункції також включають підтримку ''тверджень'' і їхніх компонентів, включаючи ''властивості'', ''ранги тверджень'', ''кваліфікатори'' та (незабаром) ''посилання''. Документація щодо лексикографічних типів Вікіданих доступна на [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|Вікідані:Лексикографічні дані/Документація]], а документація інших типів Вікіданих — на [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]] '''Термінологічна примітка''': На Вікіданих ''Елемент'' (Item), ''Властивість'' (Property), ''Лексема'' (Lexeme), ''Форма лексеми'' (Lexeme form) та ''Смисл лексеми'' (Lexeme sense) є типами ''сутностей'' (entities), тому ми посилаємось на них як на ''типи сутностей'' (entity types). Реалізована підтримка наразі включає: # Вбудовані типи, що відповідають 5 типам сутностей, ''Твердженню'' (Statement) та ''Рангу твердження'' (Statement rank). # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''reference types'' corresponding to the 5 entity types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # <span lang="en" dir="ltr" class="mw-content-ltr">User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</span> '''Термінологічні примітки''': * <span lang="en" dir="ltr" class="mw-content-ltr">We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. </div> <span id="Wikidata_types"></span> == Типи Вікіданих == Було визначено такі типи, структура яких тісно пов'язана зі структурою відповідних типів у Вікіданих: * [[Z6005|<u>Лексема Вікіданих</u>]] * [[Z6004|<u>Форма лексеми Вікіданих</u>]] * [[Z6006|<u>Смисл лексеми Вікіданих</u>]] * [[Z6003|<u>Твердження Вікіданих</u>]] * [[Z6002|<u>Властивість Вікіданих</u>]] * [[Z6001|<u>Елемент Вікіданих</u>]] * [[Z6040|<u>Ранг твердження Вікіданих</u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> Примірники цих типів ніколи не зберігаються на постійній основі у Вікіфункціях (за винятком примірників [[Z6040|<u>рангу твердження Вікіданих</u>]] і [[Z6020|<u>підтипу заяви Вікіданих</u>]]). Вони створюються динамічно, за потреби, з використанням вмісту, отриманого безпосередньо з Вікіданих. Примірники типів сутностей містять у собі ідентифікатор сутності Вікіданих, з якої їх отримано. <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). </div> <span id="Example"></span> === Приклад === Екземпляр [[Z6005|<u>лексеми Вікіданих</u>]] має такі 7 частин: # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # леми (lemmas), із значенням типу [[Z12|Багатомовний текст]] # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata reference types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example uses''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Selectors === </div> [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] 01d35q39i9w6n5lt3ljj89f02xzippx Wikifunctions:How to create implementations/pa 4 53431 276455 240257 2026-05-20T06:15:41Z FuzzyBot 207 Updating to match new version of source page 276455 wikitext text/x-wiki <languages/> ਇਹ ਵਰਕਾ {{ll|Wikifunctions:Introduction}} 'ਤੇ ਸੰਖੇਪ ਜਾਣਕਾਰੀ ਤੋਂ ਪਰੇ, '''ਅਮਲ-ਲਿਆਉਣਾ ਬਣਾਉਣ''' ਲਈ ਵਧੇਰੇ ਵੇਰਵੇ ਨਾਲ ਦਸਤੀ ਦੇਂਦਾ ਏ। <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> ਇਸ ਭਾਗ ਵਿੱਚ, ਅਸੀਂ ਪਾਈਥਨ ਵਿੱਚ ਕੋਡ ਦੇ ਰੂਪ ਵਿੱਚ ਇੱਕ ਅਮਲ-ਲਿਆਉਣਾ ਕਿਵੇਂ ਬਣਾਇਆ ਜਾਵੇ ਇਸ ਬਾਰੇ ਇੱਕ ਠੋਸ ਉਦਾਹਰਣ ਦਿੰਦੇ ਹਾਂ। ਮੰਨ ਲਓ ਕਿ ਅਸੀਂ ਇੱਕ ਕਾਰਜ਼ ਲਈ ਇੱਕ ਅਮਲ-ਲਿਆਉਣਾ ਬਣਾਉਣਾ ਚਾਹੁੰਦੇ ਹਾਂ ਜੋ ਦੋ input ਸਤਰ ਨੂੰ ਉਹਨਾਂ ਵਿਚਕਾਰ ਖਾਲੀ ਥਾਂ ਦੇ ਨਾਲ ਜੋੜਦਾ ਹੈ ਅਤੇ ਉਹਨਾਂ ਦਾ ਨਤੀਜਾ ਵਾਪਸ ਕਰਦਾ ਹੈ। ਮੰਨ ਲਓ ਕਿ Z11057 ਉਸ ਕਾਰਜ਼ ਦਾ ZID ਏ। </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <span id="Compositions"></span> <div class="mw-translate-fuzzy"> == ਬਣਤਰ == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] tuss223j4qi0gcjr4va2t7hmm0zz90r Wikifunctions:Tools/pa 4 53537 276511 239975 2026-05-20T06:23:00Z FuzzyBot 207 Updating to match new version of source page 276511 wikitext text/x-wiki <languages/> ਇਹ ਵਰਕਾ ਉਹਨਾਂ ਸਾਧਨਾਂ ਦੀ ਸੂਚੀ ਹੈ ਜਿਨ੍ਹਾਂ ਦੀ ਵਰਤੋਂ ਤੁਸੀਂ ਵਿਕੀਕਾਰਜ਼ ਨਾਲ ਵਧੇਰੇ ਤੇਜ਼ੀ ਅਤੇ ਆਰਾਮ ਨਾਲ ਕੰਮ ਕਰਨ ਲਈ ਕਰ ਸਕਦੇ ਹੋ। ਜੇ ਤੁਸੀਂ ਕੋਈ ਲਿਪੀ ਲਿਖੀ ਹੈ, ਤਾਂ ਇਸ ਨੂੰ ਸ਼ਾਮਲ ਕਰਨ ਲਈ ਅਜ਼ਾਦ ਮਹਿਸੂਸ ਕਰੋ ਤਾਂ ਜੋ ਦੂਜੇ ਇਸ ਦੀ ਵਰਤੋਂ ਕਰ ਸਕਣ। <div lang="en" dir="ltr" class="mw-content-ltr"> == Dump related tools == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[https://github.com/marius851000/wikifunction_intepreter experimental Wikifunction Rust interpreter] that work on the dump. Written in Rust.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Wikifunctions:Tools/wf-dump-scripts|wf-dump-scripts]] - pipeline for creating statistical wikitables based on dump and the internal Wikifunctions API. Written in [[w:Python (programming language)|Python]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[//wf-query.replit.app wf-query]: tool that allows you to run JSONata queries on a dump of Wikifunctions, with the table output itself also being customizable with JSONata queries. Written in [[w:Node.js|NodeJS]] Express and [[w:JavaScript|vanilla JS]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl Dumpextract]: a program to extract info from the dump of Wikifunctions. Written in [[w:COBOL|COBOL]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[https://github.com/99of9/WikifunctionsAnalysis WikifunctionsAnalysis]: some code which helps analyse Wikifunctions dumps</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[User:Amire80/wikifunctionsanalytics#Example_queries|wikifunctionsanalytics]]: A simplified dump, queryable through [[meta:Special:MyLanguage/Research:Quarry|Quarry]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[toolforge:abstract-data/functions]]: Tracking Function usage on [[abstract:|Abstract Wikipedia]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> *[[User:Feeglgeef/wikilambda editsource.js|wikilambda editsource.js]]: ਵਰਤੋਂਕਾਰ ਲਿਪੀ ਜੋ ਤੁਹਾਨੂੰ ZObjects ਦੀ ਕੱਚੀ JSON ਸਮੱਗਰੀ ਨੂੰ ਸੋਧਣ ਦੀ ਆਗਿਆ ਦਿੰਦੀ ਏ। * <span lang="en" dir="ltr" class="mw-content-ltr">[https://yoshirulz.gitlab.io/WikiLambdaBlockly WikiLambdaBlockly]: Web app demonstrating a block-based editing interface for compositions. Uses [[w:Blockly|Blockly]] from [[w:TypeScript|TS]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Others == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3 find constants]: tool that represents a f64 using Wikifunctions representation. Prints, comma separated, the sign of the float (-1, 0, 1), the exponent of the float, and the fraction of the float. Written in [[w:Rust (programming language)|Rust]].</span> [[Category:Project{{#translation:}}]] t5ljga2pd95mw006g9rezrggzc0ciih Category:Status updates/ko 14 54640 276553 180303 2026-05-20T06:24:47Z FuzzyBot 207 Updating to match new version of source page 276553 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Human languages/ko 4 55612 276472 270541 2026-05-20T06:17:05Z FuzzyBot 207 Updating to match new version of source page 276472 wikitext text/x-wiki <languages/> {{draft}} <div lang="en" dir="ltr" class="mw-content-ltr"> Supported by the Natural Language Generation Special Interest Group; see also {{ll|WF:PROG}} and {{ll|WF:Catalogue/Natural language operations}}. Many of these are morphological functions; morphology is the part of linguistics that studies how language parts are 'shaped' and change diachronically and when inflected. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Hausa, Igbo, Malayalam, Bangla/Bengali and Dagbani are [[d:Special:MyLanguage/Wikidata:Lexicographical data/Focus languages|focus languages]] for Wikidata's lexicographic dataset, which is an important aspect of [[Special:MyLanguage/WF:glossary#Abstract Wikipedia|Abstract Wikipedia]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Related pages == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[:Category:Natural languages]] — List of categories for languages</span> * <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:Catalogue/Natural language operations}} — Lists of natural language functions</span> * <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:NLG functions}} — A table of each supported language's NLG functions</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:Cardinal numbers}} — List of each language's cardinal number functions</span> * <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:Reserved ZIDs/all#Z1000-Z1999}} — List of all languages in ZObject order</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Afroasiatic == </div> * {{z+|Z1472}} (zgh) — [[/Z1472]] * {{z+|Z1013}} (ha) — [[/Z1013]] * <span lang="en" dir="ltr" class="mw-content-ltr">Semitic</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Arabic</span> *** {{z+|Z1001}} (ar) — [[/Z1001]] *** {{z+|Z1045}} (ary) — [[/Z1045]] *** {{z+|Z1582}} (aeb) — [[/Z1582]] ** {{z+|Z1186}} (he) — [[/Z1186]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Austroasiatic == </div> * {{z+|Z1048}} (vi) — [[/Z1048]] * (<span lang="en" dir="ltr" class="mw-content-ltr">Mundari, no code yet</span>) (unr) <div lang="en" dir="ltr" class="mw-content-ltr"> == Austronesian == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Malayic</span> ** {{z+|Z1531}} (ms) — [[/Z1531]] *** {{z+|Z1434}} (ms-arab) — [[/Z1434]] ** {{z+|Z1078}} (id) — [[/Z1078]] * {{z+|Z1471}} (su) — [[/Z1471]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Constructed == </div> * {{z+|Z1882}} (ldn) — [[/Z1882]] * {{z+|Z1576}} (eo) — [[/Z1576]] * {{z+|Z1534}} (tlh) — [[/Z1534]] * {{z+|Z1762}} (tok) — [[/Z1762]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Dravidian == </div> * {{z+|Z1293}} (brh) — [[/Z1293]] * <span lang="en" dir="ltr" class="mw-content-ltr">South</span> ** {{z+|Z1012}} (ml) — [[/Z1012]] ** {{z+|Z1429}} (te) — [[/Z1429]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Indo-European == </div> * {{z+|Z1541}} (hy) — [[/Z1541]] * <span lang="en" dir="ltr" class="mw-content-ltr">Balto-Slavic</span> ** {{z+|Z1709}} (lv) — [[/Z1709]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Slavic</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">East Slavic</span> **** {{z+|Z1005}} (ru) — [[/Z1005]] **** {{z+|Z1332}} (uk) — [[/Z1332]] **** {{z+|Z1622}} (by) — [[/Z1622]] *** <span lang="en" dir="ltr" class="mw-content-ltr">West Slavic</span> **** {{z+|Z1062}} (cs) — [[/Z1062]] **** {{z+|Z1025}} (pl) — [[/Z1025]] **** {{z+|Z1488}} (sk) — [[/Z1488]] *** <span lang="en" dir="ltr" class="mw-content-ltr">South Slavic</span> **** {{z+|Z1823}} (bg) — [[/Z1823]] **** {{z+|Z1105}} (cu) — [[/Z1105]] **** {{z+|Z1412}} (sh) — [[/Z1412]] ***** {{z+|Z1473}} (bs) — [[/Z1473]] ***** {{z+|Z1272}} (hr) — [[/Z1272]] ***** {{z+|Z1498}} (cnr) — [[/Z1498]] ***** {{z+|Z1158}} (sr) — [[/Z1158]] **** {{z+|Z1616}} (sl) — [[/Z1616]] * <span lang="en" dir="ltr" class="mw-content-ltr">Celtic</span> ** {{z+|Z1282}} (br) — [[/Z1282]] ** {{z+|Z1024}} (cy) — [[/Z1024]] ** {{z+|Z1339}} (gd) — [[/Z1282]] * <span lang="en" dir="ltr" class="mw-content-ltr">Germanic</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">North Germanic</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">East Scandinavian</span> **** {{z+|Z1061}} (dk) — [[/Z1061]] **** {{z+|Z1592}} (sv) — [[/Z1592]] *** {{z+|Z1021}} (no) — [[/Z1592]] ** <span lang="en" dir="ltr" class="mw-content-ltr">West Germanic</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">North Sea</span> **** {{z+|Z1002}} (en) — [[/Z1002]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">North American</span> ****** {{z+|Z1689}} (en-US) — [[/Z1689]] ****** {{z+|Z1437}} (en-CA) — [[/Z1437]] ***** {{z+|Z1113}} (en-AU) — [[/Z1113]] ***** {{z+|Z1199}} (en-GB) — [[/Z1199]] ***** {{z+|Z1966}} (en-IN) — [[/Z1966]] ***** {{z+|Z1881}} (en-x-piglatin) — [[/Z1881]] ***** {{z+|Z1124}} (en-x-simple) — [[/Z1124]] **** {{z+|Z1146}} (nds) — [[/Z1146]] *** <span lang="en" dir="ltr" class="mw-content-ltr">High German</span> **** {{z+|Z1099}} (lb) — [[/Z1099]] **** {{z+|Z1430}} (de) — [[/Z1430]] *** {{z+|Z1157}} (nl) — [[/Z1157]] * {{z+|Z1827}} (el) — [[/Z1827]] * <span lang="en" dir="ltr" class="mw-content-ltr">Indo-Iranian</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Indo-Aryan</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Hindustani</span> **** {{z+|Z1820}} (hi) — [[/Z1820]] **** {{z+|Z1717}} (ur) — [[/Z1717]] *** <span lang="en" dir="ltr" class="mw-content-ltr">Northwestern</span> **** <span lang="en" dir="ltr" class="mw-content-ltr">Punjabic</span> ***** {{z+|Z1657}} (pa) — [[/Z1657]] ***** {{z+|Z1083}} (pnb) — [[/Z1083]] **** {{z+|Z1191}} (sd) — [[/Z1191]] *** <span lang="en" dir="ltr" class="mw-content-ltr">Eastern</span> **** {{z+|Z1011}} (bn) — [[/Z1011]] **** <span lang="en" dir="ltr" class="mw-content-ltr">Rohingya</span> (rhg) ***** {{z+|Z1978}} (rhg-rohg) — [[/Z1978]] ***** {{z+|Z1979}} (rhb-arab) — [[/Z1979]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Iranian</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Northwestern</span> **** {{z+|Z1747}} (bal) — [[/Z1747]] **** {{z+|Z1556}} (ku) — [[/Z1556]] ***** {{z+|Z1288}} (ckb) — [[/Z1288]] *** {{z+|Z1728}} (fa) — [[/Z1728]] **** {{z+|Z1207}} (tg) — [[/Z1207]] **** {{z+|Z1265}} (fa-AF / prs) — [[/Z1265]] **** {{z+|Z1277}} (jpr) — [[/Z1277]] * <span lang="en" dir="ltr" class="mw-content-ltr">Italic</span> ** {{z+|Z1403}} (la) — [[/Z1403]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Romance</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Continental Romance</span> **** <span lang="en" dir="ltr" class="mw-content-ltr">Western Romance</span> ***** <span lang="en" dir="ltr" class="mw-content-ltr">Ibero-Romance</span> ****** {{z+|Z1037}} (pt) — [[/Z1037]] ******* {{z+|Z1381}} (pt-BR) — [[/Z1381]] ****** {{z+|Z1003}} (es) — [[/Z1003]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">Occitano-Romance</span> ****** {{z+|Z1789}} (ca) — [[/Z1789]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">North Gallo-Romance</span> ****** {{z+|Z1004}} (fr) — [[/Z1004]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">North Italian</span> ****** {{Z+|Z1363}} (vec) — [[/Z1363]] ****** {{z+|Z1483}} (lad) — [[/Z1483]] **** <span lang="en" dir="ltr" class="mw-content-ltr">South Romance</span> ***** {{z+|Z1787}} (it) — [[/Z1787]] ***** {{z+|Z1329}} (co) — [[/Z1329]] ***** {{z+|Z1082}} (sdc) — [[/Z1082]] ***** {{z+|Z1491}} (nap) — [[/Z1491]] ***** {{z+|Z1298}} (scn) — [[/Z1298]] **** <span lang="en" dir="ltr" class="mw-content-ltr">Balkan romance</span> ***** {{z+|Z1664}} (ro) — [[/Z1664]] *** <span lang="en" dir="ltr" class="mw-content-ltr">Island Romance</span> **** {{z+|Z1342}} (sc) — [[/Z1342]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Kra-Dai == </div> * {{z+|Z1851}} (th) — [[/Z1851]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Niger-Congo == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Atlantic-Congo</span> ** {{z+|Z1015}} (dag) — [[/Z1015]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Volta-Congo</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Volta-Niger</span> **** {{z+|Z1014}} (ig) — [[/Z1014]] **** {{z+|Z1818}} (ya) — [[/Z1818]] *** {{z+|Z1179}} (kcg) — [[/Z1179]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Mixed and creoles == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These languages are sorted under the language it is primarily based on. </div> * {{Z|Z1531}} ** {{z+|Z1630}} (bew) — [[/Z1630]] * {{Z|Z1037}} ** {{z+|Z1806}} (kea) — [[/Z1806]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Sign == </div> * {{z+|Z1763}} (ase) — [[/Z1763]] * {{z+|Z1907}} (bzs) - [[/Z1907]] * {{z+|Z}}{{q|2107617}} (vgt) - [[/vgt]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Sino-Tibetan == </div> * {{z+|Z1147}} (dz) — [[/Z1147]] * <span lang="en" dir="ltr" class="mw-content-ltr">Sinitic</span> ** {{z+|Z1006}} (zh) — [[/Z1006]] *** {{z+|Z1645}} (zh-hans) — [[/Z1645]] **** {{z+|Z1411}} (zh-CN) — [[/Z1411]] *** {{z+|Z1672}} (zh-hant) — [[/Z1672]] **** {{z+|Z1589}} (zh-HK) — [[/Z1589]] ** {{z+|Z1202}} (zh-yue) — [[/Z1202]] *** {{z+|Z1901}} (yue-hans) — [[/Z1901]] *** {{z+|Z1902}} (yue-hant) — [[/Z1902]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Turkic == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Oghuz</span> ** {{z+|Z1237}} (tr) — [[/Z1237]] ** {{z+|Z1597}} (az) — [[/Z1597]] * {{z+|Z1120}} (uz) — [[/Z1120]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Uralic == </div> * {{z+|Z1051}} (fi) — [[/Z1051]] * {{z+|Z1513}} (hu) — [[/Z1513]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Isolates and smaller families == </div> * {{z+|Z1314}} (eu) — [[/Z1314]] * {{z+|Z1830}} (ja) — [[/Z1830]] ** {{z+|Z1444}} (ja-hkrt) — [[/Z1444]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Japanese rōmaji, no ZObject</span> (ja-latn) * {{z+|Z1643}} (ko) — [[/Z1643]] * {{z+|Z1678}} (qu) — [[/Z1678]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Other == </div> * {{z+|Z1360}} (mul) — [[/Z1360]] [[Category:Natural languages| mul]] [[Category:WikiProjects]] mnpb39hjr8v06y8i40be4ysq0fy94z1 Wikifunctions:Tools/ko 4 55660 276508 239974 2026-05-20T06:22:57Z FuzzyBot 207 Updating to match new version of source page 276508 wikitext text/x-wiki <languages/> 이 문서는 위키함수를 더 빠르고 편안하게 사용할 수 있는 도구에 대해 다루는 문서입니다. 스크립트를 작성하셨다면, 다른 사람들도 사용할 수 있도록 자유롭게 추가해 주세요. <div lang="en" dir="ltr" class="mw-content-ltr"> == Dump related tools == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[https://github.com/marius851000/wikifunction_intepreter experimental Wikifunction Rust interpreter] that work on the dump. Written in Rust.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Wikifunctions:Tools/wf-dump-scripts|wf-dump-scripts]] - pipeline for creating statistical wikitables based on dump and the internal Wikifunctions API. Written in [[w:Python (programming language)|Python]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[//wf-query.replit.app wf-query]: tool that allows you to run JSONata queries on a dump of Wikifunctions, with the table output itself also being customizable with JSONata queries. Written in [[w:Node.js|NodeJS]] Express and [[w:JavaScript|vanilla JS]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl Dumpextract]: a program to extract info from the dump of Wikifunctions. Written in [[w:COBOL|COBOL]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[https://github.com/99of9/WikifunctionsAnalysis WikifunctionsAnalysis]: some code which helps analyse Wikifunctions dumps</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[User:Amire80/wikifunctionsanalytics#Example_queries|wikifunctionsanalytics]]: A simplified dump, queryable through [[meta:Special:MyLanguage/Research:Quarry|Quarry]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[toolforge:abstract-data/functions]]: Tracking Function usage on [[abstract:|Abstract Wikipedia]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> *[[User:Feeglgeef/wikilambda editsource.js|wikilambda editsource.js]]: ZObjects의 오래된 JSON 콘텐츠를 편집할 수 있는 사용자 스크립트입니다. * <span lang="en" dir="ltr" class="mw-content-ltr">[https://yoshirulz.gitlab.io/WikiLambdaBlockly WikiLambdaBlockly]: Web app demonstrating a block-based editing interface for compositions. Uses [[w:Blockly|Blockly]] from [[w:TypeScript|TS]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Others == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3 find constants]: tool that represents a f64 using Wikifunctions representation. Prints, comma separated, the sign of the float (-1, 0, 1), the exponent of the float, and the fraction of the float. Written in [[w:Rust (programming language)|Rust]].</span> [[Category:Project{{#translation:}}]] sm6rdpesbaln82s4co2v72dt8dgpqx1 Wikifunctions:Type/ko 4 57157 276519 270487 2026-05-20T06:23:27Z FuzzyBot 207 Updating to match new version of source page 276519 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <span id="Numeric_types"></span> === 수 유형 === * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="Calendar_types"></span> === 달력 유형 === <span id="Gregorian_calendar"></span> ==== 그레고리력 ==== * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="Igbo_calendar"></span> ==== 이그보 달력 ==== * {{Z+|Z16927}} <span id="Wikidata_types"></span> === 위키데이터 유형 === {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <span id="Wikidata_entities"></span> ==== 위키데이터 엔티티 ==== * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <span id="Wikidata_references"></span> ==== 위키데이터 참고 문헌 ==== * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> 새로운 유형은 [[Wikifunctions:Type proposals]]에서 제안할 수 있습니다. <span id="See_also"></span> == 같이 보기 == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] pw3xa96jnimhhx0i4nqs7i3xya8mnav Wikifunctions:Support for Wikidata content/it 4 57511 276495 262464 2026-05-20T06:21:51Z FuzzyBot 207 Updating to match new version of source page 276495 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions provides support for retrieving and using Wikidata content, including encyclopedic content contained primarily in ''Items'' and lexicographic content contained in ''Lexemes, Lexeme forms'', and ''Lexeme senses''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Documentation of Wikidata's lexicographic types can be found at [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Implemented support currently includes: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank''</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''reference types'' corresponding to the 5 entity types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # <span lang="en" dir="ltr" class="mw-content-ltr">User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</span> '''Note terminologiche''': * <span lang="en" dir="ltr" class="mw-content-ltr">We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </div> * [[Z6005|<u>Lessema di Wikidata</u>]] * [[Z6004|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] * [[Z6006|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] * [[Z6003|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement</span></u>]] * [[Z6002|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] * [[Z6001|<u>Elemento Wikidata</u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement rank</span></u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[Z6040|<u>Wikidata statement rank</u>]] and [[Z6020|<u>Wikidata claim subtype</u>]]). </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). </div> <span id="Example"></span> === Esempio === <div lang="en" dir="ltr" class="mw-content-ltr"> An instance of [[Z6005|<u>Wikidata lexeme</u>]] has these 7 parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lemmas, with a value of type [[Z12|Multilingual text]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata reference types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example uses''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Selectors === </div> [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] hjuz0bzgbcqdjq5ml2ai0xz7fuobq92 Wikifunctions:Support for Wikidata content/es 4 57854 276492 262462 2026-05-20T06:21:48Z FuzzyBot 207 Updating to match new version of source page 276492 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div class="mw-translate-fuzzy"> Desde principios de octubre de 2024, Wikifunciones ha estado añadiendo soporte para recuperar y usar contenido de Wikidata, con un enfoque principal en el contenido lexicográfico (''lexemas, formas de lexemas'' y ''sentidos de lexemas''). Dado que las instancias de estos tres tipos lexicográficos pueden referirse a ''elementos'' y pueden contener ''declaraciones'', y las ''declaraciones'' requieren ''propiedades'' y ''rangos de declaración'', Wikifunciones también está añadiendo soporte para estos otros tipos, pero a corto plazo este soporte se limitará a lo necesario para usar eficazmente los tipos lexicográficos. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div class="mw-translate-fuzzy"> La documentación de los tipos lexicográficos se encuentra en [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|Wikidata:Datos lexicográficos/Documentación]]. </div> '''Nota terminológica''': En Wikidata, ''elemento, propiedad, lexema, forma de lexema'' y ''sentido de lexema'' son todos tipos de ''entidades'', por lo que nos referimos a ellos como ''tipos de entidad''. <div class="mw-translate-fuzzy"> El apoyo implementado o planeado incluye actualmente: </div> # <span class="mw-translate-fuzzy">Tipos incorporados correspondientes a los 5 tipos de entidad, ''declaración,'' y ''rango de declaración.''</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # ''Tipos de referencia'' incorporados correspondientes a los 5 tipos de entidad. # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # <span lang="en" dir="ltr" class="mw-content-ltr">User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</span> '''Notas terminológicas''': * <span class="mw-translate-fuzzy">Nos referimos a los tipos incorporados de (1) como los “tipos de Wikidata”, y a los tipos incorporados de (2) como los “tipos de referencia de Wikidata”, pero ten en cuenta que todos ellos son tipos '''en Wikifunciones''' para trabajar con contenido '''de Wikidata'''. Cuando mencionemos uno de estos tipos, aparecerá subrayado, y también será un enlace si está definido actualmente en Wikifunciones (por ejemplo, [[$1|<u>lexema de Wikidata</u>]]).</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span class="mw-translate-fuzzy">Para ayudar a mantener las cosas claras, cuando mencionamos un tipo ''en cursiva'' (como ''lexema'' o ''elemento'') estamos hablando de un tipo que existe '''en Wikidata'''. Por ejemplo, hablaremos del tipo [[$1|<u>lexema de Wikidata</u>]] que se ha creado en Wikifunciones, que corresponde al tipo ''lexema'' de Wikidata.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div class="mw-translate-fuzzy"> Este trabajo está en curso; el conjunto de capacidades aún no está completo. Esta página describe cada una de las áreas de apoyo mencionadas anteriormente y también da la situación de los elementos específicos disponibles actualmente, que se están desarrollando y que se espera que se desarrollen en el futuro. </div> <span id="Wikidata_types"></span> == Tipos de Wikidata == Se han definido los siguientes tipos, con su estructura que corresponde estrechamente a la estructura de los tipos correspondientes en Wikidata: * [[Z6005|<u>Lexema de Wikidata</u>]] * [[Z6004|<u>Forma de lexema de Wikidata</u>]] * [[Z6006|<u>Sentido de lexema de Wikidata</u>]] * [[Z6003|<u>Declaración de Wikidata</u>]] * [[Z6002|<u>Propiedad de Wikidata</u>]] * [[Z6001|<u>Elemento de Wikidata</u>]] * [[Z6040|<u>Rango de declaración de Wikidata</u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div class="mw-translate-fuzzy"> Las instancias de estos tipos nunca se hacen persistentes en Wikifunciones (excepto las instancias de [[Z6040|<u>rango de declaración de Wikidata</u>]]). Se construyen sobre la marcha, cuando se necesitan, usando contenido recuperado directamente de Wikidata. Las instancias de los tipos de entidad (todos los tipos anteriores excepto [[Z6020|<u>declaración de Wikidata</u>]] y [[Z6040|<u>rango de declaración de Wikidata</u>]]) llevan en su interior el identificador de la entidad Wikidata de la que se obtuvieron. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div class="mw-translate-fuzzy"> <u>Rango de declaración de Wikidata</u> es un tipo de enumeración que sólo tiene 3 instancias fijas: <u>predefinida</u>, <u>normal</u> y <u>desusada</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> Se pueden encontrar más antecedentes, motivación y ejemplos de los tipos de Wikidata en la [[Wikifunctions:Type proposals/Wikidata based types|página de discusión de la propuesta de tipos]] (pero tenga en cuenta que la página ya no está activa y no está necesariamente actualizada en todos los detalles). <span id="Example"></span> === Ejemplo === Una instancia del [[Z6005|<u>lexema de Wikidata</u>]] tiene estas 7 partes: # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lemmas, with a value of type [[Z12|Multilingual text]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <span id="Status_of_Wikidata_types"></span> === Estado de los tipos de Wikidata === <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <span id="Notes_about_Wikidata_statements"></span> === Notas sobre las declaraciones de Wikidata === <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <span id="Wikidata_reference_types"></span> == Tipos de referencia de Wikidata == <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} '''Ejemplos de uso''': * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <span id="Status_of_Wikidata_reference_types"></span> === Estado de los tipos de referencia de Wikidata === <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <span id="User_interface"></span> == Interfaz de usuario == <span id="Selectors"></span> === Selectores === [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] sj78on4xxogtkk2rnezgaap7s0fleu1 Wikifunctions:Wikidata/ko 4 58232 276533 235357 2026-05-20T06:23:47Z FuzzyBot 207 Updating to match new version of source page 276533 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} 위키함수는 [[:d:Wikidata:Main page|위키데이터]]에서 {{Q|Q104587954}}로 표현됩니다. 위키데이터 및 위키함수에 대한 자세한 내용은 여기를 참고하십시오! <span id="Functionality_we_will_want"></span> == 원하는 함수 == <span id="Items"></span> == 항목 == * 항목이 있는지 확인 * 항목 가져오기 ** {{done}} {{Z|6821}} * 레이블 가져오기 ** {{done}} {{Z|22853}} * 다른 이름 가져오기 ** {{done}} {{Z|23080}} * 설명 가져오기 ** {{done}} {{Z|30120}} * 정책 가져오기 ** {{done}} {{Z|22220}} * ''아마도'' 사이트 링크 가져오기 ** {{done}} {{Z|35207}} <span id="Statements"></span> === 구문 === * 정책 값 가져오기 ** {{done}} {{Z|19308}} * 순위 가져오기 ** {{done}} {{Z|20206}} * 정책 속성 가져오기 ** {{done}} {{Z|19306}} * 한정어 가져오기 ** {{done}} {{Z|28278}} * 참조 가져오기 ** {{done}} {{Z|31984}} <span id="Properties"></span> === 속성 === * 속성이 있는지 확인 * 속성 가져오기 ** {{done}} {{Z|6822}} * 레이블 가져오기 ** {{done}} {{Z|23223}} * 다른 이름 가져오기 ** {{done}} {{Z|23227}} * 설명 가져오기 ** {{done}} {{Z|23225}} * 데이터 유형 가져오기 * 정책 가져오기 ** {{done}} {{Z|23229}} <span id="Lexemes"></span> === 어휘소 === * 어휘소가 있는지 확인 * 어휘소 가져오기 ** {{done}} {{Z|6825}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get lemmata</span> ** {{done}} {{Z|19293}} * 언어 가져오기 ** {{done}} {{Z|19276}} * 분류 가져오기 ** {{done}} {{Z|19298}} * 정책 가져오기 ** {{done}} {{Z|19300}} * 의미 가져오기 ** {{done}} {{Z|6826}} * 형태 가져오기 ** {{done}} {{Z|6824}} <span id="Senses"></span> ==== 의미 ==== * 주석 가져오기 ** {{done}} {{Z|23114}} * 정책 가져오기 ** {{done}} {{Z|23116}} <span id="Forms"></span> ==== 형태 ==== * 대표 가져오기 ** {{done}} {{Z|22399}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get grammatical features</span> ** {{done}} {{Z|22487}} * 정책 가져오기 ** {{done}} {{Z|23118}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Entity schemas === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Check is Entity Schema exists</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get Entity Schema</span> * 레이블 가져오기 * 다른 이름 가져오기 * 설명 가져오기 [[Category:Project{{#translation:}}]] [[Category:Wikidata]] nvepx231k9q81dfl8ouf7xt4jibtam2 Wikifunctions:Support for Wikidata content/pt-br 4 59081 276498 262467 2026-05-20T06:21:54Z FuzzyBot 207 Updating to match new version of source page 276498 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div class="mw-translate-fuzzy"> A partir do início de outubro de 2024, a Wikifunctions está adicionando suporte para recuperar e usar conteúdo do Wikidata, com foco principal no conteúdo lexicográfico (''Lexemas'', ''Formas de lexema'' e ''Sentidos de lexema''). Como as instâncias desses três tipos lexicográficos podem se referir a ''Itens'' e podem conter ''Declarações'', as quais exigem ''Propriedades'' e ''Classificações de declarações'', a Wikifunctions também está adicionando suporte para esses outros tipos, mas, no curto prazo, esse suporte será limitado ao que é necessário para usar efetivamente os tipos lexicográficos. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div class="mw-translate-fuzzy"> A documentação dos tipos lexicográficos pode ser encontrada em [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|Wikidata:Dados lexicográficos/Documentação]]. </div> '''Nota terminológica''': No Wikidata, ''Item'', ''Propriedade'', ''Lexema'', ''Forma de lexema'' e ''Sentido de lexema'' são todos tipos de ''entidades'', por isso nos referimos a eles como ''tipos de entidades''. <div class="mw-translate-fuzzy"> O suporte implementado ou planejado atualmente inclui: </div> # <span class="mw-translate-fuzzy">Tipos incorporados correspondentes aos 5 tipos de entidade, ''Declaração'' e ''Classificação de declaração''.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # ''Tipos de referência'' incorporados correspondentes aos 5 tipos de entidades # ''Funções de fetching'' incorporadas, para cada um dos tipos de entidade, que recuperam conteúdo do Wikidata e o transformam em instâncias dos tipos incorporados # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # Componentes da interface de usuário para selecionar o conteúdo do Wikidata a ser buscado (via ''fetch'') e para exibir esse conteúdo. '''Notas terminológicas''': * <span class="mw-translate-fuzzy">Referimo-nos aos tipos incorporados de (1) como “tipos do Wikidata” e aos tipos incorporados de (2) como “tipos de referência do Wikidata”, mas observe que todos eles são tipos '''na Wikifunctions''' para trabalhar com conteúdo '''vindo do Wikidata'''. Quando mencionarmos um desses tipos, ele será sublinhado e também será uma ligação se estiver atualmente definido na Wikifunctions (p. ex., [[$1|<u>Lexema do Wikidata</u>]]).</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span class="mw-translate-fuzzy">Para ajudar a manter as coisas claras, quando mencionamos um tipo ''em itálico'' (como ''Lexema'' ou ''Item''), estamos falando de um tipo que existe '''no Wikidata'''. Por exemplo, falaremos sobre o tipo [[$1|<u>Lexema do Wikidata</u>]], o qual foi criado na Wikifunctions, que corresponde ao tipo ''Lexema'' no Wikidata.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div class="mw-translate-fuzzy"> Esse trabalho está em andamento; o conjunto de recursos ainda não está completo. Esta página descreve cada uma das áreas de suporte acima e também fornece a situação sobre quais elementos específicos estão disponíveis no momento, quais estão em desenvolvimento e quais devem ser desenvolvidos no futuro. </div> <span id="Wikidata_types"></span> == Tipos do Wikidata == Os tipos a seguir foram definidos, com sua estrutura correspondendo de perto à estrutura dos tipos correspondentes no Wikidata: * [[Z6005|<u>Lexema do Wikidata</u>]] * [[Z6004|<u>Forma de lexema do Wikidata</u>]] * [[Z6006|<u>Sentido de lexema do Wikidata</u>]] * [[Z6003|<u>Declaração do Wikidata</u>]] * [[Z6002|<u>Propriedade do Wikidata</u>]] * [[Z6001|<u>Item do Wikidata</u>]] * [[Z6040|<u>Classificação de declaração do Wikidata</u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div class="mw-translate-fuzzy"> As instâncias desses tipos nunca se tornam persistentes na Wikifunctions (exceto para as instâncias de [[Z6040|<u>Classificação de declaração do Wikidata</u>]]). Elas são construídas em tempo real, quando necessário, usando conteúdo recuperado diretamente do Wikidata. As instâncias dos tipos de entidade (todos os tipos acima, exceto [[Z6020|<u>Declaração do Wikidata</u>]] e [[Z6040|<u>Classificação de declaração do Wikidata</u>]]) carregam em si o identificador da entidade do Wikidata da qual foram obtidas. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div class="mw-translate-fuzzy"> <u>Classificação de declaração do Wikidata</u> é um tipo de enumeração o qual possui somente as 3 instâncias fixas <u>preferido</u>, <u>normal</u> e <u>depreciado</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> Informações adicionais, motivação e exemplos dos tipos do Wikidata podem ser encontrados na [[Wikifunctions:Type proposals/Wikidata based types|página de discussão da proposta de tipos]] (mas lembre-se de que essa página não está mais ativa e não está necessariamente atualizada em todos os detalhes). <span id="Example"></span> === Exemplo === Uma instância de [[Z6005|<u>Lexema do Wikidata</u>]] possui as seguintes 7 partes: # identidade, com um valor do tipo [[Z6095|<u>Referência de lexema do Wikidata</u>]] # lemas, com um valor do tipo [[Z12|Texto multilíngue]] # idioma, com um valor do tipo [[Z60|Linguagem natural]] # categoria lexical, com um valor do tipo [[Z6091|<u>Referência de item do Wikidata</u>]] # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata reference types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example uses''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Selectors === </div> [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] 4aq6uvo9cwvkgvlndxlf6svkvf3ax4b Wikifunctions:Programming languages/pt-br 4 59266 276485 198834 2026-05-20T06:20:36Z FuzzyBot 207 Updating to match new version of source page 276485 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <span lang="en" dir="ltr" class="mw-content-ltr">[[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Special:MyLanguage/WF:glossary#composition|Compositions]] are a kind of LISPish language, but aren't covered here.</span> <span id="Executable"></span> == Executáveis == <span id="Implemented"></span> === Implementadas === Desde março de 2024, as seguintes linguagens são compiladas no [[meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25|WASM]] para serem processadas pelo [[Special:MyLanguage/WF:glossary#executor|executor]]: * <span class="mw-translate-fuzzy">JavaScript não versionado ([https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy Aviso e Licença de ''Software'' e Documentação do W3C], [https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license src]), utilizando [https://github.com/second-state/wasmedge-quickjs WasmEdge-QuickJS] ([https://bellard.org/quickjs/ QuickJS 2024], compatível com o ES2023)</span> * <span class="mw-translate-fuzzy">Python não versionado ([https://docs.python.org/3/license.html Acordo de Licença da PSF], BSD Zero-Clause), utilizando a versão de desenvolvimento do [https://github.com/RustPython/RustPython RustPython] no modo WASI (para ser compatível com o CPython 3.12)</span> <span id="Planned"></span> === Planejadas === * <span class="mw-translate-fuzzy">JavaScript versionado (ECMA202?+)</span> * Python versionado (3+) <span id="Requested"></span> === Pedidas === <div lang="en" dir="ltr" class="mw-content-ltr"> See the [[phab:tag/wikifunctions-new-language-requests|workboard in Phabricator]] to request additional programming languages that should be supported in Wikifunctions. Among other criteria for implementation, available language interpreter/compiler software must be freely licensed. </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T352589|T352589]]: LabView/G<!--[https://ni.com/en/support/downloads/activate.html proprietary]--> via pyLabView ([https://github.com/mefistotelis/pylabview/blob/master/LICENSE MIT])</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T352588|T352588]]: Kotlin ([https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE Apache])</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T307171|T307171]]: Lua ([https://lua.org/license.html MIT])</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T301418|T301418]]: Scratch/Snap!/Logolike ([https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE BSD 3-Clause], GPLv2 and Scratch Source Code License)</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T298633|T298633]]: Vlojure ([https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE MIT])</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Former === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Previously, the function evaluator directly ran code in its container. Because it was based on Debian Bullseye, JavaScript execution was provided by Node.js 16 and Python by Python 3.9. These are no longer immediately available due to the re-build onto Web Assembler, but could return if needed via a custom build. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Functions for manipulating == </div> * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] epju650cipqieqswigpwpojegqlfk9g Category:Status updates/nl 14 59497 276559 196272 2026-05-20T06:24:49Z FuzzyBot 207 Updating to match new version of source page 276559 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/zh-hans 14 59872 276565 197846 2026-05-20T06:24:52Z FuzzyBot 207 Updating to match new version of source page 276565 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Category:Status updates/zh-hant 14 59874 276566 197856 2026-05-20T06:24:53Z FuzzyBot 207 Updating to match new version of source page 276566 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Support for Wikidata content/zh-hant 4 59962 276500 262468 2026-05-20T06:21:55Z FuzzyBot 207 Updating to match new version of source page 276500 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div class="mw-translate-fuzzy"> 從2024年10月初開始,Wikifunctions一直在新增對檢索與使用Wikidata內容的支援,主要集中於字典內容(「詞位、詞形」與「詞位意義」)。由於這三種字典編目類型可以引用「項目」並且可以包含「陳述」,且「陳述」需要「屬性」與「陳述等級」,因此Wikifunctions也新增了對這些其他類型的支援,但在短期內,這種支援將僅限於有效使用字典編目類型所需的內容。 </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div class="mw-translate-fuzzy"> 字典編目類型的文件可在[[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|Wikidata:Lexicographical data/Documentation]]閱讀。 </div> '''術語說明''':在Wikidata上,''項目、屬性、詞位、詞形''與''詞位意義''都是''實體''的類型,因此我們將其稱之為''實體類型''。 <div class="mw-translate-fuzzy"> 目前已實作或規劃中的支援包含了: </div> # <span class="mw-translate-fuzzy">對應於5種實體類型、<u>陳述</u>、<u>陳述等級</u>的內建類型。</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # 對應於5種實體類型的內建''參照類型'' # 針對每種實體類型的內建''擷取函式'',用來從Wikidata擷取內容並將其轉換為內建類型。 # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # 用來選取要擷取的Wikidata內容以及用於顯示取得的內容的使用者介面元件。 '''術語說明''': * <span class="mw-translate-fuzzy">我們將(1)的內建類型稱為「Wikidata類型」,將(2)的內建類型稱為「Wikidata參照類型」,但請注意,這些全都是'''Wikifunctions上'''的類型,用來處理'''來自Wikidata'''的內容。當我們提到其中一種類型時,它會帶有底線,如果目前在Wikifunctions上定義它,它也會是連結(例如,[[$1|<u>Wikidata lexeme</u>]])。</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </div> * [[Z6005|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] * [[Z6004|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] * [[Z6006|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] * [[Z6003|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement</span></u>]] * [[Z6002|<u>維基數據屬性</u>]] * [[Z6001|<u>維基數據項目</u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement rank</span></u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[Z6040|<u>Wikidata statement rank</u>]] and [[Z6020|<u>Wikidata claim subtype</u>]]). </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). </div> <span id="Example"></span> === 範例 === <div lang="en" dir="ltr" class="mw-content-ltr"> An instance of [[Z6005|<u>Wikidata lexeme</u>]] has these 7 parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lemmas, with a value of type [[Z12|Multilingual text]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u>字串</u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata reference types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example uses''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Selectors === </div> [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] ajktd5nmf18k3tp03wuxb9wpq2r0zr3 Wikifunctions:How to create implementations/zh-hans 4 60327 276463 240265 2026-05-20T06:15:48Z FuzzyBot 207 Updating to match new version of source page 276463 wikitext text/x-wiki <languages/> 本页面,超越了在{{ll|Wikifunctions:Introduction}}中的概述,提供了更加细节性的指导去创建函式的实现。 <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div class="mw-translate-fuzzy"> 在本小節中,我们会有一个例子去说明如何用Python代码创建实现。我们要创建的函数的实现,它的输入数据包含两个字符串,返回的结果是将两个字符串中间加入一个空格。我們假設該函式的ZID是Z11057。 </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Compositions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] 70w7kg81a8ceqm618ytn6obdkwwdofa Wikifunctions:How to create implementations/zh-hant 4 60330 276464 240266 2026-05-20T06:15:49Z FuzzyBot 207 Updating to match new version of source page 276464 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div class="mw-translate-fuzzy"> 實作是使用函式的ZID來定義的,函式的參數也是如此。因此,下列以包含兩個參數的函數Z11057為例,第一行應該是這樣的: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Compositions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] d7lnjjpkxu6j1s92275iodrrc0ku0u0 Z26570 0 61686 276343 274595 2026-05-20T00:26:01Z Theki 2389 normalize 276343 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z26570" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z26570K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "클래스" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "entitas" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "entita" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "实体" }, { "Z1K1": "Z11", "Z11K1": "Z1592", "Z11K2": "entitet" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Ding" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z26570K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "엔터티" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kelas" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "třída" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "类别" }, { "Z1K1": "Z11", "Z11K1": "Z1592", "Z11K2": "typ" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Art" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z26570K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "location" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "위치" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "location" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "lokasi" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "umístění" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "位置" }, { "Z1K1": "Z11", "Z11K1": "Z1592", "Z11K2": "plats" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Ort" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z26570K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "언어" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "bahasa" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "jazyk" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "语言" }, { "Z1K1": "Z11", "Z11K1": "Z1592", "Z11K2": "språk" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Sprache" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z26609", "Z26623", "Z26625", "Z26626", "Z26932", "Z27175", "Z27176", "Z32289", "Z32377", "Z32861" ], "Z8K4": [ "Z14", "Z34043", "Z29840" ], "Z8K5": "Z26570" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "state location using entity and class" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "엔터티와 클래스를 사용하여 위치 지정" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "Localiser en utilisant l'entité et la classe" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Berikan lokasi menggunakan entitas dan kelas" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "vyjádřit umístění pomocí entity a třídy" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "使用实体和类别说明位置" }, { "Z1K1": "Z11", "Z11K1": "Z1592", "Z11K2": "Ange plats med entitet och typ" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Satz über ein Ding einer Art an einem Ort" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "something is a something in somewhere", "is a ? in ?", "location is a class in entity", "X is a Y in Z" ] }, { "Z1K1": "Z31", "Z31K1": "Z1078", "Z31K2": [ "Z6", "sesuatu adalah sesuatu di suatu tempat" ] }, { "Z1K1": "Z31", "Z31K1": "Z1645", "Z31K2": [ "Z6", "某物是某地的某类事物" ] }, { "Z1K1": "Z31", "Z31K1": "Z1592", "Z31K2": [ "Z6", "Ange plats med entitet och klass" ] }, { "Z1K1": "Z31", "Z31K1": "Z1430", "Z31K2": [ "Z6", "X ist ein Y in Z" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Forms a sentence stating the location and class of a given entity. E.g. \"Seoul is a city in South Korea.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Membuat kalimat yang memberikan lokasi dan kelas dari entitas yang diberikan. Misalnya \"Seoul adalah kota di Korea Selatan.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "Vytvoří větu popisující polohu a třídu dané entity. Např. „Soul je město v Jižní Koreji.“" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "生成一句话,说明某个给定实体的类别及其所在位置。如:“首尔是韩国的一座城市。”" }, { "Z1K1": "Z11", "Z11K1": "Z1592", "Z11K2": "Skapar en mening med plats och typ av en angiven entitet. Ex. \"Seoul är en stad i Sydkorea.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "z.B. \"Seoul ist eine Stadt in Südkorea.\"" } ] } } 4f98qqka0y7gnlgb8gnwhbi8ynlps0e Z26627 0 61763 276344 267444 2026-05-20T00:26:25Z Theki 2389 normalize 276344 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z26627" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z26627K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "noun" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "종류" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "classificati" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Klasse" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kelas" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z26627K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "종류" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Klasse" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kelas" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z26627K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "언어" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Sprache" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "bahasa" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z27114" ], "Z8K4": [ "Z14", "Z27127" ], "Z8K5": "Z26627" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "classifying a class of nouns" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "Classer une classe de noms" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "명사의 종류 분류" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "classifica una classe di nomi" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Eine Klasse von Substantiven klassifizieren" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Mengklasifikasikan kelas dari kata benda" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "E.g. “Antelopes are mammals\", \"Squares are rectangles\"" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "E.g. \"Les antilopes sont des mammifères.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "예를 들어, \"양은 포유류이다\"." }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Es.: \"Le antilopi sono mammiferi.\", \"I quadrati sono rettangoli.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Beispiel: „Antilopen sind Säugetiere“, „Quadrate sind Rechtecke“" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Misalnya \"Antelop adalah mamalia\", \"Persegi adalah segi empat\"" } ] } } ay11jpozk7t9gruyyjxwl1uzg6d56r3 Z26739 0 62117 276292 206182 2026-05-19T19:48:26Z Dv103 11127 made test faster with partial fetch 276292 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z26739" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z26737", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z26737", "Z26737K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q30" }, "Z30120K2": [ "Z6030", "Z6033", "Z6036" ], "Z30120K3": { "Z1K1": "Z7", "Z7K1": "Z24144", "Z24144K1": "Z1787", "Z24144K2": { "Z1K1": "Z40", "Z40K1": "Z41" }, "Z24144K3": { "Z1K1": "Z40", "Z40K1": "Z41" } }, "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P31" } ] }, "Z26737K2": { "Z1K1": "Z7", "Z7K1": "Z6825", "Z6825K1": { "Z1K1": "Z6095", "Z6095K1": "L1318310" } } }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "gli Stati Uniti d'America sono" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "gli Stati Uniti d'America sono" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } ogvhe4j4eo1pofv8fkw1aj2pzjx9wks Z26743 0 62122 276291 210379 2026-05-19T19:45:42Z Dv103 11127 Added possibility of fallback languages 276291 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z26743" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z26737", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z10184", "Z10184K1": { "Z1K1": "Z7", "Z7K1": "Z17180", "Z17180K1": { "Z1K1": "Z18", "Z18K1": "Z26737K2" } }, "Z10184K2": { "Z1K1": "Z7", "Z7K1": "Z10216", "Z10216K1": { "Z1K1": "Z7", "Z7K1": "Z26548", "Z26548K1": { "Z1K1": "Z18", "Z18K1": "Z26737K1" } } } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z27899", "Z27899K1": { "Z1K1": "Z18", "Z18K1": "Z26737K1" }, "Z27899K2": "Z1787" }, " è" ] }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z10184", "Z10184K1": { "Z1K1": "Z7", "Z7K1": "Z26729", "Z26729K1": { "Z1K1": "Z18", "Z18K1": "Z26737K2" } }, "Z10184K2": { "Z1K1": "Z7", "Z7K1": "Z27340", "Z27340K1": { "Z1K1": "Z7", "Z7K1": "Z27292", "Z27292K1": { "Z1K1": "Z18", "Z18K1": "Z26737K2" }, "Z27292K2": { "Z1K1": "Z7", "Z7K1": "Z23756", "Z23756K1": { "Z1K1": "Z18", "Z18K1": "Z26737K1" } } }, "Z27340K2": { "Z1K1": "Z6092", "Z6092K1": "P5713" }, "Z27340K3": { "Z1K1": "Z6091", "Z6091K1": "Q146786" } } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z27115", "Z27115K1": { "Z1K1": "Z18", "Z18K1": "Z26737K2" }, "Z27115K2": { "Z1K1": "Z26934", "Z26934K1": { "Z1K1": "Z6091", "Z6091K1": "Q146786" } } }, " sono" ] }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z27115", "Z27115K1": { "Z1K1": "Z18", "Z18K1": "Z26737K2" }, "Z27115K2": { "Z1K1": "Z26934", "Z26934K1": { "Z1K1": "Z6091", "Z6091K1": "Q110786" } } }, " è" ] } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "prima parte di frase di istanziazione it, comp." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first part of Italian instantiating sentence, comp" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 9gw4ivvwkpgfjfdxqcss1ih9558j7fc Wikifunctions:Type/nan-latn-pehoeji 4 62277 276522 270489 2026-05-20T06:23:32Z FuzzyBot 207 Updating to match new version of source page 276522 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == Chham-oa̍t == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] llmk36l9k6ujzmctyxrf9fjsvk1gctc Wikifunctions:Type/zh-hant 4 62301 276528 270495 2026-05-20T06:23:42Z FuzzyBot 207 Updating to match new version of source page 276528 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == 參閱 == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] 8at4odkbqnhnv7p1pv0aqsdcol7e4gp Wikifunctions:Type/zh-hans 4 62326 276527 270494 2026-05-20T06:23:41Z FuzzyBot 207 Updating to match new version of source page 276527 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == 参阅 == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] 86y15zdx07m9ltxu14uxbn3vieipbmo Wikifunctions:Type/nan-hant 4 62364 276521 270488 2026-05-20T06:23:31Z FuzzyBot 207 Updating to match new version of source page 276521 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Calendar types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Gregorian calendar ==== </div> * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Wikidata types === </div> {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata references ==== </div> * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata statements ==== </div> * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == 參閱 == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] 8at4odkbqnhnv7p1pv0aqsdcol7e4gp Category:Status updates/hi 14 62648 276551 207664 2026-05-20T06:24:45Z FuzzyBot 207 Updating to match new version of source page 276551 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Z27173 0 63074 276345 259189 2026-05-20T00:26:33Z Theki 2389 normalize 276345 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z27173" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27173K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class being described" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "클래스" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "classificato" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kelas" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27173K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "adjective" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "형용사" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "aggettivo" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "adjectif" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kata sifat" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Adjektiv" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27173K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class describing" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "클래스" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "kelas" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z27173K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "언어" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "bahasa" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Sprache" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z27213", "Z27214", "Z32391" ], "Z8K4": [ "Z14", "Z27174" ], "Z8K5": "Z27173" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "describe the class of a class" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "클래스의 클래스를 설명하기" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "descrivi la classe di una classe" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "décrire la classe d'une classe" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Deskripsikan kelas dari kelas" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "E.g. 'Ice is frozen water'" }, { "Z1K1": "Z11", "Z11K1": "Z1643", "Z11K2": "형용사로 클래스의 클래스를 설명합니다. 예를 들어, '얼음은 얼어붙은 물이다'." }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Es.: \"Il ghiaccio è acqua ghiacciata\"" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "par exemple : la glace est de l'eau gelée" }, { "Z1K1": "Z11", "Z11K1": "Z1078", "Z11K2": "Misalnya \"Es adalah air beku\"" } ] } } rnkocmgizv5fk0rrwiia865ylueq5ss Z27243 0 63223 276341 274602 2026-05-20T00:25:23Z Theki 2389 normaliz 276341 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z27243" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27243K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "entita" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27243K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "adjective" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "adjectif" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "adjektivum" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27243K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "classe" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "třída" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27243K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "location" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "localisation" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "místo" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z27243K5", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "jazyk" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z27248", "Z27256", "Z32233", "Z33264" ], "Z8K4": [ "Z14", "Z29842" ], "Z8K5": "Z27243" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "superlative definition" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "définition d'un superlatif" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "definice superlativem" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1062", "Z31K2": [ "Z6", "superlativní definice" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Topic definition in the form of \"\u003CX\u003E is the \u003CCest\u003E \u003CY\u003E in \u003CZ\u003E.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "définition d'un sujet sous la forme « \u003CX\u003E est le \u003CY\u003E le plus \u003CC\u003E de \u003CZ\u003E. »" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "sestaví větu definující téma superlativem ve formě „\u003Centita\u003E je \u003Csuperlativum\u003E \u003Ctřída\u003E v \u003Cmísto\u003E.“" } ] } } qhmkxtvg5p0vqp7uh7l7oincrj3zuu8 Z27339 0 63585 276293 266888 2026-05-19T19:50:56Z Dv103 11127 now fetches also fallback languages 276293 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z27339" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z26513", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z10771", "Z10771K1": { "Z1K1": "Z7", "Z7K1": "Z26737", "Z26737K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z18", "Z18K1": "Z26513K1" }, "Z30120K2": [ "Z6030", "Z6033", "Z6036" ], "Z30120K3": { "Z1K1": "Z7", "Z7K1": "Z24144", "Z24144K1": "Z1787", "Z24144K2": { "Z1K1": "Z40", "Z40K1": "Z41" }, "Z24144K3": { "Z1K1": "Z40", "Z40K1": "Z41" } }, "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P31" }, { "Z1K1": "Z6092", "Z6092K1": "P735" } ] }, "Z26737K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z813", "Z813K1": { "Z1K1": "Z7", "Z7K1": "Z23471", "Z23471K1": { "Z1K1": "Z18", "Z18K1": "Z26513K1" }, "Z23471K2": "Z1787" } }, "Z802K2": "Z24", "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z27327", "Z27327K1": { "Z1K1": "Z18", "Z18K1": "Z26513K1" }, "Z27327K2": { "Z1K1": "Z6092", "Z6092K1": "P5137" }, "Z27327K3": "Z1787" } } } }, " ", { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z27107", "Z27107K1": { "Z1K1": "Z7", "Z7K1": "Z27327", "Z27327K1": { "Z1K1": "Z18", "Z18K1": "Z26513K2" }, "Z27327K2": { "Z1K1": "Z6092", "Z6092K1": "P5137" }, "Z27327K3": "Z1787" } }, "Z850K2": "Z28248", "Z850K3": { "Z1K1": "Z7", "Z7K1": "Z10000", "Z10000K1": "un'istanza di ", "Z10000K2": { "Z1K1": "Z7", "Z7K1": "Z24766", "Z24766K1": { "Z1K1": "Z18", "Z18K1": "Z26513K2" }, "Z24766K2": "Z1787" } } }, "." ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "frase di istanziazione, it, comp, migliori lessemi" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } otftjpet00hea5o33fs7q7yk2zp9omm Z27885 0 64553 276272 256987 2026-05-19T18:55:46Z Theki 2389 Added Z35386 to the approved list of test cases 276272 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z27885" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z27885K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "concetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "concept" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z27885K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z27886", "Z27887", "Z27890", "Z27904", "Z29314", "Z30183", "Z30184", "Z30187", "Z31939", "Z35386" ], "Z8K4": [ "Z14", "Z30182", "Z30226", "Z30185", "Z29320" ], "Z8K5": "Z27885" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "nome per titolo di tabella" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "name for table header" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Given an item, returns the name of the item in a form suitable to be inserted in a table as a header" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Dato un elemento, restituisce il nome dell'elemento in una forma adatta ad essere inserita in una tabella come titolo (di una riga o colonna)." } ] } } fry74dmnrhf782ovw3oavqs1cxun1kh Z28079 0 65189 276193 216898 2026-05-19T13:11:48Z Dv103 11127 Added Z35360 to the approved list of implementations 276193 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z28079" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z28079K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "subject" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Subjekt" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z28080", "Z28081" ], "Z8K4": [ "Z14", "Z28083", "Z35360" ], "Z8K5": "Z28079" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "German nominative def article + noun from Item" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Deutsches Nominativ mit bestimmten Artikel" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "das Ding" ] }, { "Z1K1": "Z31", "Z31K1": "Z1430", "Z31K2": [ "Z6", "das Ding" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Generates noun phrases such as \"die Katze\", \"der Hund\", \"das Haus\", etc." }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Erzeugt Phrasen wie \"die Katze\", \"der Hund\", \"das Haus\", etc." } ] } } gy0dmitdeo66tohk5ttb2pjvi5eejc6 276194 276193 2026-05-19T13:12:47Z Dv103 11127 Removed Z28083 from the approved list of implementations 276194 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z28079" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z28079K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "subject" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Subjekt" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z28080", "Z28081" ], "Z8K4": [ "Z14", "Z35360" ], "Z8K5": "Z28079" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "German nominative def article + noun from Item" }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Deutsches Nominativ mit bestimmten Artikel" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "das Ding" ] }, { "Z1K1": "Z31", "Z31K1": "Z1430", "Z31K2": [ "Z6", "das Ding" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Generates noun phrases such as \"die Katze\", \"der Hund\", \"das Haus\", etc." }, { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Erzeugt Phrasen wie \"die Katze\", \"der Hund\", \"das Haus\", etc." } ] } } mlesagficcc5erfxhquf4etp4lmq8uj Wikifunctions:Type/uk 4 66108 276525 270493 2026-05-20T06:23:38Z FuzzyBot 207 Updating to match new version of source page 276525 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} Кожен об'єкт у Вікіфункціях належить до типу. Типи визначають, як структуровані об'єкти цього типу та що вони означають. Типи також використовуються для визначення аргументів функції та того, що повертає функція. Наразі існує <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} типів, доступних для визначення аргументів та типу повернення функції: * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <span id="Numeric_types"></span> === Числові типи === * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="Calendar_types"></span> === Календарні типи === <span id="Gregorian_calendar"></span> ==== Григоріанський календар ==== * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="Igbo_calendar"></span> ==== Календар ігбо ==== * {{Z+|Z16927}} <span id="Wikidata_types"></span> === Типи Вікіданих === {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <span id="Wikidata_entities"></span> ==== Сутності Вікіданих ==== * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <span id="Wikidata_references"></span> ==== Посилання Вікіданих ==== * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <span id="Wikidata_statements"></span> ==== Твердження Вікіданих ==== * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div class="mw-translate-fuzzy"> Можна використовувати й інші типи, але можуть виникати помилки. Список усіх типів див. у [[Special:ListObjectsByType/Z4|списку всіх типів]] </div> Нові типи можна запропонувати на сторінці [[Wikifunctions:Type proposals]]. <span id="See_also"></span> == Див. також == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] bl2cpycfjruassmdwpxtc5gbed0zsrk Wikifunctions:Support for Wikidata content/anp 4 67670 276489 262458 2026-05-20T06:21:44Z FuzzyBot 207 Updating to match new version of source page 276489 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div class="mw-translate-fuzzy"> विकिफ़ंक्शन्स (Wikifunctions) विकिडाटा (Wikidata) केरौ सब सामग्री, जेकरा मँ मुख्य रूप स 'आइटम्स' (Items) मँ रखलऽ ज्ञानकोशीय सामग्री आरू 'लेक्सेम्स' (Lexemes), 'लेक्सेम फॉर्म्स' (Lexeme forms), आरू 'लेक्सेम सेन्सेज' (Lexeme senses) मँ रखलऽ कोशगत सामग्री शामिल छै, क प्राप्त करै आरू ओकरो उपयोग करै लेली सहायता दै छै। चूंकि ई चारो प्रकार केरौ सामग्री मँ 'स्टेटमेंट्स' (Statements) रहै सकै छै, ई लेली विकिफ़ंक्शन्स मँ 'स्टेटमेंट्स' आरू ओकरो घटक, जेकरा मँ 'प्रॉपर्टीज' (Properties), 'स्टेटमेंट रैंक्स' (Statement ranks), 'क्वालिफायर्स' (Qualifiers), आरू (जल्दीये आबै वाला) 'रेफरेंसेज' (References) शामिल छै, लेली भी सहायता देलऽ गेलऽ छै। </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Documentation of Wikidata's lexicographic types can be found at [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Implemented support currently includes: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank''</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''reference types'' corresponding to the 5 entity types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # <span lang="en" dir="ltr" class="mw-content-ltr">User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology notes''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </div> * [[Z6005|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] * [[Z6004|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] * [[Z6006|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] * [[Z6003|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement</span></u>]] * [[Z6002|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] * [[Z6001|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement rank</span></u>]] * [[Z6008|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[Z6040|<u>Wikidata statement rank</u>]] and [[Z6020|<u>Wikidata claim subtype</u>]]). </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Example === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An instance of [[Z6005|<u>Wikidata lexeme</u>]] has these 7 parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lemmas, with a value of type [[Z12|Multilingual text]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a value</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata time</span></u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">one of the Wikidata reference types, discussed below.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata reference types == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme reference</span></u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense reference</span></u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item reference</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example uses''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme</span></u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme sense</span></u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata item</span></u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == User interface == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Selectors === </div> [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6826|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata item</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: available</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] gch52xzekvn3x0tmg6u7h1y5vc25v4y Wikifunctions:Programming languages/kcg 4 68031 276481 227297 2026-05-20T06:20:34Z FuzzyBot 207 Updating to match new version of source page 276481 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <span lang="en" dir="ltr" class="mw-content-ltr">[[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Special:MyLanguage/WF:glossary#composition|Compositions]] are a kind of LISPish language, but aren't covered here.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Executable == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Implemented === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As of March 2024 the following languages compile to [[meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25|WASM]] to be run by the [[Special:MyLanguage/WF:glossary#executor|executor]]: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">unversioned [[Special:MyLanguage/WF:JS|JavaScript]] ([https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy W3C Software and Document Notice and License], [https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license src]), using [https://github.com/second-state/wasmedge-quickjs WasmEdge-QuickJS] (using [https://bellard.org/quickjs/ QuickJS 2024], compatible with ES2023)</span> * <span lang="en" dir="ltr" class="mw-content-ltr">unversioned [[Special:MyLanguage/WF:PY|Python]] ([https://docs.python.org/3/license.html PSF License Agreement], Zero-Clause BSD), using the development version of [https://github.com/RustPython/RustPython RustPython] WASI mode (this is intended to be compatible with CPython 3.12)</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Planned === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">versioned JavaScript (ECMA202?+)</span> * <span lang="en" dir="ltr" class="mw-content-ltr">versioned Python (3+)</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Requested === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> See the [[phab:tag/wikifunctions-new-language-requests|workboard in Phabricator]] to request additional programming languages that should be supported in Wikifunctions. Among other criteria for implementation, available language interpreter/compiler software must be freely licensed. </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T352589|T352589]]: LabView/G<!--[https://ni.com/en/support/downloads/activate.html proprietary]--> via pyLabView ([https://github.com/mefistotelis/pylabview/blob/master/LICENSE MIT])</span> * [[phab:T352588|T352588]]: Kotlin ([https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE Apache]) * [[phab:T307171|T307171]]: Lua ([https://lua.org/license.html MIT]) * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T301418|T301418]]: Scratch/Snap!/Logolike ([https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE BSD 3-Clause], GPLv2 and Scratch Source Code License)</span> * [[phab:T298633|T298633]]: Vlojure ([https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE MIT]) <div lang="en" dir="ltr" class="mw-content-ltr"> === Former === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Previously, the function evaluator directly ran code in its container. Because it was based on Debian Bullseye, JavaScript execution was provided by Node.js 16 and Python by Python 3.9. These are no longer immediately available due to the re-build onto Web Assembler, but could return if needed via a custom build. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Functions for manipulating == </div> * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] cippeafdrn86tb0432l8ce7vr9rbyg0 Wikifunctions:Wikidata/kcg 4 68035 276532 235354 2026-05-20T06:23:47Z FuzzyBot 207 Updating to match new version of source page 276532 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions is represented on [[:d:Wikidata:Main page|Wikidata]] by {{Q|Q104587954}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> More Wikidata and Wikifunctions here, soon! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Functionality we will want == </div> <span id="Items"></span> === A̱yaangga === * <span lang="en" dir="ltr" class="mw-content-ltr">Check if an item exists</span> * Shyia̱ a̱ngga wu ** {{done}} {{Z|6821}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get labels</span> ** {{done}} {{Z|22853}} * Shyia̱ lyulyoot nghyang hu ** {{done}} {{Z|23080}} * Shyia̱ wa̱i a̱lyiat hu ** {{done}} {{Z|30120}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|22220}} * <span lang="en" dir="ltr" class="mw-content-ltr">''possibly'' Get sitelinks</span> ** {{done}} {{Z|35207}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Statements === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Get values of statement</span> ** {{done}} {{Z|19308}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get rank</span> ** {{done}} {{Z|20206}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get property of statement</span> ** {{done}} {{Z|19306}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get qualifiers</span> ** {{done}} {{Z|28278}} * Shyia̱ ya̱fang hu ** {{done}} {{Z|31984}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Properties === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Check if a property exists</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get property</span> ** {{done}} {{Z|6822}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get labels</span> ** {{done}} {{Z|23223}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get aliases</span> ** {{done}} {{Z|23227}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get descriptions</span> ** {{done}} {{Z|23225}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get data type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|23229}} <span id="Lexemes"></span> === La̱kzi̱m === * Zop ka̱nang la̱kzi̱m nshyia̱ * Shyia̱ la̱kzi̱m ji ** {{done}} {{Z|6825}} * Shyia̱ lemmata ji ** {{done}} {{Z|19293}} * Shyia̱ lilyem hu ** {{done}} {{Z|19276}} * Shyia̱ sa ji ** {{done}} {{Z|19298}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|19300}} * Shyia̱ a̱ma̱nyi ka ** {{done}} {{Z|6826}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get form</span> ** {{done}} {{Z|6824}} <span id="Senses"></span> ==== A̱ma̱nyi ==== * <span lang="en" dir="ltr" class="mw-content-ltr">Get gloss</span> ** {{done}} {{Z|23114}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|23116}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Forms ==== </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Get representation</span> ** {{done}} {{Z|22399}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get grammatical features</span> ** {{done}} {{Z|22487}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|23118}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Entity schemas === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Check is Entity Schema exists</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get Entity Schema</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get labels</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get aliases</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get descriptions</span> [[Category:Project{{#translation:}}]] [[Category:Wikidata]] 9rlbaqtetpnjufpoorq22t74t5yp8wr Wikifunctions:How to create implementations/kcg 4 68128 276453 240255 2026-05-20T06:15:39Z FuzzyBot 207 Updating to match new version of source page 276453 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Types of Implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Practice Test-Driven Development == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Imagine you want to implement a Function that combines two strings with a space in between. A basic test for this might look like: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, what if your first string ends in a space, or your second string starts with a space? Should the function keep all existing spaces and add another one, or should it return a neatly spaced result with just a single space between the words? Depending on your requirements, you should build a test for such a case. For example, a test for this edge case could be either one of these — but not both!: </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> or ... </div> <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Make sure that all possible special cases are covered by your tests, and once you have them, make sure that they are all connected to the Function by selecting them and clicking "Connect". </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Compositions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikifunctions error handling == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Error()</code> has two parameters: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Error type: a string containing the ZID of the error type you want to return.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you are creating a composition implementation, you can throw an error by calling the special function {{Z|Z851}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z851}} function is similar to the <code>Wikifunctions.Error()</code> method and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to the Error type you want to raise</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] gqduotf6d59h7zdhzx2eqwlcgy8hdq8 Category:Status updates/kcg 14 68183 276554 227533 2026-05-20T06:24:47Z FuzzyBot 207 Updating to match new version of source page 276554 wikitext text/x-wiki <languages/> {{see also|meta:category:Abstract Wikipedia/Updates}} [[category:contents{{#translation:}}]] 0vwl2bamomh86d4e9roysjskmljmizo Wikifunctions:Support for Wikidata content/kcg 4 68221 276496 262465 2026-05-20T06:21:51Z FuzzyBot 207 Updating to match new version of source page 276496 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions provides support for retrieving and using Wikidata content, including encyclopedic content contained primarily in ''Items'' and lexicographic content contained in ''Lexemes, Lexeme forms'', and ''Lexeme senses''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Since instances of these four content types can contain ''Statements'', Wikifunctions also includes support for ''Statements'' and their components, including ''Properties'', ''Statement ranks'', ''Qualifiers'', and (coming soon) ''References''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Documentation of Wikidata's lexicographic types can be found at [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|lexicographical data documentation]], and documentation of the other Wikidata types can be found at [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology note''': On Wikidata, ''Item, Property, Lexeme, Lexeme form'', and ''Lexeme sense'' are all types of ''entities'', so we refer to these as the ''entity types''. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Implemented support currently includes: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in types corresponding to the 5 entity types, ''Statement'', and ''Statement rank''</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Reference", which corresponds to Wikidata's ''ReferenceRecord'' type</span> # <span lang="en" dir="ltr" class="mw-content-ltr">A built-in type "Claim" <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossary]] ]</sup>, which corresponds to Wikidata's type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossary]] ]</sup>, and is used in Wikifunctions' representation of qualifiers and references inside statements</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''reference types'' corresponding to the 5 entity types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''fetch functions'', for each of the entity types, which retrieve content from Wikidata and transform it into instances of the built-in types</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Built-in ''search functions'', which provide methods for finding lexemes by their relations to other entities</span> # <span lang="en" dir="ltr" class="mw-content-ltr">User interface components for selecting Wikidata content to be fetched, and for displaying the fetched content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Terminology notes''': </div> * <span lang="en" dir="ltr" class="mw-content-ltr">We refer to the built-in types of (1) -- (3) as the “Wikidata types”, and the built-in types of (4) as the “Wikidata reference types”, but note that all of these are types '''on Wikifunctions''' for working with content '''from Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">When we mention one of these types below, it will be underlined, and it will also be a link if it’s currently defined on Wikifunctions (e.g., [[Z6005|<u>Wikidata lexeme</u>]]).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">To help keep things clear, when we mention a type ''in italics'' (such as ''Lexeme'' or ''Item'') we are talking about a type that exists '''on Wikidata'''.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, we will talk about the [[Z6005|<u>Wikidata lexeme</u>]] type that’s been created on Wikifunctions, which corresponds to the ''Lexeme'' type on Wikidata.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The ''reference types'' mentioned in (4) are not related to the "Reference" type mentioned in (2).</span> <span lang="en" dir="ltr" class="mw-content-ltr">(4) provides a way to refer to Wikidata entities using their identifiers, whereas (2) captures the sources that substantiate particular content.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This page describes each of the above areas of support. Everything described here is deployed and available, except as noted in a few places. </div> <span id="Wikidata_types"></span> == Ntangka̱i Wukideita == <div lang="en" dir="ltr" class="mw-content-ltr"> The following types have been defined, with their structure corresponding closely to the structure of the corresponding types on wikidata: </div> * [[Z6005|<u>La̱kzi̱m Wukideita</u>]] * [[Z6004|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] * [[Z6006|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme sense</span></u>]] * [[Z6003|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement</span></u>]] * [[Z6002|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] * [[Z6001|<u>A̱ngga Wukideita</u>]] * [[Z6040|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata statement rank</span></u>]] * [[Z6008|<u>Ya̱fang Wukideita</u>]] * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6007|<u> Wikidata claim</u>]], which corresponds to Wikidata's ''Snak'' type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Z6020|<u> Wikidata claim subtype</u>]], which captures the 3 types of Snaks on Wikidata</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these types are never made persistent on Wikifunctions (except for the instances of [[Z6040|<u>Wikidata statement rank</u>]] and [[Z6020|<u>Wikidata claim subtype</u>]]). </div> <span lang="en" dir="ltr" class="mw-content-ltr">They are constructed on the fly, when needed, using content retrieved directly from Wikidata.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of the entity types carry within them the identifier of the Wikidata entity from which they were obtained. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6040|<u>Wikidata statement rank</u>]] is an enumeration type which has only the 3 fixed instances <u>preferred</u>, <u>normal</u>, and <u>deprecated</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6020|<u>Wikidata claim subtype</u>]] is an enumeration type which has only the 3 fixed instances <u>value</u>, <u>some value</u>, and <u>no value</u>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Additional background, motivation, and examples of the Wikidata types may be found on the [[Wikifunctions:Type proposals/Wikidata based types|types proposal discussion page]] (but please be aware that page is no longer active and isn't necessarily up-to-date in all details). </div> <span id="Example"></span> === Kidee === <div lang="en" dir="ltr" class="mw-content-ltr"> An instance of [[Z6005|<u>Wikidata lexeme</u>]] has these 7 parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">identity, with a value of type [[Z6095|<u>Wikidata lexeme reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lemmas, with a value of type [[Z12|Multilingual text]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">language, with a value of type [[Z60|Natural language]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">lexical category, with a value of type [[Z6091|<u>Wikidata item reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">statements, whose value is a list of [[Z6003|<u>Wikidata statement</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">senses, whose value is a list of [[Z6006|<u>Wikidata lexeme sense</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">forms, whose value is a list of [[Z6004|<u>Wikidata lexeme form</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note, then, that each such instance contains instances of three other Wikidata types ([[Z6003|<u>Wikidata statement</u>]], [[Z6006|<u>Wikidata lexeme sense</u>]], and [[Z6004|<u>Wikidata lexeme form</u>]]), and also two Wikidata reference types (which are discussed in the next section). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z12|Multilingual text]] and [[Z60|Natural language]] are multipurpose Wikifunctions’ types, not created specifically for handling Wikidata content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The identity part stores the Wikidata identifier associated with the lexeme, and serves as a self-reference. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For information about the content of each of the other parts, please see [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|d:Lexicographical data/Documentation]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A specific instance, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]], is shown in the appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> All these types are defined and available for use; there are no outstanding tasks directly related to them. </div> <span lang="en" dir="ltr" class="mw-content-ltr">They all have built-in equality functions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the five entity types has a built-in fetch function, as described below, by which its instances can be directly fetched (retrieved from Wikidata and instantiated on Wikifunctions). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Notes about Wikidata statements === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Statements appear inside of Wikidata items, properties, lexemes, lexeme forms, and lexeme senses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each [[Z6003|<u>Wikidata statement</u>]] imported from Wikidata contains seven parts: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">a subject (an entity reference, discussed below)</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a predicate (a property reference, discussed below)</span> # a̱fi̱ng # <span lang="en" dir="ltr" class="mw-content-ltr">a rank (an instance of [[Z6040|<u>Wikidata statement rank</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of qualifiers (each represented as a [[Z6003|<u>Wikidata claim</u>]])</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a list of [[Z6008|<u>Wikidata reference</u>]]</span> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of [[Z6020|<u>Wikidata claim subtype</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The value, (3), may be of several different Wikifunctions types, including: </div> * [[Z6|<u><span lang="en" dir="ltr" class="mw-content-ltr">String</span></u>]] * [[Z11|<u><span lang="en" dir="ltr" class="mw-content-ltr">Monolingual text</span></u>]] * [[Z6010|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata quantity</span></u>]] * [[Z6011|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata geo-coordinate</span></u>]] * [[Z6040|<u>Jen Wukideita</u>]] * á̱ ku bwuo nkhang tazwa, tangka̱i nyiung mi̱ nta̱ngka̱i ya̱fang Wukideita na <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Because ''Statements'' in Wikidata do not have public identifiers, in Wikifunctions [[Z6003|<u>Wikidata statement</u>]] does not have a reference type or a fetch function. (These are described in more detail below.) </div> <span id="Wikidata_reference_types"></span> == Ntangka̱i ya̱fang Wukideita == <div lang="en" dir="ltr" class="mw-content-ltr"> The following reference types provide the means to refer to Wikidata entities without including the details of their content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Instances of these reference types contain ''only'' the Wikidata ID of an entity, as a Z6/String. </div> * [[Z6095|<u>Ya̱fang la̱kzi̱m Wukideita</u>]] * [[Z6094|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form reference</span></u>]] * [[Z6096|<u>Ya̱fang a̱ma̱nyi la̱kzi̱m Wukideita</u>]] * [[Z6092|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property reference</span></u>]] * [[Z6091|<u>Ya̱fang a̱ngga Wukideita</u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': a [[Z6091|<u>Wikidata item reference</u>]] to the item ''Q1084'' (which represents the concept ''noun'' on Wikidata) looks like the following. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} '''Nyian ta̱m ma̱ng kidee''': * <span lang="en" dir="ltr" class="mw-content-ltr">Wikidata reference types are used with Wikidata fetch functions (see below).</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When entity IDs and ''Property'' IDs appear inside of Wikidata lexemes, Wikidata lexeme forms, Wikidata lexeme senses, or Wikidata statements, they appear as instances of the appropriate Wikidata reference types.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, to indicate that ''Lexeme L3435'' (“umbrella”) has lexical category ''noun'' (which has entity ID ''Q1084''), the [[Z6005|<u>Wikidata lexeme</u>]] for ''L3435'' contains the [[Z6091|<u>Wikidata item reference</u>]] shown above, in the '''Example'''.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata reference types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Ready for use. No outstanding tasks directly related to these types. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata fetch functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function is a built-in Wikifunctions function that takes an instance of one of the Wikidata reference types as its input argument. </div> <span lang="en" dir="ltr" class="mw-content-ltr">As noted above, each such instance contains the ID of a Wikidata entity.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Given that, it retrieves the content of that entity from Wikidata and transforms it into an instance of the corresponding Wikidata type. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': If [[Z6825|<u>Fetch Wikidata lexeme</u>]] is called with this instance of [[Z6095|<u>Wikidata lexeme reference</u>]]: </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} <div lang="en" dir="ltr" class="mw-content-ltr"> it will return the instance of [[Z6005|<u>Wikidata lexeme</u>]] that is introduced in the ''Example'' subsection of the ''Wikidata types'' section above, and shown in greater detail in the Appendix. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of Wikidata fetch functions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A fetch function exists for each of the entity types on Wikifunctions: </div> * [[Z6825|<u>Bwuo la̱kzi̱m Wukideita</u>]] * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata lexeme form</span></u>]] * [[Z6826|<u>Bwuo a̱ma̱nyi la̱kzi̱m Wukideita</u>]] * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Fetch Wikidata property</span></u>]] * [[Z6821|<u>Bwuo a̱ngga Wukideita</u>]] <div lang="en" dir="ltr" class="mw-content-ltr"> To enable calling the fetch functions from the user interface, Wikifunctions provides selector components, which make it possible to select an entity to be fetched. </div> <span lang="en" dir="ltr" class="mw-content-ltr">There will eventually be a selector corresponding to each of the entity types (and thus, to each of the fetch functions).</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The next section provides more information about selector components. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Wikidata search functions == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to fetching content from Wikidata, it's also possible to search Wikidata content in various ways, using its APIs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions currently provides two built-in functions based on these search capabilities. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6830|<u>Find lexemes for an item</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6091|<u>Wikidata item reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata captures useful relationships between lexeme senses (which represent the meanings of a lexeme) and items. These include: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P5137|item for this sense]], most often connecting a noun to a thing or a class of things in Wikidata</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P9970|predicate for]], connecting a verb to an action or event</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[d:Property:P6271|demonym of]], connecting a noun or adjective to a location, describing the people and things that live or are from that place.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example 1.''' The three senses of the lexeme [[d:Lexeme:L18379|L18379/rose]] refer to the color, the flower, and the biological taxon. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of these 3 senses is related to a different item, by means of a statement, in Wikidata, such as this (for the first sense): </div> * <span lang="en" dir="ltr" class="mw-content-ltr">statement subject: [[d:Lexeme:L18379|L18379-S1/rose sense 1]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement property: [[d:Property:P5137|P5137/item for this sense]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">statement value: [[d:Q533047|Q533047/rose]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6830|<u>Find lexemes for an item</u>]] searches for lexemes that are related to a given item by a given property. (Even though the relationships exist between a ''lexeme sense'' and an item, Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the sense(s).) </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''2''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q533047|Q533047/rose]] (the color), [[d:Property:P5137|P5137/item for this sense]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the lexeme reference for [[d:Lexeme:L18379|L18379/rose]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Calling the function with [[d:Q102231|Q102231/rose]] (the flower) or with [[d:Q34687|Q34687/Rosa ]] (the biological taxon) as the first argument also returns the lexeme [[d:Lexeme:L18379|L18379/rose]], because that lexeme is related (via its 3 senses) to all 3 of those items. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''' '''3''': Calling [[Z6830|<u>Find lexemes for an item</u>]] with [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/demonym of]], and [[Z1002|<u>Z1002/English</u>]] returns a list containing the [[Z6095|<u>Wikidata lexeme reference</u>]] for [[d:Lexeme:L34519|L34519/Dutch]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For an example in which [[Z6830|<u>Find lexemes for an item</u>]] is used in generating a natural language phrase, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2025-02-26}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Function: [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Argument types: [[Z6096|<u>Wikidata lexeme sense reference</u>]], [[Z6092|<u>Wikidata property reference</u>]], [[Z60|<u>Natural language</u>]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Return value type: List of [[Z6095|<u>Wikidata lexeme reference</u>]]</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikidata also captures useful relationships between lexemes senses and other lexeme senses, such as the relationships expressed using the property [[:d:Property:P8471|pertainym of]], which links an adjective sense to a related noun sense (e.g. lunar → moon), or an adverb sense to a related adjective sense (e.g. slowly → slow). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> [[Z6831|<u>Find lexemes for a Wikidata lexeme sense</u>]] searches for lexemes that are related to a given lexeme sense by a given property, such as [[:d:Property:P8471|pertainym of]]. (Even though the relationships exist between pairs of ''lexeme senses'', Wikidata's API, and this function, return references to the ''lexeme(s)'' that contain the target sense(s).) </div> <span id="User_interface"></span> == Tyannwuan a̱tyunta̱m == <span id="Selectors"></span> === Nkyangkhai === [[File:Selecting a lexeme for "goose".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 1. Selecting a lexeme for "goose"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors make it possible, in Wikifunctions' user interface, to select an entity to be used. </div> <span lang="en" dir="ltr" class="mw-content-ltr">For example, when the user types a partial keyword in Wikifunctions' lexeme selector, the selector will query Wikidata for lexemes that match that partial keyword. (The search matches the partial keyword against the lemmas of all the lexemes on Wikidata.)</span> <span lang="en" dir="ltr" class="mw-content-ltr">It shows up to 10 of the current matches, and allows the user to pick one of them.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> It updates the matches list as more typing is done. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example''': Figure 1 shows the appearance of a lexeme selector, after typing in the 5 characters "goose". </div> <span lang="en" dir="ltr" class="mw-content-ltr">At this point the user is presented with 4 matching lexemes to choose from.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For an example in which this lexeme selector is used in preparing a function call, please see the ''Function of the Week'' section in {{ll|Wikifunctions:Status updates/2024-10-17}}.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Note that the presence of a Wikidata selector is indicated by the Wikidata icon (with vertical bars in red, green, and blue). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once a choice has been made by the user, the selector will generate the appropriate internal representation of the selected item, depending on context: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">an instance of the appropriate Wikidata reference type, if that's all that's needed, or</span> # <span lang="en" dir="ltr" class="mw-content-ltr">a call to the appropriate fetch function, with an instance of the reference type as the argument passed to that call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Selectors are primarily used when providing the arguments for a function call in the UI, and the called function provides the relevant context. </div> <span lang="en" dir="ltr" class="mw-content-ltr">If the user is specifying a value for an argument having a Wikidata reference type as its type, the selector will provide (1).</span> <span lang="en" dir="ltr" class="mw-content-ltr">In this case, no fetch is performed.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If the argument in question has a Wikidata type as its type, the selector will provide (2), which will internally fetch the entire object and make it available to the called function. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Display elements === </div> [[File:Compact view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 2. Compact view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions also provides a simplified, compact view of Wikidata entities. </div> <span lang="en" dir="ltr" class="mw-content-ltr">This view is displayed in read pages and when viewing the output of a function call.</span> <span lang="en" dir="ltr" class="mw-content-ltr">This compact view displays the Wikidata icon followed by a word-form associated with the Wikidata entity (e.g., a lemma from a lexeme, representation from a lexeme form, or label from an entity), in the user's language if available.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The word-form is linked to the Wikidata page from which the entity has been fetched. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 2 shows the compact view, below the word '''Result''', of the [[Z6824|<u>Wikidata lexeme form</u>]] for ''umbrellas'' (which is called the ''representation'' of the form). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the initial appearance of the result of running a function that returns a lexeme form. </div> [[File:Expanded view of lexeme form for "umbrellas".png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Fig. 3. Expanded view of the lexeme form for "umbrellas"</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> If there's a need to explore the entity and its details, it can be expanded using the right ''chevron'' button (which looks like '>') preceding the element. </div> <span lang="en" dir="ltr" class="mw-content-ltr">The expanded view allows the user to understand what kind of representation is being used for this entity.</span> <span lang="en" dir="ltr" class="mw-content-ltr">The representation might employ a Wikidata reference type, a function call to the appropriate Wikidata fetch function, or the entire entity instance returned by that function call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> In any case, the user will be able to expand, explore and navigate through its content. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Example:''' Figure 3 shows the expanded view of the lexeme form for ''umbrellas'', which results from clicking the chevron in Figure 2. </div> <span lang="en" dir="ltr" class="mw-content-ltr">Here we see the presentation of the entire instance of [[Z6824|<u>Wikidata lexeme form</u>]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Each of the form's nested components with a chevron (e.g., <code>identity</code>, <code>lexeme</code>, etc.), can be expanded for further exploration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Status of UI components for Wikidata entity types === </div> * [[Z6825|<u>La̱kzi̱m Wukideita</u>]] ** Tyai ma̱ng kyangkhai: nshyia̱ * [[Z6824|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata lexeme form</span></u>]] ** Tyai ma̱ng kyangkhai: nshyia̱ * [[Z6826|<u>A̱ma̱nyi la̱kzi̱m Wukideita</u>]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Display and selector: date of release not yet determined</span> * [[Z6821|<u>A̱ngga Wukideita</u>]] ** Tyai ma̱ng kyangkhai: nshyia̱ * [[Z6822|<u><span lang="en" dir="ltr" class="mw-content-ltr">Wikidata property</span></u>]] ** Tyai ma̱ng kyangkhai: nshyia̱ <div lang="en" dir="ltr" class="mw-content-ltr"> === Limitations of UI components for Wikidata entity types === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Visual discrimination'''. Currently the Wikifunctions UI is lacking in visual discrimination between the various Wikidata entity types: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The selectors for the other entity types look very similar to that for Wikidata lexemes, shown in Figure 1.</span> <span lang="en" dir="ltr" class="mw-content-ltr">There is no explicit indication of which type is being selected.</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workarounds: Usually one knows from context which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In addition, the content of the selection choices (in the drop-down list) varies depending on which type of thing is being selected.</span> <span lang="en" dir="ltr" class="mw-content-ltr">For example, in a ''lexeme'' selector each choice shows its lemma, language, and part of speech (as shown in Figure 1), whereas in a ''lexeme form'' selector each choice shows its word-form and grammatical features, along with information that identifies its containing lexeme.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">The compact views for the other entity types look the same as that for Wikidata lexemes, shown in Figure 2. (That is, they only show the Wikidata icon and a single word form.)</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Workaround: If it's not obvious from context, one can click the chevron to get the expanded view of the entity, which explicitly states its type, as shown in Figure 3.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Missing compact views'''. Because the display elements for [[Z6006|<u>Wikidata lexeme sense</u>]] and [[Z6003|<u>Wikidata statement</u>]] have not yet been fully deployed, the presentation of elements of these types can be rather space-consuming, and can detract from the readability of larger entities that contain them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is especially true when a lexeme, lexeme form, or lexeme sense contains a sizable list of statements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> '''Mismatch in status'''. Even though the fetch function is available for [[Z6826|<u>Wikidata lexeme sense</u>]], the selector for that type is not yet available. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Appendix: an instance of Wikidata lexeme == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This example is introduced in the ''Example'' subsection of the ''Wikidata types'' section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It shows a specific instance of Wikidata lexeme, which has been fetched from [[:d:Lexeme:L3435|L3435 on Wikidata]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The right column shows the formal ZObject representation (in canonical form); the left column, for readability, shows the same content with English labels for each of the ZObject's elements. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions’ ZObject representation is presented in {{ll|Wikifunctions:Function model}}; we do not explain the details of the representation here. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The example has been shortened by omitting some content, as indicated by ellipses. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For readability, it also omits the element type indication that normally appears in the first position of each list in canonical form. </div> {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] pl7i5ko9pk4y5jy9unexjhy38a2kc57 Wikifunctions:Type/kcg 4 68246 276520 270486 2026-05-20T06:23:26Z FuzzyBot 207 Updating to match new version of source page 276520 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} <div lang="en" dir="ltr" class="mw-content-ltr"> Every Object in Wikifunctions belongs to a Type. Types decide how Objects of that Type are structured, and what they mean. Types are also used to specify the Arguments of a Function, and what a Function returns. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Currently, there are <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Types that are available for specifying the Arguments and the return Type of a Function: </div> * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (<span lang="en" dir="ltr" class="mw-content-ltr">this is parameterised i.e. it is a Function which returns a Type</span>) * {{Z+|Z882}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z883}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised</span>) * {{Z+|Z6884}} (<span lang="en" dir="ltr" class="mw-content-ltr">parameterised, used for defining [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|lightweight enumeration types]]</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === Numeric types === </div> * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Language and text types === </div> * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Grammatical feature enums ==== </div> * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="Calendar_types"></span> === Ntangka̱i ka̱la̱nda === <span id="Gregorian_calendar"></span> ==== Ka̱la̱nda Gi̱regi̱ri ==== * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="Igbo_calendar"></span> ==== Ka̱la̱nda A̱kum-a̱cyi ==== * {{Z+|Z16927}} <span id="Wikidata_types"></span> === Ntangka̱i Wukideita === {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata entities ==== </div> * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <span id="Wikidata_references"></span> ==== Ya̱fang Wukideita ==== * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <span id="Wikidata_statements"></span> ==== Á̱lyiat Wukideita ==== * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Wikidata datatypes ==== </div> * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Miscellaneous === </div> * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> === WikiLambda structure === </div> * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Evaluation ==== </div> * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} <div lang="en" dir="ltr" class="mw-content-ltr"> Other types can be used but there may be bugs. For a list of all types, see [[Special:ListObjectsByType/Z4|the list of all types]] (though that does not include [[Special:ListObjectsByType/Z7|persistent calls]] which return types, such as the lightweight enums, nor parameterised types such as {{Z|881}}). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> New Types can be proposed on [[Wikifunctions:Type proposals]]. </div> <span id="See_also"></span> == Bu nwuan == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] iuqrtmuvzbtfswh8t042udddpeyy6tg Z29718 0 69007 276317 274188 2026-05-19T22:27:15Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276317 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z29718" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6020", "Z17K2": "Z29718K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "type" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z29718K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "case no value" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z29718K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "case some value" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z29718K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "case value" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z29720", "Z29721", "Z29722" ], "Z8K4": [ "Z14", "Z35123", "Z29719" ], "Z8K5": "Z29718" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "select per Wikidata claim subtype" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "switch on Wikidata claim subtype" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } azs9j4zuw2ygpgnc48qb532hdxqgwtp Template:Main page/News/de 10 69043 276440 275111 2026-05-20T06:14:14Z Ameisenigel 44 Created page with "$1: Eine höhere Bedeutung" 276440 wikitext text/x-wiki <noinclude><languages /></noinclude> ; Freiwilligentreffen * Das nächste Freiwilligentreffen findet am <bdi lang="en" dir="ltr">[https://zonestamp.toolforge.org/1778520600 17:30 UTC on 2026-05-11]</bdi> auf <bdi lang="en" dir="ltr">Google Meet</bdi> unter <bdi lang="en" dir="ltr">[https://meet.google.com/xuy-njxh-rkw meet.google.com/xuy-njxh-rkw]</bdi> statt. * Das [[:c:File:Abstract Wikipedia Volunteer Corner 2026-05.webm|letzte Freiwilligentreffen]] ist auf Commons verfügbar ; Aktuelle Neuigkeiten zum Status von Wikifunctions <!--Keep this to the most recent 5 entries--> * {{Status updates|2026-05-15}}: Eine höhere Bedeutung * {{Status updates|2026-05-08}}: Einzelnachweise aus Wikidata jetzt verfügbar * {{Status updates|2026-05-02}}: Bitte um Anregungen: Was sollten wir für die Abstrakte Wikipedia zählen? * {{Status updates|2026-04-25}}: Die Suche der Foundation nach der perfekten Sprache * {{Status updates|2026-04-16}}: Meilensteine; Einige größere Probleme hoffentlich behoben [[Special:MyLanguage/Wikifunctions:Status updates|<span class="mw-ui-button mw-ui-constructive mw-ui-small">Weitere Neuigkeiten</span>]] nzby0ok6l6vs7jboqh4saubkbyyq511 Wikifunctions:Catalogue/Wikidata operations/Property 4 70153 276210 234374 2026-05-19T15:49:50Z Dv103 11127 /* Wikidata property operations */ 276210 wikitext text/x-wiki == Wikidata property operations == * {{Z+|Z6802}} * {{Z+|Z19267}} * {{Z+|Z20046}} * {{Z+|Z29727}} * {{Z+|Z6822}} ** {{Z+|Z35036}} * {{Z+|Z23223}} ** {{Z+|Z29829}} *** {{Z+|Z29825}} * {{Z+|Z23225}} * {{Z+|Z23227}} * {{Z+|Z23229}} === Search for === * [[Special:Search/: "Z8K2 Z6002" OR "Z8K2 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6002" OR "Z8K2 Z6092" OR "Z8K2 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6092"|Functions returning an explicit Wikidata property object or reference, singly or in a list]] * [[Special:Search/: "Z17K1 Z6002" OR "Z17K1 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6002" OR "Z17K1 Z6092" OR "Z17K1 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6092"|Functions expecting an explicit Wikidata property object or reference, singly or in a list]] [[Category:Lists of functions]] [[Category:Wikidata]] 8jkl0t9gnven4fik12jqepp9c5ge2jq 276220 276210 2026-05-19T16:10:04Z Dv103 11127 /* Wikidata property operations */ 276220 wikitext text/x-wiki == Wikidata property operations == * {{Z+|Z6802}} * {{Z+|Z19267}} * {{Z+|Z20046}} * {{Z+|Z29727}} * {{Z+|Z6822}} ** {{Z+|Z35036}} * {{Z+|Z23223}} ** {{Z+|Z29829}} *** {{Z+|Z29825}} * {{Z+|Z23225}} * {{Z+|Z23227}} * {{Z+|Z23229}} * {{Z+|Z35103}} * {{Z+|Z35364}} === Search for === * [[Special:Search/: "Z8K2 Z6002" OR "Z8K2 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6002" OR "Z8K2 Z6092" OR "Z8K2 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6092"|Functions returning an explicit Wikidata property object or reference, singly or in a list]] * [[Special:Search/: "Z17K1 Z6002" OR "Z17K1 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6002" OR "Z17K1 Z6092" OR "Z17K1 Z1K1 Z7 Z7K1 Z881 Z881K1 Z6092"|Functions expecting an explicit Wikidata property object or reference, singly or in a list]] [[Category:Lists of functions]] [[Category:Wikidata]] hladjfr45dzjhgwzdvuh6woz0rr2kec Z30397 0 70192 276203 276153 2026-05-19T15:30:47Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276203 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z30397" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30397K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30397K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30397K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "location" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z30398", "Z32605", "Z32603", "Z33425", "Z33471", "Z33469" ], "Z8K4": [ "Z14", "Z33429", "Z32738" ], "Z8K5": "Z30397" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "State location using entity and class, English" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 29lcfyhqvd5kxiqm1qjs8e660wfljdt Z30484 0 70307 276269 276161 2026-05-19T18:31:37Z Dv103 11127 Added Z35351, Z35358 and Z35359 to the approved list of test cases 276269 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z30484" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30484K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Entität" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30484K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Klasse" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30484K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Ort" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "location" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z30485", "Z35347", "Z35350", "Z35348", "Z35351", "Z35358", "Z35359" ], "Z8K4": [ "Z14", "Z30486" ], "Z8K5": "Z30484" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Ortsangabe mit Entität und Klasse in Deutsch" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "state location using entity and class, German" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 0vfpf2t85e1u2dllv42gi12w3frlexv 276287 276269 2026-05-19T19:22:32Z Dv103 11127 Removed Z35359 from the approved list of test cases 276287 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z30484" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30484K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Entität" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30484K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Klasse" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z30484K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Ort" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "location" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z30485", "Z35347", "Z35350", "Z35348", "Z35351", "Z35358" ], "Z8K4": [ "Z14", "Z30486" ], "Z8K5": "Z30484" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1430", "Z11K2": "Ortsangabe mit Entität und Klasse in Deutsch" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "state location using entity and class, German" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } cpleuoc1250wlitkxhu71px9cp3mawg Wikifunctions:How to create implementations/sr-ec 4 71819 276459 240261 2026-05-20T06:15:45Z FuzzyBot 207 Updating to match new version of source page 276459 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page provides a more detailed guide to '''creating implementations''', beyond the overview at {{ll|Wikifunctions:Introduction}}. </div> <span id="Types_of_Implementations"></span> == Врсте Имплементација == <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, an '''implementation''' can take one of two main forms: '''code''' or '''composition'''. A code implementation directly expresses the function’s logic in any of the available programming languages (currently, Python3 or JavaScript). It’s most useful when the function’s behavior can’t easily be built from existing Wikifunctions, or when precise control over data processing is needed. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A composition implementation, on the other hand, defines the function entirely by combining other existing functions, without writing code. Compositions are easier to understand, reuse, and translate into other languages automatically, but they depend on suitable building blocks already being available and often are less performant. In general, start by checking whether your goal can be achieved through composition; if it can’t, or if performance or fine-grained logic matters, choose a code implementation instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> There's a third type of implementation: '''built-ins'''. These are run by system-built code, and are not editable. Most likely all pre-defined functions will have a built-in implementation. In such cases, when opening the implementation page, you will see a message stating ''"{{int|wikilambda-implementation-selector-none}}"'' </div> <span id="Practice_Test-Driven_Development"></span> == Практикујте Развој Вођен Тестовима == <div lang="en" dir="ltr" class="mw-content-ltr"> '''Test-Driven Development''', or '''TDD''', is a way of creating software where you write tests before you write the actual code. Tests are just a way of understanding what your function is supposed to do by listing examples and how they should work. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In Wikifunctions, writing tests first offers significant benefits. If you are working on an implementation, you can run your code against the existing tests to check that it behaves as expected. This makes it easier to catch errors early before even publishing your implementation. Tests are also a powerful way to describe the function you need. By writing tests, '''you clearly communicate the expected behavior''', and the community can step in and help with the implementation, or create alternative implementations. </div> Замислите да желите да имплементирате Функцију која спаја два стринга са размаком између. Основни тест за ову функцију би могао да изгледа овако: <syntaxhighlight lang="prolog"> join_with_space( "Hello", "world" ) => "Hello world" </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Once you have defined the basic behavior, it's important to '''think about edge cases'''—situations where the inputs are such that you might need some special behavior. </div> На пример, шта ако се први стринг завршава размаком, или други стринг почиње размаком? Да ли би функција требало да задржи постојеће размаке и дода још један, или да врати резултат са само једним размаком између речи? У зависности од Ваших потреба, требало би написати тест за овај случај. На пример, тест за овај гранични случај би могао да изгледа као један од ова два: <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> или <syntaxhighlight lang="prolog"> join_with_space( "Hello ", " world") => "Hello world" </syntaxhighlight> Пробајте да покријете све могуће граничне случајеве тестовима. Након што завршите са писањем тестова, повежите их са функцијом кликом на дугме „Повежи”. <div lang="en" dir="ltr" class="mw-content-ltr"> == Code implementations == </div> [[File:Code implementation.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions code editor initialized with a function template</span>|<span lang="en" dir="ltr" class="mw-content-ltr">When adding a new code implementation, the function template is initialized with the function and argument names</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> When creating an implementation using code, the Wikifunctions UI will set up a code editor with the selected language activated for syntax highlighting and validation. When the function to implement and the programming language are selected, this editor will be set with the correct function template: '''do not remove or edit this'''! Keep your code inside this function signature: if you need auxiliary functions, you can simply declare them inside your top-level function declaration. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Using input types in your code === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions types {{Z|Z6}} and {{Z|Z40}} can be used as if they were native types in both JavaScript and Python3. For example, a String input can be concatenated or a Boolean be directly used in a logical expression. To use other types in your code implementations, you will have to look deeper into the type, figure out if it has a conversion to a native equivalent, and treat it accordingly. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, let's say we want to write some Python code that handles an input of type {{Z|Z20420}}. In the page for this type, let's look at its "type converters to code" and search for a Python one. The converter {{Z|Z20424}} will be applied to our date input before our code, so looking at "native type" we know that our input will be a Python ''dict'' and looking at the implementation we can see the keys we can expect: </div> <syntaxhighlight lang="python3"> return { 'K1': year, 'K2': month, 'K3': day } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> When a type doesn't have a converter, you'll have to access its parts directly using its keys. For example, let's assume that your function <code>Z30000</code> has one input <code>Z30000K1</code> of type {{Z|Z11}}. This type has two keys: <code>Z11K1</code> for the language (itself an object of type {{Z|Z60}}), and <code>Z11K2</code> for the string value. Similarly, the language object has a key <code>Z60K1</code> for the language code. So, to get a string with the language code and the text, you can write: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1 ) { // e.g. "en: some text" return Z30000K1.Z11K1.Z60K1 + ": " + Z30000K1.Z11K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> For a quick reference of the available type conversions visit [[Special:MyLanguage/Wikifunctions:Execution targets#Default type conversion|the default type conversion table]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Returning the right outputs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Similarly to the way you treat inputs, outputs need to match the type specified in the function definition. Some can be treated as simply as native types, so any string output will be converted into a Wikifunctions {{Z|Z6}} object and any native boolean returned by your implementation will be converted into a Wikifunctions {{Z|Z40}} object. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Those types that have "type converters from code" will apply the appropriate function to the output, in order to build the required type. Following the example of {{Z|Z20420}}, the {{Z|Z20443}} will transform the output from your implementation–a dict with K1, K2 and K3 keys–into its correct ZObject representation. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For types that don't have converters from code, you can carefully build and return the output objects. For example, imagine that our function <code>Z30000</code> takes two string inputs: language code and text, and should return a {{Z|Z11}} object. You can do this in Python by using the <code>ZObject</code> constructor: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): lang_object = ZObject( {"Z1K1": "Z9", "Z9K1": "Z60"}, Z60K1 = Z30000K1 ) return ZObject( {"Z1K1": "Z9", "Z9K1": "Z11"}, Z11K1 = lang_object, Z11K2 = Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in JavaScript: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { const langObject = new ZObject( new Map( [ [ "Z60K1", Z30000K1 ] ] ), { "Z1K1": "Z9", "Z9K1": "Z60" } ); const monolingualKeys = new Map( [ [ "Z11K1", langObject ], [ "Z11K2", Z30000K2 ] ] ); return new ZObject( monolingualKeys, { "Z1K1": "Z9", "Z9K1": "Z11" } ); } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> You can learn more about the <code>ZObject</code> class and other useful constructors in {{ll|Wikifunctions:Execution_targets#Custom_and_non-built-in_type_conversion}} </div> {{phab|T392750}}<div lang="en" dir="ltr" class="mw-content-ltr"> As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in Python === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in Python. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is Z30000. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function Z30000 with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As we described before, we know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as simply as we use native strings in Python. Also, the function should return a String. For our example, we simply return the two arguments concatenated with a space in between: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Since this is Python, do not forget to indent this line. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have followed our advice to [[#Practice Test-Driven Development|practice TDD]], you will already have a set of tests that you know should work. If that's the case, while building your implementation you can click on the circular arrow in the Tests panel, and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in Python, ask on [[Wikifunctions:Python implementations]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Code in JavaScript === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of Code in JavaScript. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The implementation is defined using the ZID of the function. So are the arguments of the function. So in the case of the function <code>Z30000</code> with its two arguments, the function template should look like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> We know that the arguments (<code>Z30000K1</code> and <code>Z30000K2</code>) are Strings, so we can treat them as native strings in JavaScript. Also, the function should return a String. To complete our function, you can then add a line concatenating the input strings, like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> If you have tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes all of them. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that the runtime has no state. Don’t assume values for global or static variables. If you have further questions about what you can and cannot do in JavaScript, ask on [[Wikifunctions:JavaScript implementations]]. </div> <span id="Compositions"></span> == Композиције == <div lang="en" dir="ltr" class="mw-content-ltr"> In this section, we give a concrete example on how to create an Implementation in the form of a composition. Say we want to create an implementation for a Function which combines two input strings by putting a space between them, returning the result of that. Let’s assume the ZID of that function is <code>Z30000</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> It is usually a good idea to first think about how to combine existing functions in order to create the desired output. Sometimes this might be trivial, and you can just go ahead with composing functions, but in many cases it is worthwhile to note the desired composition down. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For example, for the given Function, we could use the existing Function {{Z|Z10000}}. That Function takes two strings and makes one string out of them. But we need to add a space in between. So we first concatenate a space to the end of the first string, and then concatenate the second string to the result of that first concatenation. So our composition could be noted down like this: </div> <syntaxhighlight lang="prolog"> join_strings( join_strings( Z30000K1, " " ), Z30000K2 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> There are multiple ways to write a composition: notice that the same thing could be accomplished with: </div> <syntaxhighlight lang="prolog"> join_strings( Z30000K1, join_strings( " ", Z30000K2 ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> An alternative implementation could also use the existing Function {{Z|Z15175}}, so your composition could be: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> As you can see, there are multiple ways to accomplish this, so take your time and explore the existing functions available in the {{ll|Wikifunctions:Catalogue}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's try to create the second example, <code>join_strings(Z30000K1, join_strings(" ", Z30000K2))</code>. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In order to create this: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›" icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search for the name of the outermost function you want to use, which in this example is "join two strings". Then, select the wanted function from the dropdown list.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">You will see two new fields, one for each of the arguments needed for the selected function.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the first argument, we want to select the first input to our function:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "Argument reference".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id" you can now select the first string of your function from the dropdown, which contains all available inputs.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">For the second argument, we want to use the result of another call to "join two strings":</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "Function call".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function you want to call, which is again "join two strings".</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For this inner function call, configure the "first string" by simply typing a white space in the text field, and configure the "second string" as you did for step 6: change it using the "…" button to "Argument reference", and then select the second argument in the dropdown.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Your composition is now complete! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You can expand and collapse the details using the chevron buttons to see how it looks. If you already have Tests as recommended in the [[#Practice Test-Driven Development|TDD]] section above, click on the circular arrow in the Tests panel and see if your implementation passes the tests. Once your composition passes the tests, go ahead and publish it. </div> [[File:Composition implementation expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its expanded view</span>]] [[File:Composition implementation collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">A Wikifunctions composition implementation in its collapsed view</span>]] <span id="Wikifunctions_error_handling"></span> == Обрада грешака на Викифункцијама == <div lang="en" dir="ltr" class="mw-content-ltr"> As a Wikifunctions function creator, you might want to warn the user calling your function when something goes wrong in the code, or when their inputs do not fit a certain criteria. For example, if your Function expects a string input to contain a name, you might want to check that the name is not empty and, if it is, show an error message that the person using your Function can understand. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For this purpose, you can use <code>Wikifunctions.Error()</code> from your code implementations or the function {{Z|Z851}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to throw errors from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to write tests for error cases, and</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to catch and handle errors thrown by functions that you are using in your compositions.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Throwing errors from code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python, you can use <code>Wikifunctions.Error()</code> to end the execution with a wanted error. </div> <code>Wikifunctions.Error()</code> има два параметра: # Тип грешке: стринг који садржи ZID врсте грешке коју желите да вратите. # <span lang="en" dir="ltr" class="mw-content-ltr">Error arguments: a list of string arguments to build the error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's go one by one: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error type ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> An error type is an object that describes a kind of error that could happen in the system. There are a number of built-in error types but you can also build other error types that are more suited to your use case. When using errors, the best idea is to browse through the available error types, which can be explored in [[Special:ListObjectsByType/Z50|this list]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If there are no errors that fit your case, create a new one by going to the create page, and selecting "Error type" in the type selector. Then, set the necessary fields: </div> [[File:Error type.png|thumb|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Error type creation in Wikifunctions</span>|<span lang="en" dir="ltr" class="mw-content-ltr">To create new Error type (Z50), edit the label and add the necessary keys.</span>]] * <span lang="en" dir="ltr" class="mw-content-ltr">'''Label''' – This is the main title of the error, which should contain a short but descriptive message. Set the error label on the right-side box titled "About".</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Keys''' – Keys contain additional information about what caused the error. For example, if an input had the wrong format, you might want to inform the user of what was the input content when raising the error. To use them in your implementations, keys should be strings. To create a key, click on the "[+]" icon below "keys", select "String" under "value type", and add a label that describes it appropriately, for example "current input". Once you have all the necessary keys, you can Publish your error type and keep the ID of the newly created object.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Error arguments ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Error arguments correspond to the keys of the Error type, and they should provide additional information to understand the error. Error arguments should always be Strings. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Wikifunctions.Error() ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want an error to be thrown when either your first or your second input are empty. You have already created the error type, and the assigned ZID was <code>Z30005</code>. Your error type has two string keys: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Input key: contains the key of the failing input</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Input value: contains the current value of the failing input</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your JavaScript implementation you should do something like this: </div> <syntaxhighlight lang="javascript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { // If the first input is empty, raise error Z30005 // with two string args: [ first input key, first input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { // If the second input is empty, raise error Z30005 // with two string args: [ second input key, second input value ] Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To raise an error in your Python implementation you should do something like this: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": # If the first input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": # If the second input is empty, raise error Z30005 # with two string args: [ first input key, first input value ] Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Remember that calling <code>Wikifunctions.Error()</code> ends the execution! </div> <span id="Throwing_errors_from_compositions"></span> === Бацање грешака у композицијама === Ако правите композицију, можете бацити грешку позивом посебне функције {{Z|Z851}}. <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Throw Error function (Z851) ==== </div> Функција {{Z|Z851}} је слична методи <code>Wikifunctions.Error()</code> и прима два аргумента: * '''Врста грешке''' – Референца на Врсту грешке коју желите да баците * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error parameters''' – A list with the arguments to create your Error, which should also be Strings.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Throw Error ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to modify your composition so that it first checks that the arguments are not empty, and raises an error when it finds an empty one. Then, if none of them are empty, it runs the original composition, which is: </div> <syntaxhighlight lang="prolog"> join_with_separator( Z30000K1, Z30000K2, " " ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> To do this, you need to create conditional paths, for which you can use the {{Z|Z802}} function. Think of it like this: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the first argument is empty, throw an error for the first argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed to check the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the second argument is empty, throw an error for the second argument</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Else, proceed with the success path and return the joint strings with the space separator</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Or in functional pseudo code: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), throw_error( Z30005, [ "Z30000K1", Z30000K1 ] ), if( is_empty_string( Z30000K2 ), throw_error( Z30005, [ "Z30000K2", Z30000K2 ] ), join_with_separator( Z30000K1, Z30000K2, " " ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+” button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "if".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Check the validity of the first argument:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "condition", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "is empty string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "input", click on the "…" button and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "condition" function call if you want, by clicking on the down-chevron next to "condition". You should see something like "f(x) is empty string( → first string )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Throw error if the condition is true:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "then", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Throw Error"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select your error type (you can directly input the error ID if you know it, e.g. Z30005)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error parameters", add two items by clicking on the "+" button</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 1" (offending argument key), set its type to "String" and write the argument identifier (e.g. "first input", or "Z30000K1")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">For "Item 2" (offending argument value), click on the "…" next to "Item 2" and select "argument reference"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "key id", select the first input (e.g. "first string")</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse the "then" function call if you want, by clicking on the down-chevron next to "then". You should see something like "f(x) Throw Error( Input was the wrong format, Typed list( Object, "first input", → first string ) )"</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Continue to check the second argument if the first was good:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "if"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "condition" to check the validity of the second argument by following the same process as described in step 5.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Set up "then" to throw an error for the second argument by following the same process as described in step 6.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Finally, set up the success path:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to the nested "else", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the successful function, which in this case can be "join strings with separator"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and set it to "argument reference", then select "first string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and set it to "argument reference", then select "second string"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "separator" add a space into the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function call should look like this: </div> [[File:Throw error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function</span>]] [[File:Throw error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Throw Error function, in its collapsed view</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Handling errors in compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While it is useful to allow functions to raise expected errors, it is crucial to be able to handle errors in your compositions in order to safely use these functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say you want to create a new function "full name of a person" – we will refer to it with the ZID <code>Z30010</code>. This function should return the full name of a person given a first and last names, but if any of the two fields are empty, it should return the text "Unknown" instead. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You could create a composition using our example function "Join two strings with a space" or <code>Z30000</code> to generate the name. If any of the inputs are empty, you know that <code>Z30000</code> will throw an error of type <code>Z30005</code>. Using the function {{Z|Z850}} as a wrapper, you can attempt the join operation and intercept a possible error to simply return "Unknown" whenever it occurs. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Try-Catch function (Z850) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z850}} function is built-in with ZID <code>Z850</code> and takes three arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – The initial function call to run. If nothing goes wrong, the response will be the result of this function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – An error type to catch in case it is thrown during the execution of the first function call.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error handler''' – A function call that will be run in case the error specified above is caught during the execution of the initial function call. If that happens, the result of the error handler will be the value returned.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Try-Catch ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Once we have all the functions for our composition, we can craft it like this: </div> <syntaxhighlight lang="prolog"> try_catch( join_with_space( Z30010K1, Z30010K2 ), Z30005, echo( "Unknown" ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This means that: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">The "Join two strings with a space" function will be tried with the two inputs and, if everything goes well, the output of this function will be returned</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If any of the inputs are blank, "Join two strings with a space" with raise an error of type <code>Z30005</code></span> * <span lang="en" dir="ltr" class="mw-content-ltr">Our {{Z|Z850}} will then detect this error and run the {{Z|Z801}} function to return "Unknown"</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's create this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding an implementation by clicking on the "+" button in the "Implementations" table from your Function page.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Make sure that the option "composition" under "Implementation" is selected.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Click on the "›” icon or click the "Select Function" link to expand the function details.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the outermost function you want to use, which in this case is "Try-Catch".</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the main function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under the field where the "Try-Catch" function is selected, next to the "function call" key, click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function" search and select the function "join two strings with space"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "first string", click on the "…" button and select "argument reference", then select the "first name" argument from the dropdown.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "second string", click on the "…" button and select "argument reference", then select the "second name" argument from the dropdown.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Select the error to catch:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "error type", search and select "bad string input" – you can search directly by its ZID <code>Z30005</code></span> # <span lang="en" dir="ltr" class="mw-content-ltr">Set the error handler function call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "error handler", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "echo"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "input" and "type", search and select the type "String"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now, under "input", type "Unknown" in the text field</span> <div lang="en" dir="ltr" class="mw-content-ltr"> The resulting function should look like this: </div> [[File:Try catch expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in expanded mode</span>]] [[File:Try catch collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Wikifunctions composition using Try-catch function, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Testing your failure use cases === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As we introduced in the above section about [[#Practice Test-Driven Development|practicing TDD]], it's important to test not only the most common paths, but also the possible edge cases. It is equally important to test failure behavior. In this section we will give you the tools necessary to test that your function fails with a given set of inputs, and that the error thrown is the expected one. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To do that, you will need other two system functions: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Is error type (Z852) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z852}} function is built-in with ZID <code>Z852</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error''' – An {{Z|Z5}} object, which can be thrown by a failing call. An error instance has a type and a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Error type''' – A reference to an {{Z|Z50}} which will be compared to the type of the Error passed as a first argument. If that's the case, the function will return true.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Get error thrown by function call (Z853) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z853}} function is built-in with ZID <code>Z853</code> and takes one argument: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – A function call which can either return a successful value of any type, or throw an error.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This function returns a {{Z|Z882}} with a {{Z|Z40}} in first place and an {{Z|Z1}} in the second: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call runs successfully and hence does not throw any error, the returned pair will contain False in the first place, and void in the second.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the Function call throws an error, the returned pair will contain True in the first place, and the caught error in the second.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> To use this function in your compositions, you might need to use the additional functions: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">{{Z|Z821}}, and</span> * {{Z|Z822}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Testing errors ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say our target function, "Join two strings with a space" or <code>Z30000</code>, throws an error of type <code>Z30005</code> and we want to test this behavior. To do that we need to: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Throw a failing function call</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get the error using the function {{Z|Z853}}</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Check that the error is the right type with {{Z|Z852}}</span> <div lang="en" dir="ltr" class="mw-content-ltr"> Tests have two fields: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Call''' – A function call that will produce an output with the inputs you want to test. This call will return a value.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Result validation''' – A function call that will validate that the value returned by the call above is the expected one. The first argument of this function call will be automatically assigned to take the return value of the first call.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> For step-by-step instructions on how to create tests, see {{ll|Wikifunctions:Introduction#Create_tests}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In our example, we can structure it like this — but this is not the only way! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The call, which will return an {{Z|Z5}} object: </div> <syntaxhighlight lang="prolog"> error = get_second_element_of_typed_list( get_error_thrown_by( join_strings_by_whitespace( "", "not empty" ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the result validation, which will take the {{Z|Z5}} object as its first argument: </div> <syntaxhighlight lang="prolog"> is_error_type( error, Z30005 ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> Let's do this step by step: </div> # <span lang="en" dir="ltr" class="mw-content-ltr">Start adding a test by clicking on the "+" button in the "Tests" table from your Function page. The "call" and "result validation" fields already have some functions pre-set, but to test the errors we will need to change them.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">First, let's set the call:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "call", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Get second element of a typed pair"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Once selected, next to "Typed pair", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Get error thrown by function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Next to "function call", click on the "…" button and select "function call"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", search and select the function "Join two strings with a space" (or by ZID <code>Z30000</code>)</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now set the inputs so that they cause a failure: at least one of them should be empty.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">You can now collapse your "call" by clicking again on the down-chevron button if you want!</span> # <span lang="en" dir="ltr" class="mw-content-ltr">Next, let's set the result validation:</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "result validation", click the "›" chevron button to expand the function call.</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Under "function", edit the field and search and select the function "Is error type"</span> ## <span lang="en" dir="ltr" class="mw-content-ltr">Now you will only be asked to configure the second argument. Under "error type", search and select your <code>Z30005</code> error type.</span> # <span lang="en" dir="ltr" class="mw-content-ltr">And you are done! You can now click the circular arrow in the "Implementations" box and you should see green checks.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> If everything went right, you can now save your test. It should look like this: </div> [[File:Get error expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in expanded mode</span>]] [[File:Get error collapsed.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Testing a failure using Get error and Is error type functions, in collapsed mode</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Debugging your implementations == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Sometimes things can go wrong. A function might behave differently than expected or a value might not look quite right. Sometimes implementations are really complex and, because they are run in a sandboxed environment, it can seem really difficult to debug. To help understand what's going on inside a function call, Wikifunctions includes a small set of debugging tools. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These tools don't change the result of a function, but will add extra information to the returned metadata, which you can observe after running the function. You can use <code>Wikifunctions.Debug()</code> from your code implementations or the function {{Z|Z854}} from your compositions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In this section you will learn: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">How to add debug messages from both code and composition implementations,</span> * <span lang="en" dir="ltr" class="mw-content-ltr">how to inspect the metadata manually or via the UI to inspect these logs.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your code implementations === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When writing code, both from JavaScript and Python3, you can use <code>Wikifunctions.Debug()</code> to add a message to your debugging log and continue the execution. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <code>Wikifunctions.Debug()</code> has one parameter, which is generally expected to be a string. However, any other object passed as parameter will get directly converted into a string. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> If we want to add debug logs to our code implementations for our "Join two strings with a space" example function, we can do, in JavaScript: </div> <syntaxhighlight lang="JavaScript"> function Z30000( Z30000K1, Z30000K2 ) { if ( trim( Z30000K1 ) === '' ) { Wikifunctions.Debug( `first input is empty "${ Z30000K1 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K1", Z30000K1 ] ) } if ( trim( Z30000K2 ) === '' ) { Wikifunctions.Debug( `second input is empty "${ Z30000K2 }"` ); Wikifunctions.Error( 'Z30005', [ "Z30000K2", Z30000K2 ] ) } Wikifunctions.Debug( "both inputs are fine" ); return Z30000K1 + " " + Z30000K2; } </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> And the same in your Python3 implementation will be: </div> <syntaxhighlight lang="python3"> def Z30000(Z30000K1, Z30000K2): if Z30000K1.strip() == "": Wikifunctions.Debug( 'first input is empty "'+Z30000K1+'"' ) Wikifunctions.Error("Z30005", ["Z30000K1", Z30000K1]) if Z30000K2.strip() == "": Wikifunctions.Debug( 'second input is empty "'+Z30000K2+'"' ) Wikifunctions.Error("Z30005", ["Z30000K2", Z30000K2]) Wikifunctions.Debug( 'both inputs are fine' ) return Z30000K1 + " " + Z30000K2 </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, no matter what happens, we will be adding one message to your debugging logs: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call fails when checking on the first or second input, the result of the execution will be a failure, but it will contain one informative log about what branch caused the failure.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">If the function call succeeds—because both inputs are valid—the function call will return the joined string, but the returned metadata will also contain a debug log.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Debugging your compositions === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To support debugging compositions, Wikifunctions provides the built-in function {{Z|Z854}}. This function allows you to attach debug messages to the execution of any function call that generates the final output. The debug logs collected during the evaluation are returned as part of the execution metadata, under the <code>executorDebugLogs</code> key. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Add debug log to function call (Z854) ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The {{Z|Z854}} function is built-in with ZID <code>Z854</code> and takes two arguments: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Function call''' – Any composition you want to execute.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">'''Debug log''' – A string message that will be recorded if the given function call is evaluated.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> When the wrapped function call runs, the provided message is added to the execution logs. If that function call is not executed, or its execution is not part of the final output, its debug log will not appear in the final result metadata. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> You will benefit from this built-in if you want to observe: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Which branch of a conditional was executed, or</span> * <span lang="en" dir="ltr" class="mw-content-ltr">the order of evaluation in a composition.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Using Add debug log to function call ==== </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Say that you want to add debug logs to our example function "Join two strings with a space" or <code>Z30000</code>, so that different messages are added to the different possible outcomes. You could use our debugging builtin like this: </div> <syntaxhighlight lang="prolog"> if ( is_empty_string( Z30000K1 ), add_debug_log( throw_error( Z30005, ... ), 'failed on first input' ) if( is_empty_string( Z30000K2 ), add_debug_log( throw_error( Z30005, ... ), 'failed on second input' ), add_debug_log( join_with_separator( Z30000K1, Z30000K2, " " ), 'both inputs are ok!' ) ) ) </syntaxhighlight> <div lang="en" dir="ltr" class="mw-content-ltr"> This way, </div> * <span lang="en" dir="ltr" class="mw-content-ltr">when called with an empty first input, the function will return a failed response, and the metadata will contain an <code>executorDebugLogs</code> entry with the "failed on first input" log.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with an empty second input, the call will also fail, but the logged message will be "failed on second input"</span> * <span lang="en" dir="ltr" class="mw-content-ltr">When called with valid inputs, the function will return a successful response, and additionally the metadata will contain "both inputs are ok" in its <code>executorDebugLogs</code> key.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> This is the way this composition would look: </div> [[File:Add debug log expanded.png|frame|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>|<span lang="en" dir="ltr" class="mw-content-ltr">Composition implementation using Add debug logs to log all possible execution paths</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> === Accessing execution debug logs === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Whether your execution logs are added via <code>Wikifunctions.Debug()</code> or via the {{Z|Z854}} built-in function, they are returned as part of the response metadata. To see the logs, once you run your function, click on the "Details" button that appears at the bottom of the "Result" section. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The error and debug information will appear at the top of the "Details" dialog. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> This is what you would see when running the composition from our previous example with valid and invalid inputs: </div> {| class="wikitable" | [[File:Execution logs success.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution with debug logs</span>]] | [[File:Execution logs failure.png|frameless|center|alt=<span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution with debug logs</span>]] |- | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a successful execution: shows no errors, but displays the successful execution log: ''"both inputs are ok!"''</span> | <span lang="en" dir="ltr" class="mw-content-ltr">Function metadata dialog for a failed execution: shows the error information, and the additional execution log for the first failure branch: ''"failed on first input"''</span> |} [[Category:How to create implementations| {{#translation:}}]] 18sqsm66pt601uu2ei5bau3k1wy15v4 Wikifunctions:Type/fr 4 72253 276517 270484 2026-05-20T06:23:23Z FuzzyBot 207 Updating to match new version of source page 276517 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} Chaque objet de Wikifunctions possède un type. Le type est caractéristique de la structure des objets qui l'utilisent et de ce qu'ils signifient. Le type spécifie également les arguments d'une fonction, ainsi que ce qu'elle renvoie. Nous disposons actuellement de <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} types disponibles pour les arguments ainsi que pour le type renvoyé par une fonction : * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (c'est paramétré, par exemple c'est une fonction qui renvoie un type) * {{Z+|Z882}} (paramétré) * {{Z+|Z883}} (paramétré) * {{Z+|Z6884}} (paramétré, utilisé pour définir les [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|types d'énumération de faible poids]] (''lightweight enumeration'')) <span id="Numeric_types"></span> === Types numériques === * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <span id="Language_and_text_types"></span> === Langues et types de texte === * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <span id="Grammatical_feature_enums"></span> ==== Listes énumérées des fonctionnalités grammaticales ==== * {{Z+|Z28516}} (énumération de faible poids) * {{Z+|Z28519}} (énumération de faible poids) * {{Z+|Z25502}} (énumération de faible poids) * {{Z+|Z25340}} (énumération de faible poids) * {{Z+|Z25501}} (énumération de faible poids) * {{Z+|Z26935}} (énumération de faible poids) * {{Z+|Z26934}} (énumération de faible poids) * {{Z+|Z28215}} (énumération de faible poids) * {{Z+|Z28515}} (énumération de faible poids) * {{Z+|Z28517}} (énumération de faible poids) * {{Z+|Z32792}} (énumération de faible poids) * {{Z+|Z32789}} (énumération de faible poids) * {{Z+|Z27970}} (énumération de faible poids) * {{Z+|Z28518}} (énumération de faible poids) * {{Z+|Z28520}} (énumération de faible poids) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (énumération de faible poids) <span id="Calendar_types"></span> === Types calendrier === <span id="Gregorian_calendar"></span> ==== Calendrier grégorien ==== * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <span id="Hijri_(Islamic)_calendar"></span> ==== Calendrier hijri (islamique) ==== * {{Z+|Z26582}} (énumération de faible poids) <span id="Igbo_calendar"></span> ==== Calendrier igbo ==== * {{Z+|Z16927}} <span id="Wikidata_types"></span> === Types Wikidata === {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <span id="Wikidata_entities"></span> ==== Entités Wikidata ==== * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <span id="Wikidata_references"></span> ==== Références Wikidata ==== * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <span id="Wikidata_statements"></span> ==== Déclarations Wikidata ==== * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <span id="Wikidata_datatypes"></span> ==== Types de données Wikidata ==== * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (énumération de faible poids) * {{Z+|Z6063}} (énumération de faible poids) * {{Z+|Z6064}} <span id="Miscellaneous"></span> === Divers === * {{Z+|Z27951}} (énumération de faible poids) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="WikiLambda_structure"></span> === Structure WikiLambda === * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} ==== Evaluation ==== * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} D'autres types peuvent être utilisés mais des bogues peuvent apparaître. Voir la [[Special:ListObjectsByType/Z4|liste des tous les types]] (bien que cela ne comprend ni les [[Special:ListObjectsByType/Z7|appels persistents]] qui renvoient des types, comme les listes énumérées ''lightweight'', ni les types paramétrés tels que {{Z|881}}). Vous pouvez proposer de nouveaux types sur [[Wikifunctions:Type proposals]]. <span id="See_also"></span> == Voir aussi == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] nuz2rxzewfdiyyy2gocshl6fmsjtgg6 Wikifunctions:Support for Wikidata content/fr 4 73103 276494 265322 2026-05-20T06:21:49Z FuzzyBot 207 Updating to match new version of source page 276494 wikitext text/x-wiki <languages/> {{AW Content}}{{Technical documentation navbox}} Wikifunctions fournit le support pour récupérer et utiliser le contenu de Wikidata, y compris le contenu encyclopédique contenu initialement dans les ''éléments'' ainsi que le contenu lexicographique se trouvant dans les ''Lexèmes, Formes de lexème'', et ''Sens de lexème''. Depuis que les instances de ces quatre types de contenu peuvent contenir des ''Déclarations'', Wikifunctions intègre également le support des ''Déclaraions'' et leurs composants, y compris les ''Propriétés'', les ''Rangs de déclaration'', les ''Qualifieurs'', et (bientôt) les ''Références''. Vous trouverez la documentation des types lexicographiques Wikidata sur [[:d:Special:MyLanguage/WD:Lexicographical data/Documentation|Lexicographical data/Documentation]], et celle des autres types Wikidata sur [[mw:Special:MyLanguage/Wikibase/DataModel|Wikibase/DataModel]]. '''Note de terminologie''': sur Wikidata, ''Elément, Propriété, Lexème, Forme de lexème'' et ''Sens de lexème'' sont des types qui concernent toutes les ''entités''; nous les référençons donc en tant que ''types d'entités''. Le support actuellement implémenté comprend : # les types implémentés correspondant aux 5 types d'entités ''Déclaration'' et ''Rang de déclaration'' # Un type implémenté "Référence" correspondant au type ''ReferenceRecord'' de Wikidata # Il existe un type intégré ''Claim'' ou affirmation <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Claim|glossaire]] ]</sup> qui correspond au type {{Q|86719099}} <sup>[ [[d:Special:MyLanguage/Wikidata:Glossary#Snak|glossaire]] ]</sup> de Wikidata, et qui est utilisé dans la représentation Wikifunctions des qualifieurs et des références à l'intérieur des déclarations # ''Types de référence'' intégrés correspondant aux 5 types d'entités # ''Fonctions de recherche'' intégrées, pour chacun des types d'entité, qui récupèrent le contenu de Wikidata et le transforment en instances de types intégrés # ''Fonctions de recherche'' intégrées qui fournissent des méthodes pour chercher des lexèmes à partir de leurs relations avec d'autres entités # Components d'interface utilisateur pour sélectionner et afficher le contenu de Wikidata à récupérer. '''Notes de terminologie''' : * Nous nous nommerons les types intégrés de (1) -- (3) les “types Wikidata”, et les types intégrés de (4) les “types de référence Wikidata”, mais notez que tous sont des types '''de Wikifunctions''' qui travaillent avec le contenu '''de Wikidata'''. Quand un de ces types est utilisé ci-dessous, il est souligné et comporte un lien si sa définition se trouve actuellement dans Wikifunctions (par exemple pour [[Z6005|<u>lexème Wikidata</u>]]). * Afin que tout soit clair, si un type se trouve ''en italiques'' (tel que ''Lexeme'' ou ''Item'') cela signifie qu'il existe '''dans Wikidata'''. Par exemple nous parlerons du type de [[Z6005|<u>Lexème Wikidata</u>]] créé dans Wikifunctions, qui correspond au type ''Lexème'' dans Wikidata. * Les ''types de référence'' mentionnés dans (4) ne sont pas liés au type "Reference" mentionné dans (2). (4) fournit un moyen de se référer aux entités de Wikidata en utilisant leur identifiant, tandis que (2) recueille les sources qui fournissent un contenu particulier. Cette page décrit chacun de domaines du support ci-dessus. Tout ce qui s'y trouve est déployé et disponible sauf contre-indication mentionnée à certains endroits. <span id="Wikidata_types"></span> == Types Wikidata == Les types suivants ont été définis avec leur structure et suivent étroitement la structure des types correspondants de Wikidata : * [[Z6005|<u>lexeme Wikidata</u>]] * [[Z6004|<u>Forme de lexème Wikidata</u>]] * [[Z6006|<u>Sens de lexème Wikidata</u>]] * [[Z6003|<u>Déclaration Wikidata</u>]] * [[Z6002|<u>Propriété Wikidata</u>]] * [[Z6001|<u>Elément Wikidata</u>]] * [[Z6040|<u>Rang de déclaration Wikidata</u>]] * [[Z6008|<u>Référence Wikidata</u>]] * [[Z6007|<u> Wikidata claim</u>]], correspond au type ''Snak'' de Wikidata * [[Z6020|<u>sous-type d'affirmation Wikidata</u>]], capture les 3 types de ''Snak'' sur Wikidata Les instances de ces types ne sont jamais rendues persistentes dans Wikifunctions (sauf pour les instances de [[Z6040|<u>rang de déclaration Wikidata</u>]] et [[Z6020|<u>sous-type d'affirmation Wikidata</u>]]). Elles sont construites directement à la volée, quand c'est nécessaire, et récupérées directement de Wikidata. Les instances des types d'entités transportent en elles l'identifiant de l'entité Wikidata de laquelle elles sont issues. [[Z6040|<u>rang de la déclaration Wikidata</u>]] est un type d'énumération qui n'a que 3 instances fixes <u>préféré</u>, <u>normal</u>, and <u>obsolète</u>. Le [[Z6020|<u>sous-type d'affirmation Wikidata</u>]] est un type d'énumération qui ne possède que 3 instances fixes <u>valeur</u>, <u>certaine valeur</u>, et <u>pas de valeur</u>. Des informations complémentaires, les motivations, et les exemples des types Wikidata se trouvent sur la [[Wikifunctions:Type proposals/Wikidata based types|page de discussion des propositions de types]] (mais notez que cette page n'est plus active et que les détails ne sont pas forcément à jour). <span id="Example"></span> === Exemple === Une instance de [[Z6005|<u>lexème Wikidata</u>]] comporte ces 7 parties : # l'identité, avec une valeur pour le type [[Z6095|<u>référence de lexème Wikidata</u>]] # les lemmes, avec une valeur pour le type [[Z12|Texte multilingue]] # langue, avec une valeur pour le type [[Z60|Langue naturelle]] # catégorie lexicale, avec une valeur pour le type [[Z6091|<u>référence d'élément Wikidata</u>]] # déclarations, dont la valeur est une liste de [[Z6003|<u>déclaration Wikidata</u>]] # les sens, dont la valeur est une liste de [[Z6006|<u>sens de lexème Wikidata</u>]] # formes, dont la valeur est une liste de [[Z6004|<u>formes de lexème Wikidata</u>]] Notez ensuite que chacune de ces instances contient des instances de 3 autres types Wikidata ([[Z6003|<u>déclaration Wikidata</u>]], [[Z6006|<u>sens de lexème Wikidata</u>]] et [[Z6004|<u>forme de lexème Wikidata</u>]]), et aussi deux types de référence Wikidata types (discutés dans la section suivante). [[Z12|Texte multilingue]] et [[Z60|langue naturelle]] sont des types de Wikifunctions à but multiple, qui ne sont pas créés particulièrement pour traiter du contenu Wikidata. La partie identité stocke l'identifiant Wikidata associé au lexème et sert d'auto- référence. Pour toute information à propos du contenu de chaque autre partie, voir [[:d:Special:MyLanguage/d:Lexicographical data/Documentation|Wikidata:Lexicographical data/Documentation]]. Une instance spécifique récupérée de [[:d:Lexeme:L3435|L3435 sur Wikidata]], est présentée dans l'appendice. <span id="Status_of_Wikidata_types"></span> === Etat des types Wikidata === Tous ces types sont définis et disponibles pour utilisation; il n'y a pas de tâche en attente directement liée à eux. Ils comportent tous des fonctions d'égalité intégrées. Chacun des cinq types d'entités a une fonction de recherche intégrée, comme décrit ci-dessous, par laquelle ses instances peuvent être atteintes directement (obtenue de Wikidata et instanciée sur Wikifunctions).   <span id="Notes_about_Wikidata_statements"></span> === Notes à propos des déclarations Wikidata === Les déclarations apparaissent à l'intérieur des éléments Wikidata, des propriétés, des lexèmes, des formes de lexèmes et des sens de lexèmes. Chaque [[Z6003|<u>déclaration Wikidata</u>]] importée de Wikidata comprend sept parties : # un sujet (référence d'entité, discuté ci-dessous) # un prédicat (référence de propriété, discuté ci-dessous) # une valeur # un rang (une instance de [[Z6040|<u>Wikidata statement rank</u>]]) # liste de qualifieurs (chacun étant représenté en tant que [[Z6003|<u>Wikidata claim</u>]]) # liste de [[Z6008|<u>Wikidata reference</u>]] # instance de [[Z6020|<u>Wikidata claim subtype</u>]]. La valeur (3), peut être de plusieurs types Wikifunctions différents, y compris : * [[Z6|<u>Chaîne de caractères</u>]] * [[Z11|<u>Texte monolingue</u>]] * [[Z6010|<u>Quantité Wikidata</u>]] * [[Z6011|<u>Coordonnées géographiques Wikidata</u>]] * [[Z6040|<u>Heure Wikidata</u>]] * un des types de référence Wikidata discuté ci-dessous. <div lang="en" dir="ltr" class="mw-content-ltr"> As noted in the introductory section, the word "reference" is overloaded. [[Z6008|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. </div> Parce que les ''Déclarations'' dans Wikidata n'ont pas d'identifiants publics dans Wikifunctions la [[Z6003|<u>déclaration Wikidata</u>]] n'a pas de type de référence ni de fonction de recherche (ceux-ci sont décrits en détails ci-dessous). <span id="Wikidata_reference_types"></span> == Types de référence Wikidata == Les types suivants de références sont un moyen de faire référence aux entités Wikidata sans inclure les détails de leur contenu. Les instances de ces types de référence contiennent ''uniquement'' l'identifiant Wikidata d'une entité en tant que {{Z|6}}.   * [[Z6095|<u>Référence de lexème Wikidata</u>]] * [[Z6094|<u>Référence de forme de lexème Wikidata</u>]] * [[Z6096|<u>Référence de sens de lexème Wikidata</u>]] * [[Z6092|<u>Référence de propriété Wikidata</u>]] * [[Z6091|<u>Référence d'élément Wikidata</u>]] '''Exemple''' : une [[Z6091|<u>référence d'élément Wikidata</u>]] de l'élément ''Q1084'' (qui représente le concept de nom ''noun'' Wikidata) ressemble à ceci : La colonne de droite montre la représentation formelle du ZObject (sous sa forme canonique); pour faciliter la lecture, la colonne de gauche montre le même contenu mais avec les libellés en anglais correspondants aux éléments du ZObject. La représentations des ZObject de Wikifunctions figure dans {{ll|Wikifunctions:Function model}}; nous ne reprendrons pas les détails ici. {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata item reference", "Wikidata item id": "Q1084" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6091", "Z6091K1": "Q1084" }</syntaxhighlight> |} '''Utilisation d'exemples''' : * Les type de références Wikidata sont utilisés dans les fonctions de recherche Wikidata (voir ci-dessous). * Lorsque des IDs d'entités et de propriétés apparaissent dans des lexèmes Wikidata, des formes ou des sens de lexème Wikidata, ou des déclarations Wikidata, ils figurent comme des instances du type de référence Wikidata concerné. Par exemple pour indiquer que ''Lexeme L3435'' (“umbrella”) a pour catégorie lexicale ''noun'' (qui a l'ID ''Q1084''), le [[Z6005|<u>lexème Wikidata</u>]] pour ''L3435'' contient la [[Z6091|<u>référence d'élément Wikidata</u>]] affichée ci-dessus dans l''''Exemple'''. <span id="Status_of_Wikidata_reference_types"></span> === Etat des types de référence Wikidata === Prêt à l'emploi, il n'y a pas de tâches en attente directement liées à ces types. <span id="Wikidata_fetch_functions"></span> == Fonctions d'accès Wikidata == Une fonction de recherche est une fonction Wikifunctions intégrée qui prend une instance de l'un des types de référence Wikidata comme argument d'entrée. Comme indiqué ci-dessus, chacune de ces instances contient l'Id d'une entité Wikidata. nstance du Partant de là, elle récupère le contenu de cette entité à partir de Wikidata et le transforme en une instance du type Wikidata correspondant. '''Exemple''' : si [[Z6825|<u>Chercher un lexème Wikidata</u>]] est appelé avec cette instance de [[Z6095|<u>référence de lexème Wikidata</u>]]: {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }</syntaxhighlight> | <syntaxhighlight lang="json">{ "Z1K1": "Z6095", "Z6095K1": "L3435" }</syntaxhighlight> |} il va renvoyer l'instance du [[Z6005|<u>lexème Wikidata</u>]] qui est introduite dans la sous-section ''Exemple'' de la section ''types Wikidata'' ci-dessus, et affichée plus en détails dans l'Appendice. <span id="Status_of_Wikidata_fetch_functions"></span> === Etat des fonctions d'accès Wikidata === Une fonction de recherche existe dans Wikifunctions pour chaque types d'entité : * [[Z6825|<u>Recherche de lexème Wikidata</u>]] * [[Z6824|<u>Récupérer la forme du lexème Wikidata</u>]] * [[Z6826|<u>Recherche de sens de lexème Wikidata</u>]] * [[Z6822|<u>Récupérer la propriété Wikidata</u>]] * [[Z6821|<u>Récupérer l'élément Wikidata</u>]] Pour permettre d'appeler les fonctions de recherche à partir de l'interface utilisateur, Wikifunctions fournit des composants sélecteur permettant de choisir l'entité à rechercher. Il y aura éventuellement un sélecteur correspondant à chacun des types d'entité (et ainsi à chacune des fonctions de recherche). La section suivante fournit d'autres informations concernant les composants du sélecteur. <span id="Wikidata_search_functions"></span> == Fonctions de recherche Wikidata == En plus de chercher le contenu de Wikidata, il est également possible de récupérer le contenu Wikidata de différentes manières, en utiisant ses APIs. Wikifunctions fournit actuellement deux fonctions intégrées basées sur ces capacités de recherche. <span id="Function:_Find_lexemes_for_an_item"></span> === Fonction : [[Z6830|<u>Chercher les lexèmes d'un élément</u>]] === * Types d'argument : [[Z6091|<u>référence d'élément Wikidata</u>]], [[Z6092|<u>référence de propriété Wikidata</u>]], [[Z60|<u>langue naturelle</u>]] * Type de la valeur renvoyée : liste de [[Z6095|<u>référence de lexème Wikidata</u>]] Wikidata capture les relations utiles entre les sens du lexème (qui représentent les significations d'un lexème) et les éléments. Il s'agit notamment de : * [[d:Property:P5137|élément pour ce sens]], connecte le plus souvent un nom à une chose ou a une classe de choses dans Wikidata * [[d:Property:P9970|prédicat pour]] connecter un verbe à une action ou un événement * [[d:Property:P6271|démonyme de]], pour connecter un nom ou un adjectif à un lieu, décrit les personnes et les objets qui vivent ou existent à cet endroit. '''Exemple 1.''' Les trois sens du lexème [[d:Lexeme:L18379|L18379/rose]] font référence à la couleur, à la fleur et au taxon biologique. Chacun de ces 3 sens est lié à un élément différent, au moyen d'une déclaration, dans Wikidata, comme ceci (pour le premier sens) : * sujet de la déclaration : [[d:Lexeme:L18379|L18379-S1/sens 1 de rose]] * propriété de la déclaration :  [[d:Property:P5137|P5137/élément pour ce sens]] * valeur de la déclaration : [[d:Q533047|Q533047/rose]] [[Z6830|<u>Chercher les lexèmes d'un élément</u>]] ramène tous les lexèmes liés à un élément donné par une propriété donnée (même si des relations existent entre un ''sens de lexème'' et un élément, l'API Wikidata et cette fonction renvoient les références de ce ou ces ''lexemes'' qui contiennent le ou les sens). '''Exemple 2''' :  l'appel de [[Z6830|<u>Chercher les lexèmes d'un élément</u>]] avec [[d:Q533047|Q533047/rose]] (la couleur), [[d:Property:P5137|P5137/élément pour ce sens]], et [[Z1002|<u>Z1002/Anglais</u>]] renvoie une liste contenant la référence du lexème pour [[d:Lexeme:L18379|L18379/rose]]. En appelant la fonction avec [[d:Q102231|Q102231/rose]] (la fleur) ou avec [[d:Q34687|Q34687/Rosa]] (le taxon biologique) comme premier argument on récupère aussi le lexème [[d:Lexeme:L18379|L18379/rose]], car ce lexème est lié (via ses 3 sens) à tous ces 3 éléments. '''Exemple''' '''3''': l'appel de [[Z6830|<u>Trouver les lexèmes d'un élément</u>]] avec [[d:Q55|Q55/Netherlands]], [[d:Property:P6271|P6271/démonyme de]], et [[Z1002|<u>Z1002/Anglais</u>]] renvoie une liste contenant la [[Z6095|<u>référence du lexème Wikidata</u>]] pour [[d:Lexeme:L34519|L34519/Dutch]]. Pour un exemple dans lequel [[Z6830|<u>Chercher les lexèmes pour un élément</u>]] est utilisé en générant une phrase en langage naturel, voir la section ''Fonction de la semaine'' dans {{ll|Wikifunctions:Status updates/2025-02-26}}. <span id="Function:_Find_lexemes_for_a_Wikidata_lexeme_sense"></span> === Fonction : [[Z6831|<u>Trouver les lexèmes pour un sens de lexème Wikidata</u>]] === * Types d'argument : [[Z6096|<u>référence de sens de lexème Wikidata</u>]], [[Z6092|<u>référence de propriété Wikidata</u>]], [[Z60|<u>langue naturelle</u>]] * Type de la valeur renvoyée : liste de [[Z6095|<u>références de lexème Wikidata</u>]] Wikidata capture aussi des relations utiles entre les sens de lexèmes et les autres sens de lexèmes, ainsi que els relations exprimées en utilisant la propriété [[:d:Property:P8471|faisant partie de]], qui lie le sens d'un adjectif au sens d'un nom relatif (comme lunaire → lune), ou un sens d'adverbe au sens de l'adjectif qui lui est associé (comme lentenment → lent). [[Z6831|<u>Trouver les lexèmes correspondant au sens d'un lexème Wikidata</u>]] recherche les lexèmes liés au sens d'un lexème donné par une propriété telle que [[:d:Property:P8471|appartient à]] (même si des relations existent entre les paires of ''sens de lexème'', l'API Wikidata, et cette fonction, renvoie les références du ou des ''lemmes'' qui contiennent le ou les sens cibles). <span id="User_interface"></span> == Interface utilisateur == <span id="Selectors"></span> == Sélecteurs == [[File:Selecting a lexeme for "goose".png|thumb|Fig. 1. Sélection d'un lexème pour "goose"]] Les sélecteurs permettent dans l'interface utilisateur de Wikifunctions de sélectionner l'entité à utiliser. Par exemple, lorsque l'utilisateur tape un mot clé partiel dans le sélecteur de lexemes de Wikifunctions, le sélector demande à Wikidata des lexèmes qui correspondent à ce mot clé partiel (la recherche correspond au mot clé partiel par rapport aux lemmes de tous les lexèmes de Wikidata). On affiche jusqu'à 10 correspondances actuelles ce qui permet à l'utilisateur d'en choisir une. Il met à jour la liste des correspondances au fur et à mesure que les caractères suivants sont entrés. '''Exemple''': la figure 1 montre l'aspect d'un sélecteur de lexème après avoir entré les 5 caractères du mot "goose". À ce stade, on affiche à l'utilisateur 4 lexèmes correspondants à choisir. Un exemple où ce sélecteur de lexème est utilisé dans la préparation d'un appel de fonction est donné dans la section ''Fonction de la semaine'' de {{ll|Wikifunctions:Status updates/2024-10-17}}. Notez que la présence d'un sélecteur Wikidata est indiquée par l'icône Wikidata (avec des trais verticaux rouges, verts et bleus). Dès que l'utilisateur a fait son choix, le sélecteur va générer la représentation interne appropriée à l'élément sélectionné, en fonction du contexte : # une instance du type de référence Wikidata approprié si c'est tout ce dont on a besoin, ou bien # un appel à la fonction de récupération appropriée, avec une instance du type de référence en argument. Les sélecteurs sont principalement utilisés pour fournir les arguments de l'appel d'une fonction dans l'interface utilisateur, la fonction appelée fournissant le contexte correspondant. Si l'utilisateur spécifie une valeur pour un argument ayant un type de référence Wikidata pour le type, le sélecteur indiquera (1). Dans ce cas, aucune recherche n'est effectuée. Si l'argument en question a un type Wikidata comme type, le sélecteur fournira (2), qui récupérera en interne l'objet entier et le rendra disponible à la fonction appelée. <span id="Display_elements"></span> === Affichage des éléments === [[File:Compact view of lexeme form for "umbrellas".png|thumb|Fig. 2. Vue compacte de la forme du lexème pour "umbrellas"]] Wikifunctions fournit également une vue simplifiée et compacte des entités Wikidata. Cette vue est affichée sur les pages lues et pour les sorties d'un appel de fonction. Cette vue compacte affiche l'icône Wikidata suivie d'une forme de mot associée à l'entité Wikidata (par exemple, un lemme d'un lexeme, la représentation d'une forme de lexème ou le libellé d'une entité), dans la langue de l'utilisateur si disponible. La forme de mot est liée à la page Wikidata de laquelle l'entité a été extraite. '''Exemple :''' la figure 2 affiche la vue compacte, sous le mot '''Result''', de la [[Z6824|<u>forme du lexème Wikidata</u>]] pour ''umbrellas'' (qu'on appelle ''représentation'' de la forme). Ceci est l'aspect initial du résultat de l'exécution d'une fonction qui renvoie une forme de lexème. [[File:Expanded view of lexeme form for "umbrellas".png|thumb|Fig. 3. Vue étendue de la forme du lexème pour "umbrellas"]] Si l'entité doit être explorée en détails, elle peut être développée en utilisant le bouton avec les ''chevrons'' vers la droite (qui ressemble à '>') avant l'élément. La vue étendue permet à l'utilisateur de comprendre le type de représentation utilisé pour cette entité. La représentation pourrait utiliser un type de référence Wikidata, un appel de fonction de la fonction de recherche Wikidata appropriée, ou l'instance entière de l'entité renvoyée par cet appel de fonction. Dans tous les cas, l'utilisateur pourra étendre, explorer et naviguer dans son contenu. '''Exemple :''' la figure 3 affiche la vue étendue de la forme de lexème pour ''umbrellas'', en cliquant sur le chevron de la figure 2. Ici nous voyons la présentation globale de l'instance de la [[Z6824|<u>forme de lexème Wikidata</u>]]. Chacun des composants imbriqués de la forme avec un chevron (par exemple, <code>identité</code>, <code>lexème</code>, etc.), peut être développé pour une exploration plus approfondie. <span id="Status_of_UI_components_for_Wikidata_entity_types"></span> === Etat des composants de l'interface utilisateur pour les types d'entités Wikidata === * [[Z6825|<u>Lexème Wikidata</u>]] ** Affichage et sélecteur : disponible * [[Z6824|<u>Forme d'un lexème Wikidata</u>]] ** Affichage et sélecteur : disponible * [[Z6826|<u>Sens d'un lexème Wikidata</u>]] ** Affichage et sélecteur: date de diffusion non encore déterminée * [[Z6821|<u>Elément Wikidata</u>]] ** Affichage et sélecteur : disponible * [[Z6822|<u>Propriété Wikidata</u>]] ** Affichage et sélecteur : disponible <span id="Limitations_of_UI_components_for_Wikidata_entity_types"></span> === Limitations des composants de l'interface utilisateur pour les types d'entités Wikidata === '''Discrimination visuelle'''. Actuellement l'interface utilisateur de Wikifunctions manque de discrimination visuelle entre les différents types d'entités Wikidata : * Les sélecteurs pour les autres types d'entités sont similaires à ceux des lexèmes Wikidata affichés sur la figure 1. Il n'y a pas d'indication explicite du type qui sera sélectionné. ** Contournements : en général on devine à partir du contexte quel type d'élément est sélectionné. En plus, le contenu des choix de sélection (dans la liste déroulante) dépend du type d'élément à sélectionner. Par exemple dans un sélecteur de ''lexème'' chaque choix affiche son lemme, sa langue, et une partie du discours (comme montré sur la figure 1), alors que dans un sélecteur de ''forme de lexème'' chaque choix affiche ses fonctionnalités sous forme de mots et grammaticales, ensemble avec les informations qui identifient le lexème contenu. * L'affichage compact des autres types d'entités est le même que celui des lexèmes Wikidata comme sur la Figure 2 (on ne voit que l'icône Wikidata et la forme sur un seul mot). ** Contournement : si le contexte n'est pas déterminant, vous pouvez cliquer sur les chevrons pour obtenir une vue étendue de l'entité qui montre clairement son type comme sur la figure 3. '''Absence de vues compactes'''. C'est parce que l'affichage des éléments pour le [[Z6006|sens du lexème <u>Wikidata</u>]] et la [[Z6003|<u>déclaration Wikidata</u>]] n'a pas été encore complètement déployé, que la présentation des elements de ces types peut prendre quelques fois trop de place et nuire à la lisibilité d'entités plus grosses les contenant. Ceci est spécialement vrai quand un lexème, une forme ou un sens de lexème contient une liste mesurable de déclarations. '''L'état ne correspond pas'''. bien que la fonction de recherche soit disponible pour le [[Z6826|<u>sens du lexème Wikidata</u>]], le sélecteur pour ce type n'est pas encore disponible. <span id="Appendix:_an_instance_of_Wikidata_lexeme"></span> == Appendice : une instance de lexème Wikidata == Cet exemple est présenté dans la sous-section ''Exemple'' de la section des ''Types Wikidata''. Il affiche une instance spécifique de lexème Wikidata, qui a été récupérée de [[:d:Lexeme:L3435|L3435 sur Wikidata]]. La colonne de droite montre la représentation formelle du ZObject (sous sa forme canonique); pour faciliter la lecture, la colonne de gauche montre le même contenu mais avec les libellés en anglais correrspondants aux éléments du ZObject. La représentation des ZObject Wikifunctions est présentée à {{ll|Wikifunctions:Function model}}; nous ne reprendrons pas les détails ici. L'exemple a été écourté en enlevant certains contenus comme indiqué par les parenthèses. Pour améliorer la lisibilité, on a omis également l'indication du type d'élément qui apparaît normalement en première position de chaque liste dans la forme canonique. {|class="wikitable" style="margin:.6em 1.6em" |- | <syntaxhighlight lang="json" line="line">{ "type": "Wikidata lexeme", "identity": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "lemmas": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "language": "English", "lexical category": { "type": "Wikidata item reference", /* Wikidata item for "noun": */ "Wikidata item id": "Q1084" }, "statements": [ { "type": "Wikidata statement", "subject": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "predicate": { "type": "Wikidata property reference", /* Oxford English Dictionary ID */ "Wikidata property id": "P5275" }, "value": "208852", ... }, ... ], "senses": [ { "type": "Wikidata lexeme sense", "identity": { "type": "Wikidata lexeme sense reference", "Wikidata lexeme sense id": "L3435-S1" }, "glosses": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "Spanish", "text": "utensilio empleado para cubrirse de la lluvia" } ] }, "statements": [ ... ] } ], "forms": [ { "type": "Wikidata lexeme form", "identity": { "type": "Wikidata lexeme form reference", "Wikidata lexeme form id": "L3435-F1" }, "lexeme": { "type": "Wikidata lexeme reference", "Wikidata lexeme id": "L3435" }, "representations": { "type": "Multilingual text", "texts": [ { "type": "Monolingual text", "language": "English", "text": "umbrella" } ] }, "grammatical features": [ { "type": "Wikidata item reference", /* Wikidata item for "singular": */ "Wikidata item id": "Q110786" } ], "statements": [ /* (empty list) */ ] }, ... ] } </syntaxhighlight> | <syntaxhighlight lang="json" line="line">{ "Z1K1": "Z6005", "Z6005K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6005K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6005K3": "Z1002", "Z6005K4": { "Z1K1": "Z6091", "Z6091K1": "Q1084" }, "Z6005K5": [ { "Z1K1": "Z6003", "Z6003K1": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6003K2": { "Z1K1": "Z6092", "Z6092K1": "P5275" }, "Z6003K3": "208852", ... }, ... ], "Z6005K6": [ { "Z1K1": "Z6006", "Z6006K1": { "Z1K1": "Z6096", "Z6096K1": "L3435-S1" }, "Z6006K2": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1003", "Z11K2": "utensilio empleado para cubrirse de la lluvia" } ] }, "Z6006K3": [ ... ] } ], "Z6005K7": [ { "Z1K1": "Z6004", "Z6004K1": { "Z1K1": "Z6094", "Z6094K1": "L3435-F1" }, "Z6004K2": { "Z1K1": "Z6095", "Z6095K1": "L3435" }, "Z6004K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "umbrella" } ] }, "Z6004K4": [ { "Z1K1": "Z6091", "Z6091K1": "Q110786" } ], "Z6004K5": [ ] }, ... ] } </syntaxhighlight> |} [[Category:Wikidata{{#translation:}}| ]] [[Category:Technical documentation{{#translation:}}]] 1q6uxl1r0a0ytgsijecbfz8t30m4rby Wikifunctions:Tools/fr 4 73772 276506 245248 2026-05-20T06:22:56Z FuzzyBot 207 Updating to match new version of source page 276506 wikitext text/x-wiki <languages/> Cette page comporte une liste d'outils que vous pouvez utiliser pour travailler avec Wikifunctions plus rapidement et plus confortablement. Si vous avez écrit un script, n'hésitez pas à l'ajouter pour que d'autres utilisateurs puissent en bénéficier. <span id="Dump_related_tools"></span> == Outils de vidage == * [https://github.com/marius851000/wikifunction_intepreter interpréteur Rust expérimental de Wikifunction] fonctionnant sur le dump. Ecrit en Rust. * [[Wikifunctions:Tools/wf-dump-scripts|wf-dump-scripts]] - pipeline pour créer des tableaux wiki de statistiques basés sur le dump et l'API interne de Wikifunctions. Ecrit en [[w:Python (programming language)|Python]] * [//wf-query.replit.app wf-query] : outil permettant d'exécuter des requêtes JSONata sur un dump Wikifunctions, avec la sortie des tableaux elle-même personnalisable avec des requêtes JSONata. Ecrit en [[w:Node.js|NodeJS]] Express et [[w:JavaScript|vanilla JavaScript]] * [//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl Dumpextract] : un programme pour extraire des informations à partir d'un dump de Wikifunctions. Ecrit en [[w:COBOL|COBOL]]. * [https://github.com/99of9/WikifunctionsAnalysis WikifunctionsAnalysis] : code partiel pour aider à l'analyse des dumps Wikifunctions * <span lang="en" dir="ltr" class="mw-content-ltr">[[User:Amire80/wikifunctionsanalytics#Example_queries|wikifunctionsanalytics]]: A simplified dump, queryable through [[meta:Special:MyLanguage/Research:Quarry|Quarry]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[toolforge:abstract-data/functions]]: Tracking Function usage on [[abstract:|Abstract Wikipedia]].</span> <span id="User_interface"></span> == Interface utilisateur == *[[User:Feeglgeef/wikilambda editsource.js|wikilambda editsource.js]] : script utilisateur qui vous permet de mlodifier le contenu brut JSON des ZObjects. * [https://yoshirulz.gitlab.io/WikiLambdaBlockly WikiLambdaBlockly] : application web démontrant une interface d'édition basée sur les blocs pour les compositions. Utilise [[w:Blockly|Blockly]] de [[w:TypeScript|TS]]. <span id="Others"></span> == Autres == * [//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3 recherche de constantes] : outil qui représente un f64 à l'aide de la représentation Wikifunctions. Imprime, avec séparatuer virgule, le signe du flottant (-1, 0, 1), l'exposant du flottant, et la partie fractionnaire du flottant. Ecrit en [[w:Rust (programming language)|Rust]]. [[Category:Project{{#translation:}}]] 4pvuyzkm8y5tjbluwmbk92j2whnh2q0 Wikifunctions:Programming languages/fr 4 74334 276482 247120 2026-05-20T06:20:35Z FuzzyBot 207 Updating to match new version of source page 276482 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <span lang="en" dir="ltr" class="mw-content-ltr">[[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Special:MyLanguage/WF:glossary#composition|Compositions]] are a kind of LISPish language, but aren't covered here.</span> <span id="Executable"></span> == Exécutable == <span id="Implemented"></span> == Implémentation == Depuis mars 2024 les langages suivants sont compilés dans [[meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25|WASM]] pour être lancés par l'[[Special:MyLanguage/WF:glossary#executor|exécuteur]] : * <span class="mw-translate-fuzzy">JavaScript non versionné ([https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy Logiciel W3C et Notice documentaire et Licence], [https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license source]), en utilisant [https://github.com/second-state/wasmedge-quickjs WasmEdge-QuickJS] (qui utilise [https://bellard.org/quickjs/ QuickJS 2024], compatible avec ES2023)</span> * <span class="mw-translate-fuzzy">Python non versionné ([https://docs.python.org/3/license.html PSF License Agreement], Zero-Clause BSD), utilisant la version de développement du mode [https://github.com/RustPython/RustPython RustPython] WASI (destiné à être compatible avec CPython 3.12)</span> <span id="Planned"></span> === A venir === * JavaScript versionné (ECMA202?+) * Python versionné (3+) <span id="Requested"></span> == Demandes == Voir la [[phab:tag/wikifunctions-new-language-requests|liste des tâches dans Phabricator]] pour demander des langages de programmation supplémentaires qui devraient être pris en compte dans Wikifunctions. Entre autres critères d'implémentation, les logiciels interpréteur et compilateur de langage disponibles doivent être sous licence libre. * [[phab:T352589|T352589]]: LabView/G<!--[https://ni.com/en/support/downloads/activate.html propriétaire]--> via pyLabView ([https://github.com/mefistotelis/pylabview/blob/master/LICENSE MIT]) * [[phab:T352588|T352588]]: Kotlin ([https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE Apache]) * [[phab:T307171|T307171]]: Lua ([https://lua.org/license.html MIT]) * [[phab:T301418|T301418]]: Scratch/Snap!/Logolike ([https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE BSD 3-Clause], GPLv2 et Scratch Source Code License) * [[phab:T298633|T298633]]: Vlojure ([https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE MIT]) <span id="Former"></span> === Précédent === Initialement, l'évaluateur de fonction exécute directement le code dans son conteneur. Parce qu'il est basé sur Debian Bullseye, l'exécution de JavaScript était fournie par Node.js 16 et Python par Python 3.9. Ceux-ci ne sont plus immédiatement disponibles à cause de la recompilation en assembleur Web, mais pourraient revenir si nécessaire grâce à une compilation personnalisée. <span id="Functions_for_manipulating"></span> == Fonctions de traitement == * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] mb3q47p21luknajj0vzxnkxvgsla193 Wikifunctions:Wikidata/fr 4 74899 276531 248799 2026-05-20T06:23:47Z FuzzyBot 207 Updating to match new version of source page 276531 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} Wikifunctions est représenté sur [[:d:Wikidata:Main page|Wikidata]] par {{Q|Q104587954}}. Vous trouverez ici bientôt d'autres informations sur Wikidata et Wikifunctions. <span id="Functionality_we_will_want"></span> == Fonctionnalités souhaitées == <span id="Items"></span> === Eléments === * Vérifier qu'un élément existe * Obtenir l'élément ** {{done}} {{Z|6821}} * Obtenir les libellés ** {{done}} {{Z|22853}} * Obtenir les alias ** {{done}} {{Z|23080}} * Obtenir les descriptions ** {{done}} {{Z|30120}} * Obtenir la déclaration ** {{done}} {{Z|22220}} * Obtenir les liens de site ''éventuels'' ** {{done}} {{Z|35207}} <span id="Statements"></span> === Déclarations === * Obtenir les valeurs de la déclaration ** {{done}} {{Z|19308}} * Obtenir le rang ** {{done}} {{Z|20206}} * Obtenir la propriété de la déclaration ** {{done}} {{Z|19306}} * Obtenir les qualifieurs ** {{done}} {{Z|28278}} * Obtenir les références ** {{done}} {{Z|31984}} <span id="Properties"></span> === Propriétés === * Vérifier l'existence d'une propriété * Obtenir la propriété ** {{done}} {{Z|6822}} * Obtenir les libellés ** {{done}} {{Z|23223}} * Obtenir les alias ** {{done}} {{Z|23227}} * Obtenir les descriptions ** {{done}} {{Z|23225}} * Obtenir le type de données * Obtenir la déclaration ** {{done}} {{Z|23229}} <span id="Lexemes"></span> === Lexèmes === * Vérifier l'existence d'un lexème * Obtenir le lexème ** {{done}} {{Z|6825}} * Obtenir le lemmata ** {{done}} {{Z|19293}} * Obtenir les langues ** {{done}} {{Z|19276}} * Obtenir la catégorie ** {{done}} {{Z|19298}} * Obtenir la déclaration ** {{done}} {{Z|19300}} * Obtenir le sens ** {{done}} {{Z|6826}} * Obtenir la forme ** {{done}} {{Z|6824}} <span id="Senses"></span> ==== Sens ==== * Obtenir la glose ** {{done}} {{Z|23114}} * Obtenir la déclaration ** {{done}} {{Z|23116}} <span id="Forms"></span> ==== Formes ==== * Obtenir la représentation ** {{done}} {{Z|22399}} * Obtenir les caractéristiques grammaticales ** {{done}} {{Z|22487}} * Obtenir la déclaration ** {{done}} {{Z|23118}} <span id="Entity_schemas"></span> === Schémas d'entités === * Vérifier si le schéma de l'entité existe * Obtenir le schéma de l'entité * Obtenir les libellés * Obtenir les alias * Obtenir les descriptions [[Category:Project{{#translation:}}]] [[Category:Wikidata]] nuxmobzwpkl1p6i0xldrnauqgxvt921 Wikifunctions:Human languages/fr 4 75723 276469 270539 2026-05-20T06:17:01Z FuzzyBot 207 Updating to match new version of source page 276469 wikitext text/x-wiki <languages/> {{draft}} <div class="mw-translate-fuzzy"> Pris en charge par le ''Natural Language Generation Special Interest Group''; voir aussi {{ll|WF:PROG}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Hausa, Igbo, Malayalam, Bangla/Bengali and Dagbani are [[d:Special:MyLanguage/Wikidata:Lexicographical data/Focus languages|focus languages]] for Wikidata's lexicographic dataset, which is an important aspect of [[Special:MyLanguage/WF:glossary#Abstract Wikipedia|Abstract Wikipedia]]. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Related pages == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[:Category:Natural languages]] — List of categories for languages</span> * <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:Catalogue/Natural language operations}} — Lists of natural language functions</span> * <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:NLG functions}} — A table of each supported language's NLG functions</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:Cardinal numbers}} — List of each language's cardinal number functions</span> * <span lang="en" dir="ltr" class="mw-content-ltr">{{ll|Wikifunctions:Reserved ZIDs/all#Z1000-Z1999}} — List of all languages in ZObject order</span> <span id="Afroasiatic"></span> <div class="mw-translate-fuzzy"> == Afro-Asiatique == </div> * {{z+|Z1472}} (zgh) — [[/Z1472]] * {{z+|Z1013}} (ha) — [[/Z1013]] * <span lang="en" dir="ltr" class="mw-content-ltr">Semitic</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Arabic</span> *** {{z+|Z1001}} (ar) — [[/Z1001]] *** {{z+|Z1045}} (ary) — [[/Z1045]] *** {{z+|Z1582}} (aeb) — [[/Z1582]] ** {{z+|Z1186}} (he) — [[/Z1186]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Austroasiatic == </div> * {{z+|Z1048}} (vi) — [[/Z1048]] * (<span lang="en" dir="ltr" class="mw-content-ltr">Mundari, no code yet</span>) (unr) <div lang="en" dir="ltr" class="mw-content-ltr"> == Austronesian == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Malayic</span> ** {{z+|Z1531}} (ms) — [[/Z1531]] *** {{z+|Z1434}} (ms-arab) — [[/Z1434]] ** {{z+|Z1078}} (id) — [[/Z1078]] * {{z+|Z1471}} (su) — [[/Z1471]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Constructed == </div> * {{z+|Z1882}} (ldn) — [[/Z1882]] * {{z+|Z1576}} (eo) — [[/Z1576]] * {{z+|Z1534}} (tlh) — [[/Z1534]] * {{z+|Z1762}} (tok) — [[/Z1762]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Dravidian == </div> * {{z+|Z1293}} (brh) — [[/Z1293]] * <span lang="en" dir="ltr" class="mw-content-ltr">South</span> ** {{z+|Z1012}} (ml) — [[/Z1012]] ** {{z+|Z1429}} (te) — [[/Z1429]] <span id="Indo-European"></span> == Indo-Européen == * {{z+|Z1541}} (hy) — [[/Z1541]] * <span lang="en" dir="ltr" class="mw-content-ltr">Balto-Slavic</span> ** {{z+|Z1709}} (lv) — [[/Z1709]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Slavic</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">East Slavic</span> **** {{z+|Z1005}} (ru) — [[/Z1005]] **** {{z+|Z1332}} (uk) — [[/Z1332]] **** {{z+|Z1622}} (by) — [[/Z1622]] *** <span lang="en" dir="ltr" class="mw-content-ltr">West Slavic</span> **** {{z+|Z1062}} (cs) — [[/Z1062]] **** {{z+|Z1025}} (pl) — [[/Z1025]] **** {{z+|Z1488}} (sk) — [[/Z1488]] *** <span lang="en" dir="ltr" class="mw-content-ltr">South Slavic</span> **** {{z+|Z1823}} (bg) — [[/Z1823]] **** {{z+|Z1105}} (cu) — [[/Z1105]] **** {{z+|Z1412}} (sh) — [[/Z1412]] ***** {{z+|Z1473}} (bs) — [[/Z1473]] ***** {{z+|Z1272}} (hr) — [[/Z1272]] ***** {{z+|Z1498}} (cnr) — [[/Z1498]] ***** {{z+|Z1158}} (sr) — [[/Z1158]] **** {{z+|Z1616}} (sl) — [[/Z1616]] * <span lang="en" dir="ltr" class="mw-content-ltr">Celtic</span> ** {{z+|Z1282}} (br) — [[/Z1282]] ** {{z+|Z1024}} (cy) — [[/Z1024]] ** {{z+|Z1339}} (gd) — [[/Z1282]] * <span lang="en" dir="ltr" class="mw-content-ltr">Germanic</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">North Germanic</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">East Scandinavian</span> **** {{z+|Z1061}} (dk) — [[/Z1061]] **** {{z+|Z1592}} (sv) — [[/Z1592]] *** {{z+|Z1021}} (no) — [[/Z1592]] ** <span lang="en" dir="ltr" class="mw-content-ltr">West Germanic</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">North Sea</span> **** {{z+|Z1002}} (en) — [[/Z1002]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">North American</span> ****** {{z+|Z1689}} (en-US) — [[/Z1689]] ****** {{z+|Z1437}} (en-CA) — [[/Z1437]] ***** {{z+|Z1113}} (en-AU) — [[/Z1113]] ***** {{z+|Z1199}} (en-GB) — [[/Z1199]] ***** {{z+|Z1966}} (en-IN) — [[/Z1966]] ***** {{z+|Z1881}} (en-x-piglatin) — [[/Z1881]] ***** {{z+|Z1124}} (en-x-simple) — [[/Z1124]] **** {{z+|Z1146}} (nds) — [[/Z1146]] *** <span lang="en" dir="ltr" class="mw-content-ltr">High German</span> **** {{z+|Z1099}} (lb) — [[/Z1099]] **** {{z+|Z1430}} (de) — [[/Z1430]] *** {{z+|Z1157}} (nl) — [[/Z1157]] * {{z+|Z1827}} (el) — [[/Z1827]] * <span lang="en" dir="ltr" class="mw-content-ltr">Indo-Iranian</span> ** <span lang="en" dir="ltr" class="mw-content-ltr">Indo-Aryan</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Hindustani</span> **** {{z+|Z1820}} (hi) — [[/Z1820]] **** {{z+|Z1717}} (ur) — [[/Z1717]] *** <span lang="en" dir="ltr" class="mw-content-ltr">Northwestern</span> **** <span lang="en" dir="ltr" class="mw-content-ltr">Punjabic</span> ***** {{z+|Z1657}} (pa) — [[/Z1657]] ***** {{z+|Z1083}} (pnb) — [[/Z1083]] **** {{z+|Z1191}} (sd) — [[/Z1191]] *** <span lang="en" dir="ltr" class="mw-content-ltr">Eastern</span> **** {{z+|Z1011}} (bn) — [[/Z1011]] **** <span lang="en" dir="ltr" class="mw-content-ltr">Rohingya</span> (rhg) ***** {{z+|Z1978}} (rhg-rohg) — [[/Z1978]] ***** {{z+|Z1979}} (rhb-arab) — [[/Z1979]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Iranian</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Northwestern</span> **** {{z+|Z1747}} (bal) — [[/Z1747]] **** {{z+|Z1556}} (ku) — [[/Z1556]] ***** {{z+|Z1288}} (ckb) — [[/Z1288]] *** {{z+|Z1728}} (fa) — [[/Z1728]] **** {{z+|Z1207}} (tg) — [[/Z1207]] **** {{z+|Z1265}} (fa-AF / prs) — [[/Z1265]] **** {{z+|Z1277}} (jpr) — [[/Z1277]] * <span lang="en" dir="ltr" class="mw-content-ltr">Italic</span> ** {{z+|Z1403}} (la) — [[/Z1403]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Romance</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Continental Romance</span> **** <span lang="en" dir="ltr" class="mw-content-ltr">Western Romance</span> ***** <span lang="en" dir="ltr" class="mw-content-ltr">Ibero-Romance</span> ****** {{z+|Z1037}} (pt) — [[/Z1037]] ******* {{z+|Z1381}} (pt-BR) — [[/Z1381]] ****** {{z+|Z1003}} (es) — [[/Z1003]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">Occitano-Romance</span> ****** {{z+|Z1789}} (ca) — [[/Z1789]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">North Gallo-Romance</span> ****** {{z+|Z1004}} (fr) — [[/Z1004]] ***** <span lang="en" dir="ltr" class="mw-content-ltr">North Italian</span> ****** {{Z+|Z1363}} (vec) — [[/Z1363]] ****** {{z+|Z1483}} (lad) — [[/Z1483]] **** <span lang="en" dir="ltr" class="mw-content-ltr">South Romance</span> ***** {{z+|Z1787}} (it) — [[/Z1787]] ***** {{z+|Z1329}} (co) — [[/Z1329]] ***** {{z+|Z1082}} (sdc) — [[/Z1082]] ***** {{z+|Z1491}} (nap) — [[/Z1491]] ***** {{z+|Z1298}} (scn) — [[/Z1298]] **** <span lang="en" dir="ltr" class="mw-content-ltr">Balkan romance</span> ***** {{z+|Z1664}} (ro) — [[/Z1664]] *** <span lang="en" dir="ltr" class="mw-content-ltr">Island Romance</span> **** {{z+|Z1342}} (sc) — [[/Z1342]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Kra-Dai == </div> * {{z+|Z1851}} (th) — [[/Z1851]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Niger-Congo == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Atlantic-Congo</span> ** {{z+|Z1015}} (dag) — [[/Z1015]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Volta-Congo</span> *** <span lang="en" dir="ltr" class="mw-content-ltr">Volta-Niger</span> **** {{z+|Z1014}} (ig) — [[/Z1014]] **** {{z+|Z1818}} (ya) — [[/Z1818]] *** {{z+|Z1179}} (kcg) — [[/Z1179]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Mixed and creoles == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These languages are sorted under the language it is primarily based on. </div> * {{Z|Z1531}} ** {{z+|Z1630}} (bew) — [[/Z1630]] * {{Z|Z1037}} ** {{z+|Z1806}} (kea) — [[/Z1806]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Sign == </div> * {{z+|Z1763}} (ase) — [[/Z1763]] * {{z+|Z1907}} (bzs) - [[/Z1907]] * {{z+|Z}}{{q|2107617}} (vgt) - [[/vgt]] <span id="Sino-Tibetan"></span> == Sino-Tibétin == * {{z+|Z1147}} (dz) — [[/Z1147]] * <span lang="en" dir="ltr" class="mw-content-ltr">Sinitic</span> ** {{z+|Z1006}} (zh) — [[/Z1006]] *** {{z+|Z1645}} (zh-hans) — [[/Z1645]] **** {{z+|Z1411}} (zh-CN) — [[/Z1411]] *** {{z+|Z1672}} (zh-hant) — [[/Z1672]] **** {{z+|Z1589}} (zh-HK) — [[/Z1589]] ** {{z+|Z1202}} (zh-yue) — [[/Z1202]] *** {{z+|Z1901}} (yue-hans) — [[/Z1901]] *** {{z+|Z1902}} (yue-hant) — [[/Z1902]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Turkic == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Oghuz</span> ** {{z+|Z1237}} (tr) — [[/Z1237]] ** {{z+|Z1597}} (az) — [[/Z1597]] * {{z+|Z1120}} (uz) — [[/Z1120]] <span id="Uralic"></span> == Ouralien == * {{z+|Z1051}} (fi) — [[/Z1051]] * {{z+|Z1513}} (hu) — [[/Z1513]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Isolates and smaller families == </div> * {{z+|Z1314}} (eu) — [[/Z1314]] * {{z+|Z1830}} (ja) — [[/Z1830]] ** {{z+|Z1444}} (ja-hkrt) — [[/Z1444]] ** <span lang="en" dir="ltr" class="mw-content-ltr">Japanese rōmaji, no ZObject</span> (ja-latn) * {{z+|Z1643}} (ko) — [[/Z1643]] * {{z+|Z1678}} (qu) — [[/Z1678]] <div lang="en" dir="ltr" class="mw-content-ltr"> == Other == </div> * {{z+|Z1360}} (mul) — [[/Z1360]] [[Category:Natural languages| mul]] [[Category:WikiProjects]] 8p9sc1ag2xusmpipknmh5evghjj370p Wikifunctions:Programming languages/pl 4 77391 276484 255332 2026-05-20T06:20:36Z FuzzyBot 207 Updating to match new version of source page 276484 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <span lang="en" dir="ltr" class="mw-content-ltr">[[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Special:MyLanguage/WF:glossary#composition|Compositions]] are a kind of LISPish language, but aren't covered here.</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Executable == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Implemented === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> As of March 2024 the following languages compile to [[meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25|WASM]] to be run by the [[Special:MyLanguage/WF:glossary#executor|executor]]: </div> * <span lang="en" dir="ltr" class="mw-content-ltr">unversioned [[Special:MyLanguage/WF:JS|JavaScript]] ([https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy W3C Software and Document Notice and License], [https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license src]), using [https://github.com/second-state/wasmedge-quickjs WasmEdge-QuickJS] (using [https://bellard.org/quickjs/ QuickJS 2024], compatible with ES2023)</span> * <span lang="en" dir="ltr" class="mw-content-ltr">unversioned [[Special:MyLanguage/WF:PY|Python]] ([https://docs.python.org/3/license.html PSF License Agreement], Zero-Clause BSD), using the development version of [https://github.com/RustPython/RustPython RustPython] WASI mode (this is intended to be compatible with CPython 3.12)</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Planned === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">versioned JavaScript (ECMA202?+)</span> * <span lang="en" dir="ltr" class="mw-content-ltr">versioned Python (3+)</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Requested === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> See the [[phab:tag/wikifunctions-new-language-requests|workboard in Phabricator]] to request additional programming languages that should be supported in Wikifunctions. Among other criteria for implementation, available language interpreter/compiler software must be freely licensed. </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T352589|T352589]]: LabView/G<!--[https://ni.com/en/support/downloads/activate.html proprietary]--> via pyLabView ([https://github.com/mefistotelis/pylabview/blob/master/LICENSE MIT])</span> * [[phab:T352588|T352588]]: Kotlin ([https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE Apache]) * [[phab:T307171|T307171]]: Lua ([https://lua.org/license.html MIT]) * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T301418|T301418]]: Scratch/Snap!/Logolike ([https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE BSD 3-Clause], GPLv2 and Scratch Source Code License)</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[phab:T298633|T298633]]: Vlojure ([https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE MIT])</span> <div lang="en" dir="ltr" class="mw-content-ltr"> === Former === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Previously, the function evaluator directly ran code in its container. Because it was based on Debian Bullseye, JavaScript execution was provided by Node.js 16 and Python by Python 3.9. These are no longer immediately available due to the re-build onto Web Assembler, but could return if needed via a custom build. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Functions for manipulating == </div> * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] rjhhl0smgaq362v3g2l16mnzpu34dwd Wikifunctions:Wikidata/pl 4 77394 276535 255334 2026-05-20T06:23:49Z FuzzyBot 207 Updating to match new version of source page 276535 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} <div lang="en" dir="ltr" class="mw-content-ltr"> Wikifunctions is represented on [[:d:Wikidata:Main page|Wikidata]] by {{Q|Q104587954}}. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> More Wikidata and Wikifunctions here, soon! </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Functionality we will want == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Items === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Check if an item exists</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get item</span> ** {{done}} {{Z|6821}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get labels</span> ** {{done}} {{Z|22853}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get aliases</span> ** {{done}} {{Z|23080}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get descriptions</span> ** {{done}} {{Z|30120}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|22220}} * <span lang="en" dir="ltr" class="mw-content-ltr">''possibly'' Get sitelinks</span> ** {{done}} {{Z|35207}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Statements === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Get values of statement</span> ** {{done}} {{Z|19308}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get rank</span> ** {{done}} {{Z|20206}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get property of statement</span> ** {{done}} {{Z|19306}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get qualifiers</span> ** {{done}} {{Z|28278}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get references</span> ** {{done}} {{Z|31984}} <span id="Properties"></span> === Właściwości === * <span lang="en" dir="ltr" class="mw-content-ltr">Check if a property exists</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get property</span> ** {{done}} {{Z|6822}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get labels</span> ** {{done}} {{Z|23223}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get aliases</span> ** {{done}} {{Z|23227}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get descriptions</span> ** {{done}} {{Z|23225}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get data type</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|23229}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Lexemes === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Check if a lexeme exists</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get lexeme</span> ** {{done}} {{Z|6825}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get lemmata</span> ** {{done}} {{Z|19293}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get languages</span> ** {{done}} {{Z|19276}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get category</span> ** {{done}} {{Z|19298}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|19300}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get sense</span> ** {{done}} {{Z|6826}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get form</span> ** {{done}} {{Z|6824}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Senses ==== </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Get gloss</span> ** {{done}} {{Z|23114}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|23116}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Forms ==== </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Get representation</span> ** {{done}} {{Z|22399}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get grammatical features</span> ** {{done}} {{Z|22487}} * <span lang="en" dir="ltr" class="mw-content-ltr">Get statement</span> ** {{done}} {{Z|23118}} <div lang="en" dir="ltr" class="mw-content-ltr"> === Entity schemas === </div> * <span lang="en" dir="ltr" class="mw-content-ltr">Check is Entity Schema exists</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get Entity Schema</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get labels</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get aliases</span> * <span lang="en" dir="ltr" class="mw-content-ltr">Get descriptions</span> [[Category:Project{{#translation:}}]] [[Category:Wikidata]] 7fqcq390zct400bp0f5esh72iam14x2 Wikifunctions:Tools/pl 4 77396 276510 255336 2026-05-20T06:22:58Z FuzzyBot 207 Updating to match new version of source page 276510 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> This page is a list of tools you can use to work with Wikifunctions more quickly and comfortably. If you have written a script, feel free to add it so that others can use it. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Dump related tools == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[https://github.com/marius851000/wikifunction_intepreter experimental Wikifunction Rust interpreter] that work on the dump. Written in Rust.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Wikifunctions:Tools/wf-dump-scripts|wf-dump-scripts]] - pipeline for creating statistical wikitables based on dump and the internal Wikifunctions API. Written in [[w:Python (programming language)|Python]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[//wf-query.replit.app wf-query]: tool that allows you to run JSONata queries on a dump of Wikifunctions, with the table output itself also being customizable with JSONata queries. Written in [[w:Node.js|NodeJS]] Express and [[w:JavaScript|vanilla JS]]</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl Dumpextract]: a program to extract info from the dump of Wikifunctions. Written in [[w:COBOL|COBOL]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[https://github.com/99of9/WikifunctionsAnalysis WikifunctionsAnalysis]: some code which helps analyse Wikifunctions dumps</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[User:Amire80/wikifunctionsanalytics#Example_queries|wikifunctionsanalytics]]: A simplified dump, queryable through [[meta:Special:MyLanguage/Research:Quarry|Quarry]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[toolforge:abstract-data/functions]]: Tracking Function usage on [[abstract:|Abstract Wikipedia]].</span> <span id="User_interface"></span> == Interfejs użytkownika == *<span lang="en" dir="ltr" class="mw-content-ltr">[[User:Feeglgeef/wikilambda editsource.js|wikilambda editsource.js]]: User script that allows you to edit the raw JSON content of ZObjects.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[https://yoshirulz.gitlab.io/WikiLambdaBlockly WikiLambdaBlockly]: Web app demonstrating a block-based editing interface for compositions. Uses [[w:Blockly|Blockly]] from [[w:TypeScript|TS]].</span> <div lang="en" dir="ltr" class="mw-content-ltr"> == Others == </div> * <span lang="en" dir="ltr" class="mw-content-ltr">[//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3 find constants]: tool that represents a f64 using Wikifunctions representation. Prints, comma separated, the sign of the float (-1, 0, 1), the exponent of the float, and the fraction of the float. Written in [[w:Rust (programming language)|Rust]].</span> [[Category:Project{{#translation:}}]] djl1no95di6dq28f2ljl5895rl0w2xq Z31981 0 77908 276589 256820 2026-05-20T08:22:11Z YoshiRulz 10156 Clarify en label 276589 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z31981" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z4", "Z17K2": "Z31981K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object type" } ] } } ], "Z8K2": "Z8", "Z8K3": [ "Z20", "Z31982" ], "Z8K4": [ "Z14", "Z31983" ], "Z8K5": "Z31981" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "extract equality function from Type" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "equality function", "Z4K4" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "returns the equality function (if specified) for objects with the given type" } ] } } ehhqnfml4x6zctzp9h4xq6bmp97nhuv Z32053 0 78052 276318 275981 2026-05-19T22:28:03Z Theki 2389 normalize 276318 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z32053" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z32053K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "URL" }, { "Z1K1": "Z11", "Z11K1": "Z1576", "Z11K2": "URL" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "URL" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z32053K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "title of webpage" }, { "Z1K1": "Z11", "Z11K1": "Z1576", "Z11K2": "titolo de retpaĝo" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "titre de la page web" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z32053K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "website name" }, { "Z1K1": "Z11", "Z11K1": "Z1576", "Z11K2": "nomo de retpaĝo" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "nom du site web" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z20420", "Z17K2": "Z32053K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "access date" }, { "Z1K1": "Z11", "Z11K1": "Z1576", "Z11K2": "alirdato" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "date de consultation" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z32053K5", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "display language" }, { "Z1K1": "Z11", "Z11K1": "Z1576", "Z11K2": "montrata lingvo" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue affichée" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20", "Z32054", "Z33002" ], "Z8K4": [ "Z14", "Z32089" ], "Z8K5": "Z32053" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "simple cite web" }, { "Z1K1": "Z11", "Z11K1": "Z1576", "Z11K2": "Simple citi retpaĝon" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "simple citation web" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "cite website", "website reference", "reference a website", "cite a website" ] }, { "Z1K1": "Z31", "Z31K1": "Z1576", "Z31K2": [ "Z6", "citi reton", "citi retejon", "interreta cito" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "A simple version of the cite web template on Wikipedia." }, { "Z1K1": "Z11", "Z11K1": "Z1576", "Z11K2": "Simpla versio de vikipedia ŝablono por citi retpaĝon." }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "une version simplifiée du modèle de citation web utilisé sur Wikipédia." } ] } } 85v9ldy82aae5lezf52k2l419nvha24 Z32212 0 78372 276612 264136 2026-05-20T10:12:33Z Winston Sung 2672 Added Z35435 to the approved list of test cases 276612 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z32212" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32212K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "subject" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "主语" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32212K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "role" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "语义角色" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32212K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "dependency" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "依存关系" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z32212K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "语言" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z32214", "Z32216", "Z35435" ], "Z8K4": [ "Z14", "Z32213" ], "Z8K5": "Z32212" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "defining role sentence in S/T Chinese" }, { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "簡繁中文定義句" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Valid for all variants of Chinese." } ] } } six75njno8syq8jpj8p3rdtkimgno4t Z32326 0 78559 276346 262642 2026-05-20T00:27:02Z Theki 2389 normalize 276346 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z32326" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32326K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "subject" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32326K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "role" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32326K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "dependency" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z32326K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z32329" ], "Z8K4": [ "Z14", "Z32327" ], "Z8K5": "Z32326" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "collective role sentence" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "[X] are [Y] of [Z]" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Creates sentences of the form [X]s are [Y]s of [Z]." } ] } } 0xw183m7tyc64790anj41zd433kejxv Z32581 0 78831 276340 269810 2026-05-20T00:25:04Z Theki 2389 normalize 276340 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z32581" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32581K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "entita" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32581K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "třída" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32581K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "creator" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "tvůrce" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z32581K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "jazyk" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z32583" ], "Z8K4": [ "Z14", "Z32582" ], "Z8K5": "Z32581" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "creative work - entity, class, creator" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "Oeuvre de l'esprit - entité, classe, auteur" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "tvůrčí dílo – entita, třída, tvůrce" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "sestaví definiční větu popisující tvůrčí dílo pomocí jeho třídy a tvůrce" } ] } } j63lkcwv0mu9zequfll4dq6lr0eqywb 276348 276340 2026-05-20T00:27:32Z Theki 2389 use en dash 276348 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z32581" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32581K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "entita" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32581K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "třída" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z32581K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "creator" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "tvůrce" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z32581K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "jazyk" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z32583" ], "Z8K4": [ "Z14", "Z32582" ], "Z8K5": "Z32581" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "creative work – entity, class, creator" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "Oeuvre de l'esprit - entité, classe, auteur" }, { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "tvůrčí dílo – entita, třída, tvůrce" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "creative work - entity, class, creator" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1062", "Z11K2": "sestaví definiční větu popisující tvůrčí dílo pomocí jeho třídy a tvůrce" } ] } } mzx2x3jkoe6i6koz332jwic6irb1zhw Wikifunctions:Type/cs 4 78957 276514 270481 2026-05-20T06:23:19Z FuzzyBot 207 Updating to match new version of source page 276514 wikitext text/x-wiki <languages/>{{Technical documentation navbox}} Každý Objekt ve Wikifunkcích patří k nějakému Typu. Typy rozhodují o tom, jak jsou Objekty daného Typu strukturovány a co znamenají. Typy se také používají pro definici Argumentů Funkce a také toho, co vrací. V současné době existuje <del>{{formatnum:{{NUMBEROFTYPES}}}}</del> ~{{formatnum:100}} Typů, které lze používat pro Argumenty a Typ návratové hodnoty Funkce: * {{Z+|Z1}} * {{Z+|Z4}} * {{Z+|Z8}} * {{Z+|Z23}} * {{Z+|Z21}} * {{Z+|Z40}} * {{Z+|Z22112}} * {{Z+|Z881}} (toto je parametrizováno, tzn. je to Funkce, která vrací Typ) * {{Z+|Z882}} (parametrizováno) * {{Z+|Z883}} (parametrizováno) * {{Z+|Z6884}} (parametrizováno, používá se pro definici [[Special:MyLanguage/WF:Function_model#Lightweight_enumerations|zjednodušených výčtových typů]]) <span id="Numeric_types"></span> === Numerické typy === * {{Z+|Z80}} * {{Z+|Z13518}} * {{Z+|Z16659}} * {{Z+|Z16683}} * {{Z+|Z19677}} * {{Z+|Z20825}} * {{Z+|Z20838}} * {{Z+|Z33198}} <span id="Language_and_text_types"></span> === Jazykové a textové typy === * {{Z+|Z86}} * {{Z+|Z6}} * {{Z+|Z60}} * {{Z+|Z11}} * {{Z+|Z31}} * {{Z+|Z12}} * {{Z+|Z32}} * {{Z+|Z89}} * {{Z+|Z14293}} * {{Z+|Z14294}} <span id="Grammatical_feature_enums"></span> ==== Výčtové typy pro gramatické vlastnosti ==== * {{Z+|Z28516}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28519}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25502}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25340}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z25501}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26935}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z26934}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28215}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28515}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28517}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32792}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z32789}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27970}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28518}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28520}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z33568}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z27971}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="Calendar_types"></span> === Kalendářové typy === <span id="Gregorian_calendar"></span> ==== Gregoriánský kalendář ==== * {{Z+|Z17402}} * {{Z+|Z16098}} * {{Z+|Z17813}} * {{Z+|Z20159}} * {{Z+|Z20342}} * {{Z+|Z20420}} <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Hijri (Islamic) calendar ==== </div> * {{Z+|Z26582}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <div lang="en" dir="ltr" class="mw-content-ltr"> ==== Igbo calendar ==== </div> * {{Z+|Z16927}} <span id="Wikidata_types"></span> === Typy Wikidat === {{see also|Help:Wikidata#Statement model}} * {{Z+|Z6030}} <span id="Wikidata_entities"></span> ==== Entity Wikidat ==== * {{Z+|Z6001}} * {{Z+|Z6002}} * {{Z+|Z6004}} * {{Z+|Z6005}} * {{Z+|Z6006}} <span id="Wikidata_references"></span> ==== Reference na Wikidata ==== * {{Z+|Z6091}} * {{Z+|Z6092}} * {{Z+|Z6094}} * {{Z+|Z6095}} * {{Z+|Z6096}} <span id="Wikidata_statements"></span> ==== Výroky Wikidat ==== * {{Z+|Z6020}} * {{Z+|Z6007}} * {{Z+|Z6003}} * {{Z+|Z6040}} * {{Z+|Z6008}} * {{Z+|Z6039}} <span id="Wikidata_datatypes"></span> ==== Datové typy Wikidat ==== * {{Z+|Z6010}} * {{Z+|Z6011}} * {{Z+|Z6060}} * {{Z+|Z6061}} * {{Z+|Z6062}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6063}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z6064}} <span id="Miscellaneous"></span> === Různé === * {{Z+|Z27951}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) * {{Z+|Z28579}} * {{Z+|Z33827}} (<span lang="en" dir="ltr" class="mw-content-ltr">lightweight enum</span>) <span id="WikiLambda_structure"></span> === Struktura WikiLambda === * {{Z+|Z2}} * {{Z+|Z9}} * {{Z+|Z3}} * {{Z+|Z39}} * {{Z+|Z46}} * {{Z+|Z64}} * {{Z+|Z17}} * {{Z+|Z18}} * {{Z+|Z20}} * {{Z+|Z14}} * {{Z+|Z16}} * {{Z+|Z61}} <span id="Evaluation"></span> ==== Vyhodnocování ==== * {{Z+|Z7}} * {{Z+|Z22}} * {{Z+|Z5}} * {{Z+|Z50}} * {{Z+|Z99}} Mohou se používat i další typy, ale mohou se objevovat chyby. Také si můžete zobrazit [[Special:ListObjectsByType/Z4|seznam všech typů]] (ten však neobsahuje [[Special:ListObjectsByType/Z7|perzistentní volání]], která vracejí typy, např. zjednodušené výčtové typy, ani parametrizované typy jako např. {{Z|881}}). Nové Typy lze navrhovat na stránce [[Wikifunctions:Type proposals]]. <span id="See_also"></span> == Související stránky == * {{ll|Wikifunctions:Function model}} [[Category:Technical documentation{{#translation:}}|Type]] p6i4vh52a64fj8kfb0xpt8ycodkaozw Z32807 0 79236 276319 261765 2026-05-19T22:43:03Z JJPMaster 6409 Added Z32808 to the approved list of implementations 276319 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z32807" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z13518", "Z17K2": "Z32807K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "depth" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z8", "Z17K2": "Z32807K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "transformation function" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z32807K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "tensor" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z32809", "Z32886", "Z32887", "Z32888" ], "Z8K4": [ "Z14", "Z32808" ], "Z8K5": "Z32807" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "transform elements of list of lists at depth" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "transform elements of tensor at depth", "transform elements of multidimensional array at depth", "map function over elements of list of lists at depth", "map function over elements of tensor at depth", "map function over elements of multidimensional array at depth", "apply unary function to elements of list of lists at depth", "apply unary function to elements of tensor at depth", "apply unary function to elements of multidimensional array at depth" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "depth of 0 is equivalent to Z13036/apply; depth 1 is equivalent to Z873/map; depth 2 is equivalent to Z32806/mapMatrix etc." } ] } } r0skk2b8eoq31ge6hbnwwulw2vjbsd6 Z33335 0 80083 276602 269788 2026-05-20T10:03:02Z Winston Sung 2672 276602 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33335" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33335K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hant string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33335K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hans string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z33335K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z33338", "Z33337", "Z33339", "Z33386" ], "Z8K4": [ "Z14", "Z33336", "Z33390" ], "Z8K5": "Z33335" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-* String from language and str in zh-hant/s" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return string in different variant of Chinese, with input of string in zh-hant, string in zh-hans, and natural language" } ] } } f2m470oywjtvzq3vt2j7xx9huqw2ish 276623 276602 2026-05-20T10:23:07Z Winston Sung 2672 276623 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33335" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33335K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-Hant string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33335K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-Hans string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z33335K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z33338", "Z33337", "Z33339", "Z33386" ], "Z8K4": [ "Z14", "Z33336", "Z33390" ], "Z8K5": "Z33335" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-* string from language and str in zh-Hant/Hans" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return string in different variant of Chinese, with input of string in zh-Hant, string in zh-Hans, and natural language" } ] } } cxzzu3gav6cy0s317ek0e7pghdc4jry Z33336 0 80084 276601 264735 2026-05-20T10:02:39Z Winston Sung 2672 276601 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33336" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z33335", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z610", "Z16K2": "def Z33335(Z33335K1, Z33335K2, Z33335K3):\n\tif Z33335K3.Z60K1 in [\"zh-hant\", \"zh-tw\", \"zh-hk\", \"zh-mo\"]:\n\t\treturn Z33335K1\n\telif Z33335K3.Z60K1 in [\"zh-hans\", \"zh-cn\", \"zh-my\", \"zh-sg\"]:\n\t\treturn Z33335K2\n\telse:\n\t\treturn Z33335K1 # default return traditional character for now" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-* str from lang and str in zh-hant/s, python" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 8817mt6vhlu5g4t41vqj3zsd0fisxnu Z33337 0 80085 276599 264736 2026-05-20T10:01:30Z Winston Sung 2672 276599 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33337" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "一個", "Z33335K2": "一个", "Z33335K3": "Z1672" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "一個" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "一個 zh-hant" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 5axkzs0ppxceydjp2ip89jobry2bjwo 276614 276599 2026-05-20T10:13:43Z Winston Sung 2672 276614 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33337" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "一個", "Z33335K2": "一个", "Z33335K3": "Z1672" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "一個" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "zh-Hant 一個" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 0rosx9q50b2ri2xjzezlputkfe3fw62 Z33338 0 80086 276600 264734 2026-05-20T10:01:53Z Winston Sung 2672 276600 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33338" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "位於", "Z33335K2": "位于", "Z33335K3": "Z1645" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "位于" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "位于 zh-hans" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } l29kk94x4wccyt18kzci535y4xtl5tl 276613 276600 2026-05-20T10:13:31Z Winston Sung 2672 276613 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33338" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "位於", "Z33335K2": "位于", "Z33335K3": "Z1645" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "位于" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "zh-Hans 位于" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } mhottem4avbj9qswaoqzro650rk30iv Z33339 0 80087 276604 264737 2026-05-20T10:03:58Z Winston Sung 2672 276604 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33339" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "一種", "Z33335K2": "一种", "Z33335K3": "Z1504" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "一种" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "一种 zh-sg" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } p9a3comcfpdzg2589f4q7z48ljv0id0 276616 276604 2026-05-20T10:14:27Z Winston Sung 2672 276616 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33339" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "一種", "Z33335K2": "一种", "Z33335K3": "Z1504" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "一种" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "zh-Hans-SG 一种" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } iwq0kpmzft1cg8yrn7tg0ii03r0ueje Z33386 0 80139 276605 264933 2026-05-20T10:04:34Z Winston Sung 2672 276605 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33386" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "期間", "Z33335K2": "期间", "Z33335K3": "Z1589" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "期間" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1589", "Z11K2": "期間 zh-hk" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } akrk5ef6kxg4a54dtmq40ioh051u75d 276606 276605 2026-05-20T10:04:42Z Winston Sung 2672 276606 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33386" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "期間", "Z33335K2": "期间", "Z33335K3": "Z1589" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "期間" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1589", "Z11K2": "期間 zh-hk" }, { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "期間 zh-hk" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } pt2eo5wqj7ipwvpfwb1ph79z4j58xo3 276621 276606 2026-05-20T10:20:22Z Winston Sung 2672 276621 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33386" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33335", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33335", "Z33335K1": "期間", "Z33335K2": "期间", "Z33335K3": "Z1589" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "期間" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1589", "Z11K2": "zh-Hant-HK 期間" }, { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "zh-Hant-HK 期間" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 02l5v924mpvcav21xtftd995nu275b4 Z33389 0 80142 276592 270695 2026-05-20T09:54:10Z Winston Sung 2672 276592 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33389" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z32788", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z32788", "Z32788K1": { "Z1K1": "Z6091", "Z6091K1": "Q117" }, "Z32788K2": { "Z1K1": "Z6091", "Z6091K1": "Q3624078" }, "Z32788K3": { "Z1K1": "Z6091", "Z6091K1": "Q4412" }, "Z32788K4": "Z1589" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1589", "Z11K2": "加納是西非的一個主權國家。" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Test zh-hk: \"Ghana is a sov state in West Africa.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "加納是西非的一個主權國家。" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } t2nejiad4u35wtnmgotlkmqut2epmmy Z33390 0 80148 276603 264969 2026-05-20T10:03:22Z Winston Sung 2672 276603 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33390" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z33335", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z12696", "Z12696K1": [ "Z60", "Z1107", "Z1589", "Z1406" ], "Z12696K2": { "Z1K1": "Z18", "Z18K1": "Z33335K3" } }, "Z802K2": { "Z1K1": "Z18", "Z18K1": "Z33335K1" }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z12696", "Z12696K1": [ "Z1", "Z1645", "Z1411", "Z1504", "Z1591" ], "Z12696K2": { "Z1K1": "Z18", "Z18K1": "Z33335K3" } }, "Z802K2": { "Z1K1": "Z18", "Z18K1": "Z33335K2" }, "Z802K3": { "Z1K1": "Z18", "Z18K1": "Z33335K1" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-* str from language and str in zh-hant/s, comp" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } k4fkk4q95ayfig2ulnmizhygzzf3mmk Z33391 0 80149 276617 264985 2026-05-20T10:15:43Z Winston Sung 2672 276617 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33391" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hant string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hans string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z33391K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z33393" ], "Z8K4": [ "Z14", "Z33392" ], "Z8K5": "Z33391" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "monolingual text from lang and str in zh-hant/s" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Please note this function lacks fundamental support of distinguish zh-Hant (zh-Hant-TW) and zh-Hant-HK" } ] } } dra193ln7fvom2odhig9cdilw0ybjlo 276618 276617 2026-05-20T10:15:54Z Winston Sung 2672 276618 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33391" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hant string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hans string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z33391K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z33393" ], "Z8K4": [ "Z14", "Z33392" ], "Z8K5": "Z33391" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "monolingual text from lang and str in zh-Hant/s" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Please note this function lacks fundamental support of distinguish zh-Hant (zh-Hant-TW) and zh-Hant-HK" } ] } } ktknzas6ug7pz55qv1drzkdvarh68s9 276619 276618 2026-05-20T10:16:06Z Winston Sung 2672 276619 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33391" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hant string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-hans string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z33391K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z33393" ], "Z8K4": [ "Z14", "Z33392" ], "Z8K5": "Z33391" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "monolingual text from lang and str in zh-Hant/Hans" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Please note this function lacks fundamental support of distinguish zh-Hant (zh-Hant-TW) and zh-Hant-HK" } ] } } pjzvge1r8jssyr92f17iperp8z3fja5 276622 276619 2026-05-20T10:21:33Z Winston Sung 2672 276622 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33391" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-Hant string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z33391K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "zh-Hans string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z33391K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z33393" ], "Z8K4": [ "Z14", "Z33392" ], "Z8K5": "Z33391" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "monolingual text from lang and str in zh-Hant/Hans" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Please note this function lacks fundamental support of distinguish zh-Hant (zh-Hant-TW) and zh-Hant-HK" } ] } } jrnpkwr49d0l8w4yy0e4gd0zyqop0x4 Z33392 0 80150 276620 264978 2026-05-20T10:16:32Z Winston Sung 2672 276620 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33392" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z33391", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z12696", "Z12696K1": [ "Z60", "Z1107", "Z1589", "Z1406" ], "Z12696K2": { "Z1K1": "Z18", "Z18K1": "Z33391K3" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z26107", "Z26107K1": { "Z1K1": "Z18", "Z18K1": "Z33391K3" }, "Z26107K2": { "Z1K1": "Z18", "Z18K1": "Z33391K1" } }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z12696", "Z12696K1": [ "Z1", "Z1645", "Z1411", "Z1504", "Z1591" ], "Z12696K2": { "Z1K1": "Z18", "Z18K1": "Z33391K3" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z26107", "Z26107K1": { "Z1K1": "Z18", "Z18K1": "Z33391K3" }, "Z26107K2": { "Z1K1": "Z18", "Z18K1": "Z33391K2" } }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z26107", "Z26107K1": { "Z1K1": "Z18", "Z18K1": "Z33391K3" }, "Z26107K2": { "Z1K1": "Z18", "Z18K1": "Z33391K1" } } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "mono text from lang and str in zh-Hant/s, compose" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 20yrx7jaopknxbtaszowjgui14z2iwk Z33393 0 80151 276595 264979 2026-05-20T09:58:06Z Winston Sung 2672 276595 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33393" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33391", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33391", "Z33391K1": "什麼", "Z33391K2": "什么", "Z33391K3": "Z1591" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1591", "Z11K2": "什么" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "什么 (zh-my)" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 3j1gbe5vv97xon2mwcd0epibootseg8 276615 276595 2026-05-20T10:14:03Z Winston Sung 2672 276615 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33393" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z33391", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z33391", "Z33391K1": "什麼", "Z33391K2": "什么", "Z33391K3": "Z1591" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1591", "Z11K2": "什么" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "zh-Hans-MY 什么" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } ftzg3fcnahju84lk6yf81mtgyj2mks7 Z33766 0 80721 276294 267216 2026-05-19T19:53:04Z Dv103 11127 fetches with fallback languages 276294 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33766" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z26513", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z10771", "Z10771K1": { "Z1K1": "Z7", "Z7K1": "Z26737", "Z26737K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z18", "Z18K1": "Z26513K1" }, "Z30120K2": [ "Z6030", "Z6033", "Z6036" ], "Z30120K3": { "Z1K1": "Z7", "Z7K1": "Z24144", "Z24144K1": "Z1787", "Z24144K2": { "Z1K1": "Z40", "Z40K1": "Z41" }, "Z24144K3": { "Z1K1": "Z40", "Z40K1": "Z41" } }, "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P31" }, { "Z1K1": "Z6092", "Z6092K1": "P735" } ] }, "Z26737K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z33823", "Z33823K1": { "Z1K1": "Z18", "Z18K1": "Z26513K1" }, "Z33823K2": { "Z1K1": "Z6092", "Z6092K1": "P5137" }, "Z33823K3": "Z1787", "Z33823K4": [ "Z6030" ], "Z33823K5": [ "Z60" ], "Z33823K6": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P5713" }, { "Z1K1": "Z6092", "Z6092K1": "P5185" } ] }, "Z850K2": "Z28248", "Z850K3": "Z24" } } }, " ", { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z27107", "Z27107K1": { "Z1K1": "Z7", "Z7K1": "Z33823", "Z33823K1": { "Z1K1": "Z18", "Z18K1": "Z26513K2" }, "Z33823K2": { "Z1K1": "Z6092", "Z6092K1": "P5137" }, "Z33823K3": "Z1787", "Z33823K4": [ "Z6030" ], "Z33823K5": [ "Z60" ], "Z33823K6": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P5185" } ] } }, "Z850K2": "Z28248", "Z850K3": { "Z1K1": "Z7", "Z7K1": "Z10000", "Z10000K1": "un'istanza di ", "Z10000K2": { "Z1K1": "Z7", "Z7K1": "Z24766", "Z24766K1": { "Z1K1": "Z18", "Z18K1": "Z26513K2" }, "Z24766K2": "Z1787" } } }, "." ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "frase di istanziazione, it, con try-catch" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } sy51x34s2jd85cp53fi8avz43xa3lve Wikifunctions:Programming languages/nl 4 80749 276483 266993 2026-05-20T06:20:35Z FuzzyBot 207 Updating to match new version of source page 276483 wikitext text/x-wiki <languages/> {{shortcut|[[WF:PROG]]}}<!--{{distinguish|WF:HL}}--> {{see also|category:implementations|}} * {{ll|WF:Human languages}} * <span lang="en" dir="ltr" class="mw-content-ltr">[[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia.</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[Special:MyLanguage/WF:glossary#composition|Compositions]] are a kind of LISPish language, but aren't covered here.</span> <span id="Executable"></span> == Uitvoerbaar bestand == <span id="Implemented"></span> === Geïmplementeerd === Vanaf maart 2024 compileren de volgende talen naar [[meta:Special:MyLanguage/Abstract Wikipedia/Updates/2023-10-25|WASM]] die worden uitgevoerd door [[Special:MyLanguage/WF:glossary#executor|executor]]: * <span class="mw-translate-fuzzy">Unversioned JavaScript ([https://ecma-international.org/policies/by-ipr/ecma-text-copyright-policy W3C Software and Document Notice and License], [https://hacks.mozilla.org/2022/06/the-specification-for-javascript-has-a-new-license src]), met behulp van [https://github.com/second-state/wasmedge-quickjs WasmEdge-QuickJS] (met behulp van [https://bellard.org/quickjs/ QuickJS 2024], compatibel met ES2023)</span> * <span class="mw-translate-fuzzy">unversioned Python ([https://docs.python.org/3/license.html PSF License Agreement], Zero-Clause BSD), met behulp van de ontwikkelingsversie van [https://github.com/RustPython/RustPython RustPython] WASI-modus (dit is bedoeld om compatibel te zijn met CPython 3.12)</span> <span id="Planned"></span> === Gepland === * versioned JavaScript (ECMA202?+) * versioned Python (3+) <span id="Requested"></span> === Verzoeken === Zie het [[phab:tag/wikifunctions-new-language-requests|workboard in Phabricator]] om aanvullende programmeertalen aan te vragen die in Wikifuncties ondersteund zouden moeten worden. Naast andere implementatiecriteria moet er vrij gelicentieerde taalinterpreter/compilersoftware beschikbaar zijn. * [[phab:T352589|T352589]]: LabView/G<!--[https://ni.com/en/support/downloads/activate.html proprietary]--> via pyLabView ([https://github.com/mefistotelis/pylabview/blob/master/LICENSE MIT]) * [[phab:T352588|T352588]]: Kotlin ([https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE Apache]) * [[phab:T307171|T307171]]: Lua ([https://lua.org/license.html MIT]) * [[phab:T301418|T301418]]: Scratch/Snap!/Logolike ([https://github.com/scratchfoundation/scratch-gui/blob/develop/LICENSE BSD 3-Clause], GPLv2 en Scratch Source Code Licentie) * [[phab:T298633|T298633]]: Vlojure ([https://github.com/Ella-Hoeppner/Vlojure/blob/main/LICENSE MIT]) <span id="Former"></span> === Verleden === Eerder is de functie-evaluator code rechtstreeks in een container gezet. Omdat het gebaseerd was op Debian Bullseye, werd JavaScript-uitvoering door Node.js 16 en Python door Python 3.9 aangeboden. Deze zijn niet langer direct beschikbaar als gevolg van de heropbouw op Web Assembler, maar kunnen terugkeren indien nodig via een aangepaste build. <span id="Functions_for_manipulating"></span> == Functies voor manipulaties == * {{ll|WF:Mathematica}} [[Category:Project{{#translation:}}]] 6f4cp946exzlt8f34v4fqrlmzi12tm1 Z33975 0 81041 276342 267994 2026-05-20T00:25:38Z Theki 2389 normalize 276342 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z33975" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z33975K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z33975K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "class" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z33975K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "location" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z33975K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z33982" ], "Z8K4": [ "Z14", "Z33976" ], "Z8K5": "Z33975" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "state origin using entity and class" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "X is a Y from Z", "something is a something from somewhere", "? is a ? from ?" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Forms a sentence stating the origin and class of a given entity. E.g. \"Mozart is a composer from Austria.\"" } ] } } ou60xur0dj1bitn4icj6cxsv9ro5cdb Z34041 0 81116 276596 268225 2026-05-20T09:58:36Z Winston Sung 2672 276596 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z34041" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z34039", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z34039", "Z34039K1": "Z33028", "Z34039K2": { "Z1K1": "Z6091", "Z6091K1": "Q57906" }, "Z34039K3": { "Z1K1": "Z6091", "Z6091K1": "Q748149" }, "Z34039K4": { "Z1K1": "Z6091", "Z6091K1": "Q16963" }, "Z34039K5": "Z1645" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1645", "Z11K2": "扬州市是江苏省的一个地级市。" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "three parameter zh-hans state location" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } fms997djzeae5pehwtlxxh5hgndap2m Z34282 0 81548 276347 269643 2026-05-20T00:27:16Z Theki 2389 use en dash 276347 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z34282" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z34282K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z34282K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z11", "Z8K3": [ "Z20", "Z34284" ], "Z8K4": [ "Z14", "Z34283" ], "Z8K5": "Z34282" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "classifying sentence – entity" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "classifying sentence - entity" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } g9ecer4yymqwliblvvd4xld5sc7vcfr Wikifunctions:Wikidata/nl 4 81798 276536 270431 2026-05-20T06:23:49Z FuzzyBot 207 Updating to match new version of source page 276536 wikitext text/x-wiki <languages/> {{see also|Help:Wikidata}} Wikifunctions wordt weergegeven op [[:d:Wikidata:Main page|Wikidata]] met {{Q|Q104587954}}. Binnenkort, hier meer Wikidata en Wikifuncties! <span id="Functionality_we_will_want"></span> == Gewenste functionaliteit == === Items === * Controleren of een item bestaat * Item ophalen ** {{done}} {{Z|6821}} * Labels ophalen ** {{done}} {{Z|22853}} * Aliassen ophalen ** {{done}} {{Z|23080}} * Beschrijvingen ophalen ** {{done}} {{Z|30120}} * Verklaring ophalen ** {{done}} {{Z|22220}} * ''mogelijke'' sitelinks ophalen ** {{done}} {{Z|35207}} <span id="Statements"></span> === Verklaringen === * Waarden van verklaring ophalen ** {{done}} {{Z|19308}} * Rang ophalen ** {{done}} {{Z|20206}} * Eigenschap van verklaring ophalen ** {{done}} {{Z|19306}} * Kwalificaties ophalen ** {{done}} {{Z|28278}} * Referenties ophalen ** {{done}} {{Z|31984}} <span id="Properties"></span> === Eigenschappen === * Controleren of een eigenschap bestaat * Eigenschap ophalen ** {{done}} {{Z|6822}} * Labels ophalen ** {{done}} {{Z|23223}} * Aliassen ophalen ** {{done}} {{Z|23227}} * Beschrijvingen ophalen ** {{done}} {{Z|23225}} * Gegevenstype ophalen * Verklaring ophalen ** {{done}} {{Z|23229}} <span id="Lexemes"></span> === Lexemen === * Controleren of een lexeem bestaat * Lexeem ophalem ** {{done}} {{Z|6825}} * Lemmata ophalen ** {{done}} {{Z|19293}} * Talen ophalen ** {{done}} {{Z|19276}} * Categorie ophalen ** {{done}} {{Z|19298}} * Verklaring ophalen ** {{done}} {{Z|19300}} * Betekenis ophalen ** {{done}} {{Z|6826}} * Vorm ophalen ** {{done}} {{Z|6824}} <span id="Senses"></span> ==== Betekenissen ==== * Gloss ophalen ** {{done}} {{Z|23114}} * Verklaring ophalen ** {{done}} {{Z|23116}} <span id="Forms"></span> ==== Vormen ==== * Representatie ophalen ** {{done}} {{Z|22399}} * Grammatische kenmerken ophalen ** {{done}} {{Z|22487}} * Verklaring ophalen ** {{done}} {{Z|23118}} <span id="Entity_schemas"></span> === Entiteitschema's === * Controleer of het entiteitsschema bestaat * Entiteitsschema ophalen * Labels ophalen * Aliassen ophalen * Beschrijvingen ophalen [[Category:Project{{#translation:}}]] [[Category:Wikidata]] smq746hbc6q4und5rxj2zly6ezoj9nf Wikifunctions:Tools/nl 4 81848 276509 270466 2026-05-20T06:22:57Z FuzzyBot 207 Updating to match new version of source page 276509 wikitext text/x-wiki <languages/> Deze pagina is een lijst met hulpmiddelen die u kunt gebruiken om sneller en comfortabeler met Wikifuncties te werken. Als u een script heeft geschreven, mag u het hier toevoegen zodat anderen het kunnen gebruiken. <span id="Dump_related_tools"></span> == Hulpmiddelen voor het dumpen van gegevens == * [https://github.com/marius851000/wikifunction_intepreter experimentele Wikifunctie Rust interpreter] dat werkt op de dump. Geschreven in Rust. * [[Wikifunctions:Tools/wf-dump-scripts|wf-dump-scripts]] - voor het creëren van statistische wikitabellen op basis van dump en de interne Wikifuncties API. Geschreven in [[w:nl:Python (programmeertaal)|Python]] * [//wf-query.replit.app wf-query]: hulpmiddel waarmee u JSONata-queries kunt uitvoeren op een dump van Wikifuncties, waarbij de tabeloutput zelf ook aanpasbaar is met JSONata-queries. Geschreven in [[w:nl:Node.js|NodeJS]] Express en [[w:nl:JavaScript|vanilla JS]] * [//gitlab.wikimedia.org/hogue/cobol-file-collection/-/blob/main/Wikifunctionsdumpextract/Dumpextract.cbl Dumpextract]: een programma om informatie te extraheren uit de dump van Wikifuncties. Geschreven in [[w:nl:COBOL|COBOL]]. * [https://github.com/99of9/WikifunctionsAnalysis WikifunctionsAnalysis]: code die helpt bij het analyseren van dumps van Wikifuncties * <span lang="en" dir="ltr" class="mw-content-ltr">[[User:Amire80/wikifunctionsanalytics#Example_queries|wikifunctionsanalytics]]: A simplified dump, queryable through [[meta:Special:MyLanguage/Research:Quarry|Quarry]].</span> * <span lang="en" dir="ltr" class="mw-content-ltr">[[toolforge:abstract-data/functions]]: Tracking Function usage on [[abstract:|Abstract Wikipedia]].</span> <span id="User_interface"></span> == Gebruikersinterface == *[[User:Feeglgeef/wikilambda editsource.js|wikilambda editsource.js]]: Gebruikersscript waarmee u de ruwe JSON-inhoud van ZObjects kunt bewerken. * [https://yoshirulz.gitlab.io/WikiLambdaBlockly WikiLambdaBlockly]: Webapp die een blokgebaseerde bewerkingsinterface voor composities demonstreert. Gebruikt [[w:Blockly|Blockly]] van [[w:nl:TypeScript|TS]]. <span id="Others"></span> == Overig == * [//play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b148d3d147139ddf88cdbc8308bec6e3 find constants]: tool die een f64 voorstelt met behulp van Wikifuncties-representatie. Afdrukken, komma gescheiden, het teken van de float (-1, 0, 1), de exponent de float en de fractie van de float. Geschreven in [[w:nl:Rust (programmeertaal)|Rust]]. [[Category:Project{{#translation:}}]] j66ss21s4rtjtdrwnr48vpddpenjp1b Z34549 0 81984 276593 271074 2026-05-20T09:54:44Z Winston Sung 2672 276593 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z34549" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z32788", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z32788", "Z32788K1": { "Z1K1": "Z6091", "Z6091K1": "Q9361" }, "Z32788K2": { "Z1K1": "Z6091", "Z6091K1": "Q515" }, "Z32788K3": { "Z1K1": "Z6091", "Z6091K1": "Q813" }, "Z32788K4": "Z1406" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1406", "Z11K2": "比什凱克是吉爾吉斯斯坦的一個城市。" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Test zh-mo: \"Bishkek is a city in Kyrgyzstan.\"" }, { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "比什凱克是吉爾吉斯斯坦的一個城市。" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } opxa44qs2od2qmqr4t406u3d327zmm4 Z34925 0 82685 276607 272882 2026-05-20T10:05:14Z Winston Sung 2672 276607 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z34925" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z27868", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z27868", "Z27868K1": { "Z1K1": "Z7", "Z7K1": "Z26039", "Z26039K1": { "Z1K1": "Z6091", "Z6091K1": "Q788" }, "Z26039K2": { "Z1K1": "Z6091", "Z6091K1": "Q9430" }, "Z26039K3": "Z1006" } }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z877", "Z877K2": { "Z1K1": "Z7", "Z7K1": "Z33687", "Z33687K1": { "Z1K1": "Z6091", "Z6091K1": "Q788" }, "Z33687K2": { "Z1K1": "Z6091", "Z6091K1": "Q9430" }, "Z33687K3": "Z1006", "Z33687K4": "", "Z33687K5": "", "Z33687K6": "", "Z33687K7": "" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "[zh-Hant] use funtion call results as input" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } k2yd18phsu7tgnh9w20bh9myg2rscr9 276608 276607 2026-05-20T10:05:37Z Winston Sung 2672 276608 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z34925" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z27868", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z27868", "Z27868K1": { "Z1K1": "Z7", "Z7K1": "Z26039", "Z26039K1": { "Z1K1": "Z6091", "Z6091K1": "Q788" }, "Z26039K2": { "Z1K1": "Z6091", "Z6091K1": "Q9430" }, "Z26039K3": "Z1672" } }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z877", "Z877K2": { "Z1K1": "Z7", "Z7K1": "Z33687", "Z33687K1": { "Z1K1": "Z6091", "Z6091K1": "Q788" }, "Z33687K2": { "Z1K1": "Z6091", "Z6091K1": "Q9430" }, "Z33687K3": "Z1672", "Z33687K4": "", "Z33687K5": "", "Z33687K6": "", "Z33687K7": "" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "[zh-Hant] use funtion call results as input" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } jg78rqrkw0logfywabes234y4azmd4b Z34929 0 82689 276594 272887 2026-05-20T09:55:36Z Winston Sung 2672 Do not use zh 276594 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z34929" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z34927", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z34927", "Z34927K1": { "Z1K1": "Z6091", "Z6091K1": "Q515" }, "Z34927K2": "Z1672" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "城市" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Q515, zh-Hant → 城市" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } orui4r1ug2h5dn1xvfecmp1q4sdu1q3 Z35036 0 82938 276209 275835 2026-05-19T15:49:02Z Dv103 11127 +it 276209 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35036" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35036K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property reference" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "référence de la propriété" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "riferimento a proprietà Wikidata" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6030" }, "Z17K2": "Z35036K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "parts to fetch" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "parties à récupérer" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "parti di proprietà da selezionare" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z60" }, "Z17K2": "Z35036K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "languages to fetch" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langues à récupérer" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingue da selezionare" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6092" }, "Z17K2": "Z35036K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "statement predicates to fetch" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "prédicats d'instruction à récupérer" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà le cui dichiarazioni da selezionare" } ] } } ], "Z8K2": "Z6002", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35037" ], "Z8K5": "Z35036" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "fetch Wikidata property or parts" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "récupérer une propriété ou des parties de Wikidata" }, { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "ottieni singola proprietà Wikidata parziale" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [ "Z6", "selectively fetch parts of Wikidata property", "selectively fetch partial WD property (from PID)" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 3jo32z0gewww23gnqcm7i80rwtor2yh Z35103 0 83201 276215 274093 2026-05-19T15:59:40Z Dv103 11127 276215 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35103" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6002", "Z17K2": "Z35103K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "subject property" }, { "Z1K1": "Z11", "Z11K1": "Z1844", "Z11K2": "simunong katangian" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35103K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "predicate property" }, { "Z1K1": "Z11", "Z11K1": "Z1844", "Z11K2": "panaguring katangian" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6001" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35103" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "get statements for Wikidata property from property" }, { "Z1K1": "Z11", "Z11K1": "Z1844", "Z11K2": "kunin ang statements para sa property mula sa prop" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1844", "Z31K2": [ "Z6", "get statements for Wikidata property from property" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "e.g. for inputs [P178 (developer), P6104 (maintained by WikiProject)], get the outputs Q6526225 (WikiProject Computer Science) + Q21830563 (WikiProject Organizations) as a typed list" } ] } } peglyg91u4s85uxyt6j9bb5df257pxh 276217 276215 2026-05-19T16:02:48Z Dv103 11127 Added Z35366 to the approved list of implementations 276217 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35103" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6002", "Z17K2": "Z35103K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "subject property" }, { "Z1K1": "Z11", "Z11K1": "Z1844", "Z11K2": "simunong katangian" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35103K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "predicate property" }, { "Z1K1": "Z11", "Z11K1": "Z1844", "Z11K2": "panaguring katangian" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6001" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35366" ], "Z8K5": "Z35103" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "get statements for Wikidata property from property" }, { "Z1K1": "Z11", "Z11K1": "Z1844", "Z11K2": "kunin ang statements para sa property mula sa prop" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1844", "Z31K2": [ "Z6", "get statements for Wikidata property from property" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "e.g. for inputs [P178 (developer), P6104 (maintained by WikiProject)], get the outputs Q6526225 (WikiProject Computer Science) + Q21830563 (WikiProject Organizations) as a typed list" } ] } } modnbsirkzlvajjk5eotn6t5rl29bec Z35167 0 83405 276228 275147 2026-05-19T16:25:24Z Dv103 11127 276228 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35167" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35167K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "nanpa jan lon lipu Wikinanpa" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35167K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "toki" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35168" ], "Z8K5": "Z35167" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "poki sona jan" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } n02ae8qgrue05pnqg396wuloxih78vv 276261 276228 2026-05-19T17:45:02Z Dv103 11127 Added Z35383 to the approved list of test cases 276261 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35167" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35167K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "nanpa jan lon lipu Wikinanpa" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35167K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "toki" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20", "Z35383" ], "Z8K4": [ "Z14", "Z35168" ], "Z8K5": "Z35167" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "poki sona jan" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } k1qwbga4itm5mlgttdlpqvtra6yji33 276266 276261 2026-05-19T17:58:36Z Dv103 11127 Added Z35385 to the approved list of implementations 276266 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35167" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35167K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "nanpa jan lon lipu Wikinanpa" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35167K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "toki" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20", "Z35383" ], "Z8K4": [ "Z14", "Z35168", "Z35385" ], "Z8K5": "Z35167" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "poki sona jan" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 689pq6h6lzc494d6pygk2a6fzexpx7l 276267 276266 2026-05-19T18:16:56Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276267 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35167" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35167K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "nanpa jan lon lipu Wikinanpa" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35167K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "toki" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20", "Z35383" ], "Z8K4": [ "Z14", "Z35385", "Z35168" ], "Z8K5": "Z35167" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "poki sona jan" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 0owdakkmjn2cqywj5z6h4eirpfwe5h2 276268 276267 2026-05-19T18:26:19Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276268 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35167" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35167K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "nanpa jan lon lipu Wikinanpa" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35167K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "toki" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20", "Z35383" ], "Z8K4": [ "Z14", "Z35168", "Z35385" ], "Z8K5": "Z35167" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "poki sona jan" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 689pq6h6lzc494d6pygk2a6fzexpx7l 276288 276268 2026-05-19T19:22:37Z Theki 2389 276288 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35167" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35167K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "nanpa jan lon lipu Wikinanpa" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35167K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "toki" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20", "Z35383" ], "Z8K4": [ "Z14", "Z35168", "Z35385" ], "Z8K5": "Z35167" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item" }, { "Z1K1": "Z11", "Z11K1": "Z1762", "Z11K2": "poki sona jan" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Given a Wikidata entity representing a person, create an informative infobox for them from date/place of birth, death, etc.\n\nZ35370 acts as a wrapper around this function for item references." } ] } } 81hb5k9meqorjshvbk0p7vu6fdqkqpx Z35168 0 83406 276227 275812 2026-05-19T16:24:32Z Dv103 11127 added some infos 276227 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35168" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35167", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35175", "Z35175K1": { "Z1K1": "Z7", "Z7K1": "Z35176", "Z35176K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35176K2": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35175K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35192", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P19" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P570" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P570" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35192", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P20" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P20" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P119" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P119" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person, composition" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes, en Composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } ailz215c036xnwl49v8shzly2yqc5a3 276231 276227 2026-05-19T16:31:11Z Dv103 11127 276231 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35168" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35167", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35175", "Z35175K1": { "Z1K1": "Z7", "Z7K1": "Z35176", "Z35176K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35176K2": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35175K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35192", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P19" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P570" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P570" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35192", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P20" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P20" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P119" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P119" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person, composition" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes, en Composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "When updating this, also update Z35371" } ] } } gd3i4znmz1ibjlqk4emugvce05la5ky 276315 276231 2026-05-19T22:25:25Z Theki 2389 276315 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35168" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35167", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35175", "Z35175K1": { "Z1K1": "Z7", "Z7K1": "Z35176", "Z35176K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35176K2": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35175K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35192", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P19" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P570" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P570" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35192", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P20" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P20" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } }, { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z27299K2": { "Z1K1": "Z6092", "Z6092K1": "P119" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P119" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35190K2": "Z35199", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z802K3": { "Z1K1": "Z23" } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item, composition" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "infobox pour les personnes, en Composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "When updating this, also update Z35371" } ] } } cnq53ggtha0kl4q04de7473v6clbyfg Z35171 0 83412 276373 274809 2026-05-20T02:45:00Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276373 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35171" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35171K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "langcode" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z17K2": "Z35171K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "aliases" } ] } } ], "Z8K2": "Z60", "Z8K3": [ "Z20", "Z35173" ], "Z8K4": [ "Z14", "Z35174", "Z35172" ], "Z8K5": "Z35171" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Natural language from langcode and aliases" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } jpdf2gg2wcay839oksuc2xalpdtxxyx 276374 276373 2026-05-20T02:45:04Z Theki 2389 normalize 276374 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35171" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35171K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "langcode" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z17K2": "Z35171K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "aliases" } ] } } ], "Z8K2": "Z60", "Z8K3": [ "Z20", "Z35173" ], "Z8K4": [ "Z14", "Z35172", "Z35174" ], "Z8K5": "Z35171" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "natural language from langcode and aliases" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 8w05yrbz1qn5gv4i9jpnakw0h7nxhj0 276375 276374 2026-05-20T02:45:07Z WikiLambda system 3 Updated the implementation list (see [[Help:Wikifunctions/Implementation_ordering_and_choosing|About implementation selection]]) 276375 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35171" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35171K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "langcode" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z17K2": "Z35171K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "aliases" } ] } } ], "Z8K2": "Z60", "Z8K3": [ "Z20", "Z35173" ], "Z8K4": [ "Z14", "Z35174", "Z35172" ], "Z8K5": "Z35171" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "natural language from langcode and aliases" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } pt012vp0wm4u6sixrb0hwi1mjlbd1c4 Z35188 0 83436 276205 275818 2026-05-19T15:40:26Z Dv103 11127 Added Z35361 to the approved list of test cases 276205 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35188" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35188K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35188K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property reference" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "référence de la propriété" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35188K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6003" }, "Z8K3": [ "Z20", "Z35361" ], "Z8K4": [ "Z14", "Z35189" ], "Z8K5": "Z35188" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Wikidata claim pair" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "paire de déclarations Wikidata" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Gets a claim from an entity and returns it as a pair whose first element is the label of that property and whose second element is the best statement for the property" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "récupère la déclaration d'une entité et la renvoie sous forme de paire dont le premier élément est le libellé de cette propriété et dont le second élément est la meilleure affirmation pour cette paire" } ] } } iz75ygbkxn00faymcc7gnyjza4ljet0 276224 276205 2026-05-19T16:16:28Z Dv103 11127 Added Z35369 to the approved list of implementations 276224 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35188" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35188K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35188K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property reference" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "référence de la propriété" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35188K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6003" }, "Z8K3": [ "Z20", "Z35361" ], "Z8K4": [ "Z14", "Z35189", "Z35369" ], "Z8K5": "Z35188" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Wikidata claim pair" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "paire de déclarations Wikidata" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Gets a claim from an entity and returns it as a pair whose first element is the label of that property and whose second element is the best statement for the property" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "récupère la déclaration d'une entité et la renvoie sous forme de paire dont le premier élément est le libellé de cette propriété et dont le second élément est la meilleure affirmation pour cette paire" } ] } } d2bkokelq2z2ubinr0uol6paghyqbqs 276225 276224 2026-05-19T16:16:31Z Dv103 11127 Removed Z35189 from the approved list of implementations 276225 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35188" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35188K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "entité" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35188K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property reference" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "référence de la propriété" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35188K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "langue" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6003" }, "Z8K3": [ "Z20", "Z35361" ], "Z8K4": [ "Z14", "Z35369" ], "Z8K5": "Z35188" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Wikidata claim pair" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "paire de déclarations Wikidata" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Gets a claim from an entity and returns it as a pair whose first element is the label of that property and whose second element is the best statement for the property" }, { "Z1K1": "Z11", "Z11K1": "Z1004", "Z11K2": "récupère la déclaration d'une entité et la renvoie sous forme de paire dont le premier élément est le libellé de cette propriété et dont le second élément est la meilleure affirmation pour cette paire" } ] } } hzazy3kg6mnl8mw1aez79nyg8ianvpd Talk:Z35189 1 83517 276226 275877 2026-05-19T16:19:33Z Dv103 11127 /* Why don't use Z27885? */ Reply 276226 wikitext text/x-wiki == Why don't use [[Z27885]]? == @[[User:Theki|Theki]] It is already implemented for this purpose, handling all the oddities that particular languages could have. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 18:40, 15 May 2026 (UTC) :I suppose? The goal of this function was to make the functions using {{Z|Z35175}} with Wikidata info more terse and not need to repeat lots of the same function calls over and over. The ultimate goal was to make it possible to create a "[property]: [value]" entry in an infobox just by supplying a Wikidata property reference as one of the infobox items, but this proved to be prohibitively difficult—what with only compositions being able to call other functions, and JS and Python implementations not being able to work with Wikidata stuff very flexibly at all as a result. I attempted something towards this goal in {{Z|Z35201}} but eventually gave up due to not being able to figure out how to reach the goal, and also actively being in the process of graduating. I went the route of trying to optimize the infobox thing rather haphazardly because my mind, running on three hours of sleep, was busy fixating itself on that circumstance. I apologize for the mess, I think this function does have a place though. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 20:33, 17 May 2026 (UTC) ::Now I've implemented {{Z|Z35369}}. I completely understand for your situation (I'm not the only one who edits Wikifunctions in the worst times possible, apparently...). The overall work looks neat. Good luck for your graduation! [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 16:19, 19 May 2026 (UTC) jmwbdvq6ys2edvoquq7v8sozi63igy8 276285 276226 2026-05-19T19:21:28Z Theki 2389 /* Why don't use Z27885? */ re 276285 wikitext text/x-wiki == Why don't use [[Z27885]]? == @[[User:Theki|Theki]] It is already implemented for this purpose, handling all the oddities that particular languages could have. [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 18:40, 15 May 2026 (UTC) :I suppose? The goal of this function was to make the functions using {{Z|Z35175}} with Wikidata info more terse and not need to repeat lots of the same function calls over and over. The ultimate goal was to make it possible to create a "[property]: [value]" entry in an infobox just by supplying a Wikidata property reference as one of the infobox items, but this proved to be prohibitively difficult—what with only compositions being able to call other functions, and JS and Python implementations not being able to work with Wikidata stuff very flexibly at all as a result. I attempted something towards this goal in {{Z|Z35201}} but eventually gave up due to not being able to figure out how to reach the goal, and also actively being in the process of graduating. I went the route of trying to optimize the infobox thing rather haphazardly because my mind, running on three hours of sleep, was busy fixating itself on that circumstance. I apologize for the mess, I think this function does have a place though. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 20:33, 17 May 2026 (UTC) ::Now I've implemented {{Z|Z35369}}. I completely understand for your situation (I'm not the only one who edits Wikifunctions in the worst times possible, apparently...). The overall work looks neat. Good luck for your graduation! [[User:Dv103|Dv103]] ([[User talk:Dv103|talk]]) 16:19, 19 May 2026 (UTC) :::Hi, thank you very much for the additional work you have done on this! Many thanks for the well wishes also :). I think I may dedicate time to writing some of this down, as there will certainly be more than one infobox type, and the generalization won't pay off unless it's documented—it's also just easier to keep track of what we're doing if that gets done anyways. Tomorrow is my one break in the week before all the big stuff happens so I'll see if I can document this when I have the time by then. I wrote a sort of dependency hierarchy on [[User:Theki/functions#infoboxes|my personal function catalog]]. At any rate, on your part, selectively fetching only the parts of Wikidata entities that we need (something that I somehow didn't consider) seems to put the infobox function's execution time within something that the orchestrator considers reasonable—plus putting the needed properties into their own Object and creating {{Z|Z35374}} was a good call, even if the former doesn't seem to be working presently. Thank you again. &mdash; [[User:Theki|rae<sup>5e</sup>]] &lt;[[User talk:Theki|talk]]&gt; 19:21, 19 May 2026 (UTC) 0blr2ilm6l5h6asmluchyvgi5wdvnyl Category:Parameterised types 14 83679 276567 275633 2026-05-20T07:07:18Z YoshiRulz 10156 Add to category 276567 wikitext text/x-wiki [[Category:Functions]] [[Category:Types]] e1b2i9j7nxtrbchijx545umjg6gpazj Z35352 0 83804 276284 276181 2026-05-19T19:21:11Z Jsamwrites 938 Added Z35357 to the approved list of test cases 276284 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35352" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35352K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "phrase" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35354", "Z35355", "Z35356", "Z35357" ], "Z8K4": [ "Z14", "Z35353" ], "Z8K5": "Z35352" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "get basic English phrase category" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } cqtozbxf3ruchzgls6qkpfrptckoomg Z35360 0 83812 276192 2026-05-19T13:10:54Z Dv103 11127 276192 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35360" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z28079", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z22504", "Z22504K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z28086", "Z28086K1": { "Z1K1": "Z7", "Z7K1": "Z28089", "Z28089K1": { "Z1K1": "Z7", "Z7K1": "Z27327", "Z27327K1": { "Z1K1": "Z18", "Z18K1": "Z28079K1" }, "Z27327K2": { "Z1K1": "Z6092", "Z6092K1": "P5137" }, "Z27327K3": "Z1430" } }, "Z28086K2": "der", "Z28086K3": "die", "Z28086K4": "das" }, { "Z1K1": "Z7", "Z7K1": "Z27410", "Z27410K1": { "Z1K1": "Z7", "Z7K1": "Z27327", "Z27327K1": { "Z1K1": "Z18", "Z18K1": "Z28079K1" }, "Z27327K2": { "Z1K1": "Z6092", "Z6092K1": "P5137" }, "Z27327K3": "Z1430" }, "Z27410K2": [ "Z6091", { "Z1K1": "Z6091", "Z6091K1": "Q110786" }, { "Z1K1": "Z6091", "Z6091K1": "Q131105" } ] } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "German nom def article + noun, best lex and forms" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 2kewakgkr1q1zhwnvmwbslxtuvcdlvy Z35361 0 83813 276204 2026-05-19T15:40:16Z Dv103 11127 276204 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35361" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35188", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q307" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P19" } ] }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P19" }, "Z35188K3": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z19586", "Z19586K2": { "Z1K1": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6003" }, "K1": "Luogo di nascita", "K2": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q307" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P19" } ] }, "Z23451K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "luogo di nascita, Galileo Galilei" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 10elypkuze8uuc4qrlsmuj7zzjeqfcr Z35362 0 83814 276206 2026-05-19T15:42:48Z Dv103 11127 276206 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35362" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35362K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35362K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35362" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "nome per titolo di tabella da proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "name for table header from property" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Come Z27885, ma partendo da una proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Like Z27885, but from a property" } ] } } 9i46i9z5yw2nw1erro7okbavhbfata7 276208 276206 2026-05-19T15:43:33Z Dv103 11127 Added Z35363 to the approved list of test cases 276208 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35362" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35362K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35362K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z35363" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35362" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "nome per titolo di tabella da proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "name for table header from property" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Come Z27885, ma partendo da una proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Like Z27885, but from a property" } ] } } l2y97ja9ommlz7dkbx49vppl268r5qw 276222 276208 2026-05-19T16:12:07Z Dv103 11127 Added Z35368 to the approved list of implementations 276222 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35362" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35362K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35362K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20", "Z35363" ], "Z8K4": [ "Z14", "Z35368" ], "Z8K5": "Z35362" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "nome per titolo di tabella da proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "name for table header from property" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Come Z27885, ma partendo da una proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Like Z27885, but from a property" } ] } } c4xv77csgx132vwoey2emt81qsyjuf1 Z35363 0 83815 276207 2026-05-19T15:43:23Z Dv103 11127 276207 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35363" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35362", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35362", "Z35362K1": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35362K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "Data di nascita" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "[it] Data di nascita" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } c6q45eyvz0ah1mpfcachz6a3zr6da5e Z35364 0 83816 276211 2026-05-19T15:52:28Z Dv103 11127 276211 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35364" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6002", "Z17K2": "Z35364K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } } ], "Z8K2": "Z6091", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35364" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "elemento oggetto della proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Wikidata item of property" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 4rwq0c3940sa5anz82gg0uhohga061y 276213 276211 2026-05-19T15:53:41Z Dv103 11127 Added Z35365 to the approved list of test cases 276213 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35364" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6002", "Z17K2": "Z35364K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } } ], "Z8K2": "Z6091", "Z8K3": [ "Z20", "Z35365" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35364" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "elemento oggetto della proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Wikidata item of property" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } o0cqk4qaae5uhc2oiz69rhnctzhawhs 276219 276213 2026-05-19T16:06:56Z Dv103 11127 Added Z35367 to the approved list of implementations 276219 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35364" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6002", "Z17K2": "Z35364K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } } ], "Z8K2": "Z6091", "Z8K3": [ "Z20", "Z35365" ], "Z8K4": [ "Z14", "Z35367" ], "Z8K5": "Z35364" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "elemento oggetto della proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Wikidata item of property" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } rg39jgr95vmfnuge6ycn1c1f2ijv38e Z35365 0 83817 276212 2026-05-19T15:53:31Z Dv103 11127 276212 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35365" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35364", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35364", "Z35364K1": { "Z1K1": "Z7", "Z7K1": "Z6822", "Z6822K1": { "Z1K1": "Z6092", "Z6092K1": "P569" } } }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z19316", "Z19316K2": { "Z1K1": "Z6091", "Z6091K1": "Q2389905" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "data di nascita: P569 -\u003E Q2389905" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } nyafm96row6wv84ima321k3xx4j8lds Z35366 0 83818 276216 2026-05-19T16:02:38Z Dv103 11127 276216 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35366" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35103", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z28548", "Z28548K1": { "Z1K1": "Z7", "Z7K1": "Z23229", "Z23229K1": { "Z1K1": "Z18", "Z18K1": "Z35103K1" } }, "Z28548K2": [ "Z6092", { "Z1K1": "Z18", "Z18K1": "Z35103K2" } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "get statements for Wikidata property, comp." } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 8s7dmg4xpd7vw272sur1uaszosv18ft Z35367 0 83819 276218 2026-05-19T16:06:46Z Dv103 11127 276218 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35367" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35364", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z19308", "Z19308K1": { "Z1K1": "Z7", "Z7K1": "Z811", "Z811K1": { "Z1K1": "Z7", "Z7K1": "Z29688", "Z29688K1": { "Z1K1": "Z7", "Z7K1": "Z35103", "Z35103K1": { "Z1K1": "Z18", "Z18K1": "Z35364K1" }, "Z35103K2": { "Z1K1": "Z6092", "Z6092K1": "P1629" } } } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "elemento oggetto della proprietà, comp." } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 1eu88gbtc0f298ptly6o2mibqzxung0 Z35368 0 83820 276221 2026-05-19T16:11:55Z Dv103 11127 276221 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35368" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35362", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z27885", "Z27885K1": { "Z1K1": "Z7", "Z7K1": "Z35364", "Z35364K1": { "Z1K1": "Z7", "Z7K1": "Z35036", "Z35036K1": { "Z1K1": "Z18", "Z18K1": "Z35362K1" }, "Z35036K2": [ "Z6030", "Z6036" ], "Z35036K3": [ "Z60" ], "Z35036K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P1629" } ] } }, "Z27885K2": { "Z1K1": "Z18", "Z18K1": "Z35362K2" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "nome per titolo di tabella da proprietà, comp." } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } p51jp35l8hereh0fxn6xokk6gbs3i54 Z35369 0 83821 276223 2026-05-19T16:15:49Z Dv103 11127 276223 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35369" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35188", "Z14K2": { "Z1K1": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6003" }, "K1": { "Z1K1": "Z7", "Z7K1": "Z35362", "Z35362K1": { "Z1K1": "Z18", "Z18K1": "Z35188K2" }, "Z35362K2": { "Z1K1": "Z18", "Z18K1": "Z35188K3" } }, "K2": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z18", "Z18K1": "Z35188K1" }, "Z23451K2": { "Z1K1": "Z18", "Z18K1": "Z35188K2" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Wikidata claim pair, with name for table header" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } hrgcymzxocq9hygex3v4ygf3ky7yx1w Z35370 0 83822 276229 2026-05-19T16:26:41Z Dv103 11127 276229 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35370" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z35370K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "persona" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "person" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35370K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35370" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "infobox per persona" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 3pexbwe5jpvkju2utnepff3gubmbg07 276234 276229 2026-05-19T16:35:16Z Dv103 11127 Added Z35372 to the approved list of implementations 276234 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35370" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z35370K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "persona" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "person" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35370K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35372" ], "Z8K5": "Z35370" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "infobox per persona" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } jsowq2eh9raotim2853wsvwu2bpmtf9 276236 276234 2026-05-19T16:41:22Z Dv103 11127 Added Z35373 to the approved list of test cases 276236 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35370" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6091", "Z17K2": "Z35370K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "persona" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "person" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35370K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z89", "Z8K3": [ "Z20", "Z35373" ], "Z8K4": [ "Z14", "Z35372" ], "Z8K5": "Z35370" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "infobox per persona" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } q68ctj3dg5no9buf9uugdhtbbzl3l4f Z35371 0 83823 276230 2026-05-19T16:29:08Z Dv103 11127 276230 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35371" }, "Z2K2": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P569" }, { "Z1K1": "Z6092", "Z6092K1": "P19" }, { "Z1K1": "Z6092", "Z6092K1": "P570" }, { "Z1K1": "Z6092", "Z6092K1": "P20" }, { "Z1K1": "Z6092", "Z6092K1": "P119" } ], "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà richieste per infobox per persona" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "required properties for person infobox" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 2iku60iz66sue1um112tfmh0mhy3e2x Z35372 0 83824 276232 2026-05-19T16:34:53Z Dv103 11127 276232 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35372" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35370", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35167", "Z35167K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z18", "Z18K1": "Z35370K1" }, "Z30120K2": [ "Z6030", "Z6033", "Z6036" ], "Z30120K3": { "Z1K1": "Z7", "Z7K1": "Z24144", "Z24144K1": { "Z1K1": "Z18", "Z18K1": "Z35370K2" }, "Z24144K2": { "Z1K1": "Z40", "Z40K1": "Z41" }, "Z24144K3": { "Z1K1": "Z40", "Z40K1": "Z41" } }, "Z30120K4": { "Z1K1": "Z7", "Z7K1": "Z12767", "Z12767K1": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P1559" } ], "Z12767K2": "Z35371" } }, "Z35167K2": { "Z1K1": "Z18", "Z18K1": "Z35370K2" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } d83fkwr5qx3vxmgvxk9iifgjg5olsc5 276233 276232 2026-05-19T16:35:06Z Dv103 11127 +it 276233 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35372" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35370", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35167", "Z35167K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z18", "Z18K1": "Z35370K1" }, "Z30120K2": [ "Z6030", "Z6033", "Z6036" ], "Z30120K3": { "Z1K1": "Z7", "Z7K1": "Z24144", "Z24144K1": { "Z1K1": "Z18", "Z18K1": "Z35370K2" }, "Z24144K2": { "Z1K1": "Z40", "Z40K1": "Z41" }, "Z24144K3": { "Z1K1": "Z40", "Z40K1": "Z41" } }, "Z30120K4": { "Z1K1": "Z7", "Z7K1": "Z12767", "Z12767K1": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P1559" } ], "Z12767K2": "Z35371" } }, "Z35167K2": { "Z1K1": "Z18", "Z18K1": "Z35370K2" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "infobox per persona, comp." } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } po93boy0hl9k4mj9g85oyqqwgdi6609 276316 276233 2026-05-19T22:25:29Z Theki 2389 276316 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35372" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35370", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35167", "Z35167K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z18", "Z18K1": "Z35370K1" }, "Z30120K2": [ "Z6030", "Z6033", "Z6036" ], "Z30120K3": { "Z1K1": "Z7", "Z7K1": "Z24144", "Z24144K1": { "Z1K1": "Z18", "Z18K1": "Z35370K2" }, "Z24144K2": { "Z1K1": "Z40", "Z40K1": "Z41" }, "Z24144K3": { "Z1K1": "Z40", "Z40K1": "Z41" } }, "Z30120K4": { "Z1K1": "Z7", "Z7K1": "Z12767", "Z12767K1": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P1559" } ], "Z12767K2": "Z35371" } }, "Z35167K2": { "Z1K1": "Z18", "Z18K1": "Z35370K2" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "infobox per persona, comp." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } lclqsrg12paydzvv5rv98tvwbznqcah Z35373 0 83825 276235 2026-05-19T16:41:12Z Dv103 11127 276235 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35373" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35370", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35370", "Z35370K1": { "Z1K1": "Z6091", "Z6091K1": "Q17302115" }, "Z35370K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z23356", "Z23356K2": "Z27854", "Z23356K3": "\u003Ctable", "Z23356K4": "Z10615" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "infobox per Sio non è vuoto" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 1mmmisejckc8xu0nmohyi5bqyy9vse2 Z35374 0 83826 276237 2026-05-19T16:48:30Z Dv103 11127 276237 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35374" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35374K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "entità" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35374K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35374K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35374" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "riga di infobox" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox row" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } gg9sw3utogooh9gh3zywtomq0e14v0s 276239 276237 2026-05-19T16:52:08Z Dv103 11127 Added Z35375 to the approved list of test cases 276239 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35374" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35374K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "entità" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35374K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35374K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z1" }, "Z8K3": [ "Z20", "Z35375" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35374" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "riga di infobox" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox row" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } nv0uusrsvoghp3lvqdp3d4lwvgjauxi 276256 276239 2026-05-19T17:18:34Z Dv103 11127 Added Z35377 to the approved list of implementations 276256 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35374" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35374K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "entità" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35374K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35374K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z1" }, "Z8K3": [ "Z20", "Z35375" ], "Z8K4": [ "Z14", "Z35377" ], "Z8K5": "Z35374" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "riga di infobox" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox row" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } pd6bzmeaw0u01snos9y5f9hs0i4si2z 276273 276256 2026-05-19T18:59:46Z Theki 2389 276273 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35374" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6001", "Z17K2": "Z35374K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "entità" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "entity" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6092", "Z17K2": "Z35374K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "proprietà" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "property" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35374K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z1" }, "Z8K3": [ "Z20", "Z35375" ], "Z8K4": [ "Z14", "Z35377" ], "Z8K5": "Z35374" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "riga di infobox" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox row from Wikidata property" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Given an entity and property reference that it contains as a statement, returns a typed pair suitable for rendering in the HTML-based infobox template function" } ] } } oh4xzcpz7q04mxfjr2ihm971kcxg7rz Z35375 0 83827 276238 2026-05-19T16:51:57Z Dv103 11127 276238 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35375" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35374", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q76" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P569" } ] }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35374K3": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z19586", "Z19586K2": { "Z1K1": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z1", "Z882K2": "Z1" }, "K1": "Data di nascita", "K2": "8 ottobre 1988" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Sio, it -\u003E (Data di nascita, 8 ottobre 1988)" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 2oqmwpaoldri975bg7itbuh2g8gq45o 276254 276238 2026-05-19T17:17:48Z Dv103 11127 276254 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35375" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35374", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q76" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P569" } ] }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35374K3": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z19586", "Z19586K2": { "Z1K1": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z1", "Z882K2": "Z1" }, "K1": "Data di nascita", "K2": "8 ottobre 1988" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Obama, it -\u003E (Data di nascita, 4 agosto 1961)" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } csmw4jdd34fhi5qntx4gjz5twig35ur 276255 276254 2026-05-19T17:18:15Z Dv103 11127 276255 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35375" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35374", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q76" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P569" } ] }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35374K3": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z19586", "Z19586K2": { "Z1K1": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z1", "Z882K2": "Z1" }, "K1": "Data di nascita", "K2": "4 agosto 1961" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Obama, it -\u003E (Data di nascita, 4 agosto 1961)" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 85mtv4b7y8hv3p4o2uvcnnp9q1tr2a5 276275 276255 2026-05-19T19:04:50Z Theki 2389 276275 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35375" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35374", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q76" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P569" } ] }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35374K3": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z19586", "Z19586K2": { "Z1K1": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z1", "Z882K2": "Z1" }, "K1": "Data di nascita", "K2": "4 agosto 1961" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "Obama, it -\u003E (Data di nascita, 4 agosto 1961)" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "[it] Obama -\u003E (Data di nascita, 4 agosto 1961)" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } dbxxuz6u4vmnfsfvm0nxpzmrovl0qml Z35376 0 83828 276240 2026-05-19T16:54:43Z Dv103 11127 276240 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } enxnau20jct1mcg983qy2jl5afsmvrt 276242 276240 2026-05-19T16:56:39Z Dv103 11127 276242 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35376K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } p4pugc50uoxfk0v8duwspdn8n02jpw8 276244 276242 2026-05-19T17:00:27Z Dv103 11127 Added Z35378 to the approved list of test cases 276244 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35376K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35378" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } dv0ch9wgxwqsx1l0dfbsjext6x3seb1 276246 276244 2026-05-19T17:02:43Z Dv103 11127 Added Z35379 to the approved list of test cases 276246 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35376K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35378", "Z35379" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } rdpm12dp0o3slt5es1i3cspgv5hr3ld 276250 276246 2026-05-19T17:12:07Z Dv103 11127 Added Z35380 to the approved list of implementations 276250 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35376K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35378", "Z35379" ], "Z8K4": [ "Z14", "Z35380" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 75i1g5wx77uvvoiazb8ulz1koclnk7i 276258 276250 2026-05-19T17:33:57Z Dv103 11127 Added Z35381 to the approved list of test cases 276258 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35376K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35378", "Z35379", "Z35381" ], "Z8K4": [ "Z14", "Z35380" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } h5qj9q3zwx1e32y1tpo9svrs5a5as2s 276263 276258 2026-05-19T17:54:06Z Dv103 11127 Added Z35384 to the approved list of implementations 276263 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35376K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35378", "Z35379", "Z35381" ], "Z8K4": [ "Z14", "Z35380", "Z35384" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 5x0mt9q32mujgq81n0okkbas12yvr1c 276264 276263 2026-05-19T17:54:09Z Dv103 11127 Removed Z35380 from the approved list of implementations 276264 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35376" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35376K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "oggetto" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z60", "Z17K2": "Z35376K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "lingua" }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "language" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35378", "Z35379", "Z35381" ], "Z8K4": [ "Z14", "Z35384" ], "Z8K5": "Z35376" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia di aff." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process second element of Wikidata claim pair" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31", { "Z1K1": "Z31", "Z31K1": "Z1787", "Z31K2": [ "Z6", "post-processa secondo elemento di coppia di affermazione" ] } ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } a13cqlpapp7t6px0rexgc3qvkb7pxrk Z35377 0 83829 276241 2026-05-19T16:54:56Z Dv103 11127 276241 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35377" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35374", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35374K1" }, "Z27299K2": { "Z1K1": "Z18", "Z18K1": "Z35374K2" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35374K1" }, "Z35188K2": { "Z1K1": "Z18", "Z18K1": "Z35374K2" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35374K3" } }, "Z35190K2": "Z35376", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35374K3" } }, "Z802K3": { "Z1K1": "Z23" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } nri2qwc231ij3czxvn2myov74xya9z0 276253 276241 2026-05-19T17:15:25Z Dv103 11127 276253 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35377" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35374", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35374K1" }, "Z27299K2": { "Z1K1": "Z18", "Z18K1": "Z35374K2" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35374K1" }, "Z35188K2": { "Z1K1": "Z18", "Z18K1": "Z35374K2" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35374K3" } }, "Z35190K2": "Z35376", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35374K3" } }, "Z802K3": { "Z1K1": "Z23" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "riga di infobox, comp." } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 95qvpr2fpq1p4zqzk1wfmfg4agb0jdn 276277 276253 2026-05-19T19:05:03Z Theki 2389 276277 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35377" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35374", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z27299", "Z27299K1": { "Z1K1": "Z18", "Z18K1": "Z35374K1" }, "Z27299K2": { "Z1K1": "Z18", "Z18K1": "Z35374K2" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35190", "Z35190K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z18", "Z18K1": "Z35374K1" }, "Z35188K2": { "Z1K1": "Z18", "Z18K1": "Z35374K2" }, "Z35188K3": { "Z1K1": "Z18", "Z18K1": "Z35374K3" } }, "Z35190K2": "Z35376", "Z35190K3": { "Z1K1": "Z18", "Z18K1": "Z35374K3" } }, "Z802K3": { "Z1K1": "Z23" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "riga di infobox, comp." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox row from Wikidata property, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 3lhn4zaowswaxw70axoflmmqk8ee5z5 Z35378 0 83830 276243 2026-05-19T17:00:11Z Dv103 11127 276243 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35378" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35376", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35376", "Z35376K1": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z7", "Z7K1": "Z6821", "Z6821K1": { "Z1K1": "Z6091", "Z6091K1": "Q762" } }, "Z23451K2": { "Z1K1": "Z6092", "Z6092K1": "P569" } }, "Z35376K2": "Z1002" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "1 January 1452" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process Leonardo da Vinci date of birth" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } jeo3iqqq2re51q7eqiijub0rgpjjql3 276248 276243 2026-05-19T17:11:18Z Dv103 11127 276248 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35378" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35376", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35376", "Z35376K1": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q762" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P569" } ] }, "Z23451K2": { "Z1K1": "Z6092", "Z6092K1": "P569" } }, "Z35376K2": "Z1002" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "1 January 1452" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process Leonardo da Vinci date of birth" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 7v5dvqt8hvfkpm2v4wwdo6fsi7xe8s2 Z35379 0 83831 276245 2026-05-19T17:02:32Z Dv103 11127 276245 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35379" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35376", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35376", "Z35376K1": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z7", "Z7K1": "Z6821", "Z6821K1": { "Z1K1": "Z6091", "Z6091K1": "Q3485099" } }, "Z23451K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } }, "Z35376K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z877", "Z877K2": { "Z1K1": "Z89", "Z89K1": "\u003Ca href=\"https://abstract.wikipedia.org/wiki/Q2028\"\u003EVerona\u003C/a\u003E" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa luogo di nascita di Sio" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } syt4qrxs8v57kgfjnrr15ul0gibm0xj 276247 276245 2026-05-19T17:10:16Z Dv103 11127 276247 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35379" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35376", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35376", "Z35376K1": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z7", "Z7K1": "Z6821", "Z6821K1": { "Z1K1": "Z6091", "Z6091K1": "Q17302115" } }, "Z23451K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } }, "Z35376K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z877", "Z877K2": { "Z1K1": "Z89", "Z89K1": "\u003Ca href=\"https://abstract.wikipedia.org/wiki/Q2028\"\u003EVerona\u003C/a\u003E" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa luogo di nascita di Sio" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 95wbi95r8zz9moyh3evs1adjotxkt5o 276251 276247 2026-05-19T17:13:48Z Dv103 11127 276251 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35379" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35376", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35376", "Z35376K1": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q17302115" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P19" } ] }, "Z23451K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } }, "Z35376K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z877", "Z877K2": { "Z1K1": "Z89", "Z89K1": "\u003Ca href=\"https://abstract.wikipedia.org/wiki/Q2028\"\u003EVerona\u003C/a\u003E" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa luogo di nascita di Sio" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } phmwjagmj1pa3tycrniqeyq0n7ta9ce 276252 276251 2026-05-19T17:14:37Z Dv103 11127 276252 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35379" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35376", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35376", "Z35376K1": { "Z1K1": "Z7", "Z7K1": "Z23451", "Z23451K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q17302115" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P19" } ] }, "Z23451K2": { "Z1K1": "Z6092", "Z6092K1": "P19" } }, "Z35376K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z877", "Z877K2": { "Z1K1": "Z7", "Z7K1": "Z32428", "Z32428K1": { "Z1K1": "Z6091", "Z6091K1": "Q2028" }, "Z32428K2": "Z1787" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa luogo di nascita di Sio" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } dsj3lfcci1y5b7zi54ft4ghaz3takx1 Z35380 0 83832 276249 2026-05-19T17:11:56Z Dv103 11127 276249 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35380" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35376", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } }, "Z19084K2": "Z6003" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z7", "Z7K1": "Z19308", "Z19308K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } } }, "Z19084K2": "Z6064" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35192", "Z35192K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" }, "Z35192K2": { "Z1K1": "Z18", "Z18K1": "Z35376K2" } }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z7", "Z7K1": "Z19308", "Z19308K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } } }, "Z19084K2": "Z6091" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35199", "Z35199K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" }, "Z35199K2": { "Z1K1": "Z18", "Z18K1": "Z35376K2" } }, "Z802K3": "Z24" } }, "Z802K3": "Z24" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia, comp." } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } hdvuvw3c8xu5kwbbzxw7alnukz34d4g 276279 276249 2026-05-19T19:05:43Z Theki 2389 276279 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35380" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35376", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } }, "Z19084K2": "Z6003" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z7", "Z7K1": "Z19308", "Z19308K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } } }, "Z19084K2": "Z6064" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35192", "Z35192K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" }, "Z35192K2": { "Z1K1": "Z18", "Z18K1": "Z35376K2" } }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z7", "Z7K1": "Z19308", "Z19308K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } } }, "Z19084K2": "Z6091" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35199", "Z35199K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" }, "Z35199K2": { "Z1K1": "Z18", "Z18K1": "Z35376K2" } }, "Z802K3": "Z24" } }, "Z802K3": "Z24" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento di coppia, comp." }, { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "post-process 2nd el. of Wikidata claim pair, comp" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } hegdh8fq460zlt94xde1mu14sd1d5m6 Z35381 0 83833 276257 2026-05-19T17:33:44Z Dv103 11127 276257 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35381" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35376", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35376", "Z35376K1": { "Z1K1": "Z7", "Z7K1": "Z822", "Z822K1": { "Z1K1": "Z7", "Z7K1": "Z35188", "Z35188K1": { "Z1K1": "Z7", "Z7K1": "Z30120", "Z30120K1": { "Z1K1": "Z6091", "Z6091K1": "Q17302115" }, "Z30120K2": [ "Z6030", "Z6036" ], "Z30120K3": [ "Z60" ], "Z30120K4": [ "Z6092", { "Z1K1": "Z6092", "Z6092K1": "P569" } ] }, "Z35188K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35188K3": "Z1787" } }, "Z35376K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "8 ottobre 1988" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa data di nascita di Sio" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 6ro08qruj6vp1blgkirr7etip3eaux9 Z35382 0 83834 276259 2026-05-19T17:42:07Z Dv103 11127 276259 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35382" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35167", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35175", "Z35175K1": { "Z1K1": "Z7", "Z7K1": "Z35176", "Z35176K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35176K2": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35175K2": { "Z1K1": "Z7", "Z7K1": "Z801", "Z801K1": { "Z1K1": "Z7", "Z7K1": "Z31262", "Z31262K1": "Z35374", "Z31262K2": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z31262K3": "Z35371", "Z31262K4": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item, automatic comp." } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 74c51dvaeb8g30fsxl4v6aeq8tu5eb1 Z35383 0 83835 276260 2026-05-19T17:44:50Z Dv103 11127 276260 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35383" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35167", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35167", "Z35167K1": { "Z1K1": "Z7", "Z7K1": "Z6821", "Z6821K1": { "Z1K1": "Z6091", "Z6091K1": "Q273073" } }, "Z35167K2": "Z1787" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z23356", "Z23356K2": "Z27854", "Z23356K3": "1 ottobre 1954", "Z23356K4": "Z10070" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "infobox per Milly Carlucci contiene data di nascit" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } a920o9nftolb5pmgwk8ydhkmjc67gok Z35384 0 83836 276262 2026-05-19T17:53:54Z Dv103 11127 276262 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35384" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35376", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z7", "Z7K1": "Z19308", "Z19308K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } } }, "Z19084K2": "Z6064" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35192", "Z35192K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" }, "Z35192K2": { "Z1K1": "Z18", "Z18K1": "Z35376K2" } }, "Z802K3": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z19084", "Z19084K1": { "Z1K1": "Z7", "Z7K1": "Z16829", "Z16829K1": { "Z1K1": "Z7", "Z7K1": "Z19308", "Z19308K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" } } }, "Z19084K2": "Z6091" }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z35199", "Z35199K1": { "Z1K1": "Z18", "Z18K1": "Z35376K1" }, "Z35199K2": { "Z1K1": "Z18", "Z18K1": "Z35376K2" } }, "Z802K3": "Z24" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "post-processa secondo elemento, senza type check" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 8nifj9un95lp8rg7url3tnowptl1xeo Z35385 0 83837 276265 2026-05-19T17:58:22Z Dv103 11127 276265 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35385" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35167", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35175", "Z35175K1": { "Z1K1": "Z7", "Z7K1": "Z35176", "Z35176K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35176K2": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, "Z35175K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P569" }, "Z35374K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P19" }, "Z35374K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P570" }, "Z35374K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P20" }, "Z35374K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } }, { "Z1K1": "Z7", "Z7K1": "Z35374", "Z35374K1": { "Z1K1": "Z18", "Z18K1": "Z35167K1" }, "Z35374K2": { "Z1K1": "Z6092", "Z6092K1": "P119" }, "Z35374K3": { "Z1K1": "Z18", "Z18K1": "Z35167K2" } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "infobox for person as item, manual list" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Keep synchronized with Z35371" } ] } } mrl4ueirzjuzo3h8e7ryf926yppbhdi Z35386 0 83838 276271 2026-05-19T18:55:24Z Theki 2389 276271 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35386" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z27885", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z27885", "Z27885K1": { "Z1K1": "Z6091", "Z6091K1": "Q1075" }, "Z27885K2": "Z1762" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z866", "Z866K2": "kule" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "[tok] color = \"kule\" (do not capitalize)" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } kih8g0lutqtqowcf47wkgm8ybd98c6l Z35387 0 83839 276280 2026-05-19T19:07:48Z Dv103 11127 276280 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35387" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z30484", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z26107", "Z26107K1": "Z1430", "Z26107K2": { "Z1K1": "Z7", "Z7K1": "Z22511", "Z22511K1": { "Z1K1": "Z7", "Z7K1": "Z22504", "Z22504K1": [ "Z6" ] } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1787", "Z11K2": "state location using entity and class,de,improved" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } gj7mps1d04arkxj2komm6nlp7ha7z5y Translations:Wikifunctions:What Wikifunctions is not/4/sv 1198 83840 276289 2026-05-19T19:22:55Z Tommy Kronkvist 1985 Created page with "== Wikifunctions är inte en encyklopedi över algoritmer ==" 276289 wikitext text/x-wiki == Wikifunctions är inte en encyklopedi över algoritmer == a3wr53860o8nh1riv8cf168xoj8txt2 Z35388 0 83841 276295 2026-05-19T21:36:51Z JJPMaster 6409 276295 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35388" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17" ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35388" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "quine" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "A quine, meaning a program that returns its own source code." } ] } } 9mds5jg6ss57rpuarrs45zuxn3d2r36 276297 276295 2026-05-19T21:40:58Z JJPMaster 6409 Added Z35389 to the approved list of implementations 276297 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35388" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17" ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35389" ], "Z8K5": "Z35388" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "quine" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "A quine, meaning a program that returns its own source code." } ] } } 850290tvvfw460abeaspfotfu1p04v4 Z35389 0 83842 276296 2026-05-19T21:40:53Z JJPMaster 6409 276296 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35389" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35388", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35388(){return Z35388.toString()}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "quine, js" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } m4vy4zcslzxdmfdki4tglhtb8bjazb2 Z35390 0 83843 276298 2026-05-19T21:52:37Z JJPMaster 6409 first in a series of new ASL functions 276298 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35390" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35390K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "structural marker" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35390" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW structural marker to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a structural marker in Formal SignWriting (e.g., M) to its associated Unicode symbol (e.g., 𝠃)." } ] } } bogng6yy241oakgjc2akhgz5bu4ghd6 276300 276298 2026-05-19T21:58:34Z JJPMaster 6409 Added Z35391 to the approved list of implementations 276300 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35390" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35390K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "structural marker" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35391" ], "Z8K5": "Z35390" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW structural marker to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a structural marker in Formal SignWriting (e.g., M) to its associated Unicode symbol (e.g., 𝠃)." } ] } } dkr0cp6b3g2lu11c6i1jmno8nn1qcam Z35391 0 83844 276299 2026-05-19T21:58:28Z JJPMaster 6409 276299 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35391" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35390", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35390( Z35390K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/convert/index.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\treturn { 'A': '𝠀', 'B': '𝠁', 'L': '𝠂', 'M': '𝠃', 'R': '𝠄' }[Z35390K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW structural marker to SWU, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Adapted from https://github.com/sutton-signwriting/core/blob/master/src/convert/index.js, released under the terms of the MIT License." } ] } } 2tsyygwcowoyqt4tio6h1bd6kevopw0 Z35392 0 83845 276301 2026-05-19T22:01:29Z JJPMaster 6409 276301 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35392" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35392K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z16683" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35392" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW coordinate string to integer list" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a Formal SignWriting coordinate string to a list of integers." } ] } } hzv8bhmfbn1h1gxsw3118c28eka2zt8 276303 276301 2026-05-19T22:02:33Z JJPMaster 6409 Added Z35393 to the approved list of implementations 276303 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35392" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35392K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z16683" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35393" ], "Z8K5": "Z35392" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW coordinate string to integer list" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a Formal SignWriting coordinate string to a list of integers." } ] } } 5a730piu3zlael2w6j71h5i9kdyzu9t 276306 276303 2026-05-19T22:04:04Z JJPMaster 6409 Added Z35394 to the approved list of test cases 276306 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35392" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35392K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z16683" }, "Z8K3": [ "Z20", "Z35394" ], "Z8K4": [ "Z14", "Z35393" ], "Z8K5": "Z35392" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW coordinate string to integer list" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a Formal SignWriting coordinate string to a list of integers." } ] } } siq2m1ms50mcyc25qjv5lmoyo0b27bl Z35393 0 83846 276302 2026-05-19T22:02:28Z JJPMaster 6409 276302 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35393" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35392", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35392( Z35392K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/convert/index.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\treturn Z35392K1.split('x').map(num =\u003E parseInt(num));\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW coordinate string to integer list, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } iuiirogacox4gqbig7pwtxroncqvxr8 Z35394 0 83847 276304 2026-05-19T22:03:23Z JJPMaster 6409 276304 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35394" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35392", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": "30x21" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z889", "Z889K2": [ "Z16683", { "Z1K1": "Z16683", "Z16683K1": "Z16660", "Z16683K2": { "Z1K1": "Z13518", "Z13518K1": "21" } } ], "Z889K3": "Z16688" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "\"30x21\" → [30, 21]" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } dizgz1j4simsg3v1edcbt4nzjgoac15 276305 276304 2026-05-19T22:03:55Z JJPMaster 6409 huh? 276305 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35394" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35392", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": "30x21" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z889", "Z889K2": [ "Z16683", { "Z1K1": "Z16683", "Z16683K1": "Z16660", "Z16683K2": { "Z1K1": "Z13518", "Z13518K1": "30" } }, { "Z1K1": "Z16683", "Z16683K1": "Z16660", "Z16683K2": { "Z1K1": "Z13518", "Z13518K1": "21" } } ], "Z889K3": "Z16688" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "\"30x21\" → [30, 21]" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } dh9tetav8amce1vue12vpofen1nj86j Z35395 0 83848 276307 2026-05-19T22:06:10Z JJPMaster 6409 276307 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35395" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35395K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "symbol key" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35395" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW symbol key to SWU symbol character" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a symbol key in Formal SignWriting to a symbol character in SignWriting in Unicode." } ] } } cpvvbcs7c34wcamsxvr08vnfiydhp2g 276309 276307 2026-05-19T22:07:42Z JJPMaster 6409 Added Z35396 to the approved list of implementations 276309 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35395" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35395K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "symbol key" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35396" ], "Z8K5": "Z35395" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW symbol key to SWU symbol character" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a symbol key in Formal SignWriting to a symbol character in SignWriting in Unicode." } ] } } s2el6969xpesvssszacleuoyr0tyr8o Z35396 0 83849 276308 2026-05-19T22:07:36Z JJPMaster 6409 276308 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35396" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35395", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35395( Z35395K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/convert/index.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\tif (Z35395K1 === \"S00000\") {\n\t\treturn String.fromCodePoint(0x40000);\n\t}\n\treturn String.fromCodePoint(\n\t 0x40001 +\n\t ((parseInt(Z35395K1.slice(1, 4), 16) - 256) * 96) +\n\t (parseInt(Z35395K1.slice(4, 5), 16) * 16) +\n\t parseInt(Z35395K1.slice(5, 6), 16)\n\t);\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW symbol key to SWU symbol character, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } sukuj4ecd0y30mea0x9e2z98cdardyp Z35397 0 83850 276310 2026-05-19T22:12:19Z JJPMaster 6409 276310 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35397" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35397K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35397" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return Formal SignWriting regex from string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "See https://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js" } ] } } iwddqsjw1cw5wmy10wh5aa3314jajvq 276312 276310 2026-05-19T22:14:20Z JJPMaster 6409 Added Z35398 to the approved list of implementations 276312 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35397" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35397K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35398" ], "Z8K5": "Z35397" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return Formal SignWriting regex from string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "See https://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js" } ] } } n15vsejivee92esp9jgirujwqgh3egy 276322 276312 2026-05-19T22:50:23Z JJPMaster 6409 Removed Z35398 from the approved list of implementations 276322 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35397" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35397K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z882", "Z882K1": "Z6", "Z882K2": "Z6" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35397" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return Formal SignWriting regex from string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "See https://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js" } ] } } iwddqsjw1cw5wmy10wh5aa3314jajvq 276323 276322 2026-05-19T22:50:28Z JJPMaster 6409 276323 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35397" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35397K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35397" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return Formal SignWriting regex from string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "See https://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js" } ] } } 8c36bou2ajob97ggmhl863g4jvkikmo 276324 276323 2026-05-19T22:50:35Z JJPMaster 6409 Added Z35398 to the approved list of implementations 276324 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35397" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35397K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35398" ], "Z8K5": "Z35397" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return Formal SignWriting regex from string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "See https://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js" } ] } } hqclxzgw01qhk6d1xxkdjpjbtcg0ran Z35398 0 83851 276311 2026-05-19T22:14:14Z JJPMaster 6409 276311 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\tlet re = {\n\t\t'null': 'S00000',\n\t\t'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n\t\t'coord': '[0-9]{3}x[0-9]{3}',\n\t\t'sort': 'A',\n\t\t'box': '[BLMR]'\n\t};\n\tre.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n\tre.prefix = `(?:${re.sort}${re.nullorsymbol}+)`;\n\tre.spatial = `${re.symbol}${re.coord}`;\n\tre.signbox = `${re.box}${re.coord}(?:${re.spatial})*`;\n\tre.sign = `${re.prefix}?${re.signbox}`;\n\tre.sortable = `${re.prefix}${re.signbox}`;\n\treturn re[Z35397K1];\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 1zgtq3b3unhib2s0devz73cc0kstwl6 276313 276311 2026-05-19T22:14:42Z JJPMaster 6409 error handling-ish 276313 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\tlet re = {\n\t\t'null': 'S00000',\n\t\t'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n\t\t'coord': '[0-9]{3}x[0-9]{3}',\n\t\t'sort': 'A',\n\t\t'box': '[BLMR]'\n\t};\n\tre.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n\tre.prefix = `(?:${re.sort}${re.nullorsymbol}+)`;\n\tre.spatial = `${re.symbol}${re.coord}`;\n\tre.signbox = `${re.box}${re.coord}(?:${re.spatial})*`;\n\tre.sign = `${re.prefix}?${re.signbox}`;\n\tre.sortable = `${re.prefix}${re.signbox}`;\n\treturn re[Z35397K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } tsboeu3qg6ym9y1384uaqs9482f0clb 276338 276313 2026-05-20T00:01:16Z Theki 2389 use constant 276338 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\tconst re = {\n\t\t'null': 'S00000',\n\t\t'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n\t\t'coord': '[0-9]{3}x[0-9]{3}',\n\t\t'sort': 'A',\n\t\t'box': '[BLMR]'\n\t};\n\tre.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n\tre.prefix = `(?:${re.sort}${re.nullorsymbol}+)`;\n\tre.spatial = `${re.symbol}${re.coord}`;\n\tre.signbox = `${re.box}${re.coord}(?:${re.spatial})*`;\n\tre.sign = `${re.prefix}?${re.signbox}`;\n\tre.sortable = `${re.prefix}${re.signbox}`;\n\treturn re[Z35397K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } ev9bil1p4bror7k800u54mz5rvtu79j 276339 276338 2026-05-20T00:11:25Z JJPMaster 6409 capturing groups 276339 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\tconst re = {\n\t\t'null': 'S00000',\n\t\t'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n\t\t'coord': '([0-9]{3}x[0-9]{3})',\n\t\t'sort': 'A',\n\t\t'box': '([BLMR])'\n\t};\n\tre.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n\tre.prefix = `(${re.sort}${re.nullorsymbol}+)`;\n\tre.spatial = `(${re.symbol}${re.coord})`;\n\tre.signbox = `${re.box}${re.coord}(?:${re.spatial})*`;\n\tre.sign = `${re.prefix}?${re.signbox}`;\n\tre.sortable = `${re.prefix}${re.signbox}`;\n\treturn re[Z35397K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } g4rqnetily83dr0jefekx1swemsj12e 276416 276339 2026-05-20T03:51:05Z JJPMaster 6409 trying fallback 276416 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n\t/** \n\tThis implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n\t * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n\t * Permission is hereby granted, free of charge, to any person obtaining a copy\n\t * of this software and associated documentation files (the \"Software\"), to deal\n\t * in the Software without restriction, including without limitation the rights\n\t * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\t * copies of the Software, and to permit persons to whom the Software is\n\t * furnished to do so, subject to the following conditions:\n\n\t * The above copyright notice and this permission notice shall be included in\n\t * all copies or substantial portions of the Software.\n\t \n\t * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\t * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\t * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\t * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\t * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\t * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\t * THE SOFTWARE.\n\t*/\n\tconst re = {\n\t\t'null': 'S00000',\n\t\t'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n\t\t'coord': '([0-9]{3}x[0-9]{3})',\n\t\t'sort': 'A',\n\t\t'box': '([BLMR])'\n\t};\n\tre.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n\tre.prefix = `(${re.sort}${re.nullorsymbol}+)`;\n\tre.spatial = `(${re.symbol}${re.coord})`;\n\tre.signbox = `${re.box}${re.coord}(?:${re.spatial})*`;\n\tre.sign = `${re.prefix}?${re.signbox}`;\n\tre.sortable = `${re.prefix}${re.signbox}`;\n\tif (Z35397K1 === 'all') {\n\t return Object.values(re).join('|'); \n\t}\n\treturn re[Z35397K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 8x57svads86hhtvglws8lfrbvr588ew 276417 276416 2026-05-20T03:56:30Z JJPMaster 6409 alternate fallback 276417 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n /** This implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n const re = {\n 'null': 'S00000',\n 'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n 'coord': '([0-9]{3}x[0-9]{3})',\n 'sort': 'A',\n 'box': '([BLMR])'\n };\n re.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n re.prefix = `(${re.sort}${re.nullorsymbol}+)`;\n re.spatial = `(${re.symbol}${re.coord})`;\n re.signbox = `${re.box}${re.coord}(?:${re.spatial})*`;\n re.sign = `${re.prefix}?${re.signbox}`;\n re.sortable = `${re.prefix}${re.signbox}`;\n\tre.all = `${re.prefix}|${re.signbox}|${re.spatial}`;\n return re[Z35397K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } fvur4qmuh0oeukuppwzh75bfasot9u7 276423 276417 2026-05-20T04:17:41Z JJPMaster 6409 change signbox definition 276423 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n /** This implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n const re = {\n 'null': 'S00000',\n 'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n 'coord': '([0-9]{3}x[0-9]{3})',\n 'sort': 'A',\n 'box': '([BLMR])'\n };\n re.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n re.prefix = `(${re.sort}${re.nullorsymbol}+)`;\n re.spatial = `(${re.symbol}${re.coord})`;\n re.boxCoord = `${re.box}${re.coord}`;\n re.signbox = `${re.boxCoord}(?:${re.spatial})*`;\n re.sign = `${re.prefix}?${re.signbox}`;\n re.sortable = `${re.prefix}${re.signbox}`;\n\tre.all = `${re.prefix}|${re.boxCoord}|${re.spatial}`;\n return re[Z35397K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } b1h07zv84h4zo2mf86psglkwxffpuyw 276434 276423 2026-05-20T04:46:50Z JJPMaster 6409 super fallback 276434 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35398" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35397", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35397( Z35397K1 ) {\n /** This implementation contains code from \u003Chttps://github.com/sutton-signwriting/core/blob/master/src/fsw/fsw-re.js\u003E, released under the following license terms:\n * Copyright (c) 2007-2019 Steve Slevinski https://SteveSlevinski.me\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n const re = {\n 'null': 'S00000',\n 'symbol': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',\n 'coord': '([0-9]{3}x[0-9]{3})',\n 'sort': 'A',\n 'box': '([BLMR])'\n };\n re.nullorsymbol = `(?:${re.null}|${re.symbol})`;\n re.prefix = `(${re.sort}${re.nullorsymbol}+)`;\n re.spatial = `(${re.symbol}${re.coord})`;\n re.boxCoord = `${re.box}${re.coord}`;\n re.signbox = `${re.boxCoord}(?:${re.spatial})*`;\n re.sign = `${re.prefix}?${re.signbox}`;\n re.sortable = `${re.prefix}${re.signbox}`;\n\tre.all = `${re.prefix}|${re.boxCoord}|${re.spatial}|(.+)`;\n return re[Z35397K1] ?? \"\";\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW regex from string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 5939enqvxglqe6efu2ivkv6hcqon3vo Z35399 0 83852 276314 2026-05-19T22:21:16Z JJPMaster 6409 276314 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35399" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35399K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35399" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Formal SignWriting to SignWriting in Unicode" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts Formal SignWriting to SignWriting in Unicode." } ] } } iy4atf7kwdt71qzsolppq1qfdi76hzl 276432 276314 2026-05-20T04:39:27Z JJPMaster 6409 Added Z35427 to the approved list of implementations 276432 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35399" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35399K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35427" ], "Z8K5": "Z35399" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Formal SignWriting to SignWriting in Unicode" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts Formal SignWriting to SignWriting in Unicode." } ] } } ess2du6sc16tqwyjakyfi0rp7h7fnv0 Z35400 0 83853 276320 2026-05-19T22:47:34Z JJPMaster 6409 276320 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35400" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35400" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 64e4zop9yphwy7i3tfb1gz8hitrqt3h 276321 276320 2026-05-19T22:48:32Z JJPMaster 6409 276321 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35400" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "structure" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35400" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } jmjy6d8nbujlz8enyd1k4dg7hj80m6z 276326 276321 2026-05-19T22:51:26Z JJPMaster 6409 Added Z35401 to the approved list of implementations 276326 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35400" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "structure" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35401" ], "Z8K5": "Z35400" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 9bqwh0ld8ejjrsithkv0it2dfhvxohh 276393 276326 2026-05-20T03:13:04Z JJPMaster 6409 Removed Z35401 from the approved list of implementations 276393 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35400" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "structure" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35400" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } jmjy6d8nbujlz8enyd1k4dg7hj80m6z 276394 276393 2026-05-20T03:13:12Z JJPMaster 6409 276394 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35400" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "structure" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35400" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } a3is98gdvopp2kxeeqy2gfhrnq747yv 276395 276394 2026-05-20T03:13:15Z JJPMaster 6409 Added Z35401 to the approved list of implementations 276395 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35400" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35400K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "structure" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35401" ], "Z8K5": "Z35400" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 7a1y9xm6t9r9swbemdel5a2f9o4v51r Z35401 0 83854 276325 2026-05-19T22:51:21Z JJPMaster 6409 276325 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35401" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35400", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z25829", "Z25829K1": { "Z1K1": "Z18", "Z18K1": "Z35400K1" }, "Z25829K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": { "Z1K1": "Z18", "Z18K1": "Z35400K2" } }, "Z25829K3": "g" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string, javascript" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } n72jwkqkht48ir9a8qvg11c6hhpgdbh 276327 276325 2026-05-19T22:59:39Z JJPMaster 6409 276327 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35401" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35400", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z25829", "Z25829K1": { "Z1K1": "Z18", "Z18K1": "Z35400K1" }, "Z25829K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": { "Z1K1": "Z18", "Z18K1": "Z35400K2" } }, "Z25829K3": "g" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "return FSW structures from FSW string, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } sdppc3eafxts1o7jce7wlnnro2wk48f Z35402 0 83855 276328 2026-05-19T23:12:53Z JJPMaster 6409 i'm quite surprised this doesn't exist already; or maybe it does 276328 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35402" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35402K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z13518", "Z17K2": "Z35402K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "index" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35402" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "split string into list by repeated index" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Example: [\"iloveyoujohn\", 4] returns [\"ilov\", \"eyou\", \"john\"]." } ] } } nmi5fuhah2l0ggmutbfmjcmj9j2xq4w 276330 276328 2026-05-19T23:16:27Z JJPMaster 6409 Added Z35403 to the approved list of implementations 276330 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35402" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35402K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z13518", "Z17K2": "Z35402K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "index" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35403" ], "Z8K5": "Z35402" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "split string into list by repeated index" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Example: [\"iloveyoujohn\", 4] returns [\"ilov\", \"eyou\", \"john\"]." } ] } } 4gie728xzuu00zb23ltdm0omk2pvlaq 276334 276330 2026-05-19T23:23:51Z JJPMaster 6409 Added Z35404 to the approved list of test cases 276334 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35402" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35402K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z13518", "Z17K2": "Z35402K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "index" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z6" }, "Z8K3": [ "Z20", "Z35404" ], "Z8K4": [ "Z14", "Z35403" ], "Z8K5": "Z35402" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "split string into list by repeated index" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Example: [\"iloveyoujohn\", 4] returns [\"ilov\", \"eyou\", \"john\"]." } ] } } s10jbs3gfqxpaevjhmen7ohucuikaz5 Z35403 0 83856 276329 2026-05-19T23:16:21Z JJPMaster 6409 276329 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35403" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35402", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35402( Z35402K1, Z35402K2 ) {\n\tret = [];\n\tfor (var i = Z35402K2; i \u003C Z35402K1.length; i += Z35402K2) {\n\t\tret.append(Z35402K1.substring(i - Z35402K2, Z35402K2));\n\t}\n\treturn ret\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "split string into list by repeated index, js" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } g3pnmzjbqtqxpwdaa09rp9zsvvxldyw 276331 276329 2026-05-19T23:21:27Z JJPMaster 6409 fix 276331 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35403" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35402", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35402( Z35402K1, Z35402K2 ) {\n let ret = [];\n let index = Number(Z35402K2);\n for (var i = 0; i \u003C Z35402K1.length; i += index) {\n ret.push(Z35402K1.substring(i, i + index));\n }\n return ret;\n} " } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "split string into list by repeated index, js" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } dyj0dvf1b3yzjgv9omblkv7445cjkyv Z35404 0 83857 276332 2026-05-19T23:23:11Z JJPMaster 6409 276332 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35404" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35402", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35402", "Z35402K1": "iloveyoujohn", "Z35402K2": { "Z1K1": "Z13518", "Z13518K1": "4" } }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z18646", "Z18646K2": [ "Z6", "eyou", "john" ], "Z18646K3": "Z866" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "iloveyoujohn" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } i6649kegidzxd1w7fdhf14jawvzue95 276333 276332 2026-05-19T23:23:30Z JJPMaster 6409 276333 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35404" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35402", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35402", "Z35402K1": "iloveyoujohn", "Z35402K2": { "Z1K1": "Z13518", "Z13518K1": "4" } }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z18646", "Z18646K2": [ "Z6", "ilov", "eyou", "john" ], "Z18646K3": "Z866" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "iloveyoujohn" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 4j1cqrbkxkkwivo9flp4nsn2i2al8q3 Z35405 0 83858 276335 2026-05-19T23:50:16Z JJPMaster 6409 276335 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35405" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35405K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35405" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW prefixes to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Helper for Z35399" } ] } } 9jt20s1h71yothkg755llu4ftmh909a 276337 276335 2026-05-19T23:51:58Z JJPMaster 6409 Added Z35406 to the approved list of implementations 276337 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35405" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35405K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35406" ], "Z8K5": "Z35405" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW prefixes to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Helper for Z35399" } ] } } fv6rm8oy2dfp1zd89aar7798jygt7ad Z35406 0 83859 276336 2026-05-19T23:51:52Z JJPMaster 6409 276336 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35406" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35405", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z10000", "Z10000K1": "𝠀", "Z10000K2": { "Z1K1": "Z7", "Z7K1": "Z22074", "Z22074K1": "Z21394", "Z22074K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35395", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35402", "Z35402K1": { "Z1K1": "Z7", "Z7K1": "Z14456", "Z14456K1": { "Z1K1": "Z18", "Z18K1": "Z35405K1" } }, "Z35402K2": { "Z1K1": "Z13518", "Z13518K1": "6" } } } ] } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW prefixes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } iiz13phm035x2o8kueg58gcoq3h6nnh 276418 276336 2026-05-20T04:06:20Z JJPMaster 6409 return string unchanged if error 276418 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35406" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35405", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z10000", "Z10000K1": "𝠀", "Z10000K2": { "Z1K1": "Z7", "Z7K1": "Z22074", "Z22074K1": "Z21394", "Z22074K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35395", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35402", "Z35402K1": { "Z1K1": "Z7", "Z7K1": "Z14456", "Z14456K1": { "Z1K1": "Z18", "Z18K1": "Z35405K1" } }, "Z35402K2": { "Z1K1": "Z13518", "Z13518K1": "6" } } } ] } }, "Z850K2": "Z500", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35405K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW prefixes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } sp956d8s3e7ccdmyufyi8uu6kx1745v Z35407 0 83860 276349 2026-05-20T00:48:43Z JJPMaster 6409 276349 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35407" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z16683" }, "Z17K2": "Z35407K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "coordinates" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35407" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "integer list of coordinates to SWU characters" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a list of two integers to two SignWriting in Unicode number characters." } ] } } 9ohr09n0nkj5bazq0b3uqvra3h9odd4 276354 276349 2026-05-20T00:58:30Z JJPMaster 6409 Added Z35410 to the approved list of implementations 276354 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35407" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z16683" }, "Z17K2": "Z35407K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "coordinates" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35410" ], "Z8K5": "Z35407" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "integer list of coordinates to SWU characters" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a list of two integers to two SignWriting in Unicode number characters." } ] } } dk3cou7r81bhi2z5mto1husww6xay4p 276355 276354 2026-05-20T01:00:07Z JJPMaster 6409 Removed Z35410 from the approved list of implementations 276355 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35407" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z16683" }, "Z17K2": "Z35407K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "coordinates" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35407" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "integer list of coordinates to SWU characters" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a list of two integers to two SignWriting in Unicode number characters." } ] } } 9ohr09n0nkj5bazq0b3uqvra3h9odd4 276357 276355 2026-05-20T01:02:31Z JJPMaster 6409 Added Z35410 to the approved list of implementations 276357 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35407" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z16683" }, "Z17K2": "Z35407K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "coordinates" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35410" ], "Z8K5": "Z35407" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "integer list of coordinates to SWU characters" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Converts a list of two integers to two SignWriting in Unicode number characters." } ] } } dk3cou7r81bhi2z5mto1husww6xay4p Z35408 0 83861 276350 2026-05-20T00:50:23Z JJPMaster 6409 276350 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35408" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z16683", "Z17K2": "Z35408K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "number" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35408" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "number to SignWriting in Unicode character" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } mtvpjb4l1hc1gv6tndauier5jxm8sxt 276352 276350 2026-05-20T00:50:47Z JJPMaster 6409 Added Z35409 to the approved list of implementations 276352 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35408" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z16683", "Z17K2": "Z35408K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "number" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35409" ], "Z8K5": "Z35408" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "number to SignWriting in Unicode character" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 7odi0m3283ahnin93wulm6thu2vlybz Z35409 0 83862 276351 2026-05-20T00:50:42Z JJPMaster 6409 276351 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35409" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35408", "Z14K3": { "Z1K1": "Z16", "Z16K1": "Z600", "Z16K2": "function Z35408( Z35408K1 ) {\n\treturn String.fromCodePoint(0x1D80C + parseInt(Z35408K1) - 250);\n}" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "number to SignWriting in Unicode character, js" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 2jfzmbtmxl6xywv82085psls7btsvf2 Z35410 0 83863 276353 2026-05-20T00:58:25Z JJPMaster 6409 276353 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35410" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35407", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z22074", "Z22074K1": "Z21394", "Z22074K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35408", "Z873K2": { "Z1K1": "Z18", "Z18K1": "Z35407K1" } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "int list of coordinates to SWU characters, comp" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 09s6ec2jcf16ny35empm2uq8fcb35hc 276356 276353 2026-05-20T01:02:25Z JJPMaster 6409 enforce length 276356 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35410" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35407", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z30164", "Z30164K1": { "Z1K1": "Z18", "Z18K1": "Z35407K1" }, "Z30164K2": { "Z1K1": "Z13518", "Z13518K1": "2" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z22074", "Z22074K1": "Z21394", "Z22074K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35408", "Z873K2": { "Z1K1": "Z18", "Z18K1": "Z35407K1" } } ] }, "Z802K3": { "Z1K1": "Z23" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "int list of coordinates to SWU characters, comp" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } e3y0jj4u0rlnvgc42b07gm74y0kr4w3 Z35411 0 83864 276359 2026-05-20T01:21:21Z JJPMaster 6409 276359 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35411" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35411K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35411" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert prefix in FSW string to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Applies Z35405 to the prefix of a Formal SignWriting string, leaving the rest unchanged." } ] } } rpnusrfh8b1ofyne1arvu61sqao6s9j 276361 276359 2026-05-20T01:21:53Z JJPMaster 6409 Added Z35412 to the approved list of implementations 276361 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35411" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35411K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35412" ], "Z8K5": "Z35411" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert prefix in FSW string to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Applies Z35405 to the prefix of a Formal SignWriting string, leaving the rest unchanged." } ] } } ftj3gxvscc7v67z4n1x7g3nzofyd528 Z35412 0 83865 276360 2026-05-20T01:21:49Z JJPMaster 6409 276360 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35412" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35411", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z22074", "Z22074K1": "Z21394", "Z22074K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35405", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z25829", "Z25829K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z25829K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "prefix" }, "Z25829K3": "g" } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert prefix in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } qku451wg60w2hjlwj33v6jq8lt4reym 276362 276360 2026-05-20T01:26:20Z JJPMaster 6409 276362 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35412" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35411", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z31120", "Z31120K1": { "Z1K1": "Z7", "Z7K1": "Z22074", "Z22074K1": "Z21394", "Z22074K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35405", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z25829", "Z25829K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z25829K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "prefix" }, "Z25829K3": "g" } } ] } }, { "Z1K1": "Z7", "Z7K1": "Z12316", "Z12316K1": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "prefix" }, "Z12316K2": "", "Z12316K3": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z12316K4": "g" } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert prefix in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 1cor99i72sqthdteprn58nn4n36o860 276406 276362 2026-05-20T03:27:07Z JJPMaster 6409 276406 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35412" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35411", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z35400K2": "prefix" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "prefix" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35405", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z35400K2": "prefix" } }, "Z35421K4": "Z10193" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert prefix in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } aislxkzzpmwxvf5fdedfwm8ol0ix4p8 276419 276406 2026-05-20T04:06:52Z JJPMaster 6409 switch to fallback 276419 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35412" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35411", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z35400K2": "all" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "prefix" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35405", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z35400K2": "all" } }, "Z35421K4": "Z10193" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert prefix in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } f846ihc55d56kfesen78ouwibbdf8mf 276433 276419 2026-05-20T04:41:21Z JJPMaster 6409 error handling 276433 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35412" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35411", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z35400K2": "all" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "prefix" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35405", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35411K1" }, "Z35400K2": "all" } }, "Z35421K4": "Z10193" } } }, "Z850K2": "Z500", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35411K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert prefix in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } dh2782g6r7qfci3irvse6dhnxcyq11u Z35413 0 83866 276363 2026-05-20T01:28:04Z JJPMaster 6409 276363 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35413" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35413K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35413" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Helper for Z35399" } ] } } 6xv2haxslwo0fozqsqnap1wf2ewj72j 276365 276363 2026-05-20T01:54:43Z JJPMaster 6409 Added Z35414 to the approved list of implementations 276365 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35413" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35413K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35414" ], "Z8K5": "Z35413" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Helper for Z35399" } ] } } slgkvwqwdacgco8lrypph1wzpx1ahn7 Z35414 0 83867 276364 2026-05-20T01:54:35Z JJPMaster 6409 276364 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35414" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35413", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z22074", "Z22074K1": "Z21394", "Z22074K2": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z35390", "Z35390K1": { "Z1K1": "Z7", "Z7K1": "Z10901", "Z10901K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "1" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "8" } } } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } rqr6t6lfwgj3js6wcb0l1xatrojefl5 276366 276364 2026-05-20T02:00:50Z JJPMaster 6409 276366 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35414" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35413", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": [ "Z1", { "Z1K1": "Z7", "Z7K1": "Z35390", "Z35390K1": { "Z1K1": "Z7", "Z7K1": "Z10901", "Z10901K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "1" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "8" } } } } ] } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } oizkg1gxrlx79r0n8ypher7q7sqwm03 276370 276366 2026-05-20T02:31:24Z JJPMaster 6409 simplify 276370 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35414" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35413", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z35390", "Z35390K1": { "Z1K1": "Z7", "Z7K1": "Z10901", "Z10901K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "1" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "8" } } } } ] } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 9ulj3fx6n8hs6yw61x8onsqgyftj94d 276420 276370 2026-05-20T04:09:50Z JJPMaster 6409 error handling 276420 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35414" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35413", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z35390", "Z35390K1": { "Z1K1": "Z7", "Z7K1": "Z10901", "Z10901K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "1" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "8" } } } } ] }, "Z850K2": "Z500", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } kqt72cqvct8ewto92fczu57jdws3v3z 276427 276420 2026-05-20T04:29:19Z JJPMaster 6409 test 276427 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35414" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35413", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z35390", "Z35390K1": { "Z1K1": "Z7", "Z7K1": "Z10901", "Z10901K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "1" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "8" } } } } ] }, "Z850K2": "Z507", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 9w3g7o0q18e7krjqmg0y4k49gjsycw4 276428 276427 2026-05-20T04:29:39Z JJPMaster 6409 Restored revision 276420 by [[Special:Contributions/JJPMaster|JJPMaster]] ([[en:w:User:BrandonXLF/Restorer|Restorer]]) 276428 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35414" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35413", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z35390", "Z35390K1": { "Z1K1": "Z7", "Z7K1": "Z10901", "Z10901K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "1" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "8" } } } } ] }, "Z850K2": "Z500", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } kqt72cqvct8ewto92fczu57jdws3v3z 276429 276428 2026-05-20T04:33:46Z JJPMaster 6409 double try/catch 276429 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35414" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35413", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": [ "Z6", { "Z1K1": "Z7", "Z7K1": "Z35390", "Z35390K1": { "Z1K1": "Z7", "Z7K1": "Z10901", "Z10901K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35413K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "1" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "8" } } } } ] }, "Z850K2": "Z500", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } }, "Z850K2": "Z507", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35413K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW signboxes to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } a1r8wtz68rumobji1tsvq6ve5o6nwb0 Help:Type deconstruction table/Wikidata time 12 83868 276367 2026-05-20T02:04:30Z YoshiRulz 10156 Create page 276367 wikitext text/x-wiki {{Help:Type deconstruction table/preface|Z6064|Wikidata time}} |- | rowspan="6" | &mdash; ! K1: {{Z|6061}} | {{Z|25726}} |- ! K2: {{Z|6062}} | {{Z|35328}} |- ! K3: {{Z|13518}} | &mdash; |- ! K4: {{Z|13518}} | &mdash; |- ! K5: {{Z|16683}} | &mdash; |- ! K6: {{Z|6063}} | &mdash; |} ti12zgk7a1yh4hdnh7ci83mloxkjxzn 276381 276367 2026-05-20T02:50:35Z Theki 2389 276381 wikitext text/x-wiki {{Help:Type deconstruction table/preface|Z6064|Wikidata time}} |- | rowspan="6" | &mdash; ! K1: {{Z|6061}} | {{Z|25726}} |- ! K2: {{Z|6062}} | {{Z|35328}} |- ! K3: {{Z|13518}} | &mdash; |- ! K4: {{Z|13518}} | &mdash; |- ! K5: {{Z|16683}} | &mdash; |- ! K6: {{Z|6063}} | {{Z|Z35418}} |} azzch0zb3v3vpdbnh600hmpahmh9oso Z35415 0 83869 276368 2026-05-20T02:27:22Z JJPMaster 6409 276368 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35415" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35415K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35415" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW spatials to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Helper for Z35399" } ] } } opnv8ioerx6nye6j3xmepkm1dmzxoef 276371 276368 2026-05-20T02:32:50Z JJPMaster 6409 Added Z35416 to the approved list of implementations 276371 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35415" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35415K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35416" ], "Z8K5": "Z35415" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW spatials to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Helper for Z35399" } ] } } l1aza20m66v78cd3r2unk3c713k7mj7 Z35416 0 83870 276369 2026-05-20T02:30:33Z JJPMaster 6409 276369 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35416" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35415", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z10000", "Z10000K1": { "Z1K1": "Z7", "Z7K1": "Z35395", "Z35395K1": { "Z1K1": "Z7", "Z7K1": "Z14592", "Z14592K1": { "Z1K1": "Z18", "Z18K1": "Z35415K1" }, "Z14592K2": { "Z1K1": "Z13518", "Z13518K1": "6" } } }, "Z10000K2": { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35415K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "6" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "13" } } } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW spatials to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } gayv80nocuoi0uea4touws2gadlgr6i 276422 276369 2026-05-20T04:12:00Z JJPMaster 6409 error handling 276422 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35416" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35415", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z10000", "Z10000K1": { "Z1K1": "Z7", "Z7K1": "Z35395", "Z35395K1": { "Z1K1": "Z7", "Z7K1": "Z14592", "Z14592K1": { "Z1K1": "Z18", "Z18K1": "Z35415K1" }, "Z14592K2": { "Z1K1": "Z13518", "Z13518K1": "6" } } }, "Z10000K2": { "Z1K1": "Z7", "Z7K1": "Z35407", "Z35407K1": { "Z1K1": "Z7", "Z7K1": "Z35392", "Z35392K1": { "Z1K1": "Z7", "Z7K1": "Z28630", "Z28630K1": { "Z1K1": "Z18", "Z18K1": "Z35415K1" }, "Z28630K2": { "Z1K1": "Z13518", "Z13518K1": "6" }, "Z28630K3": { "Z1K1": "Z13518", "Z13518K1": "13" } } } } }, "Z850K2": "Z500", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35415K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert FSW spatials to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } g7gtcxngzh4gi09flirs5mjmb90pukd Z35417 0 83871 276372 2026-05-20T02:39:05Z JJPMaster 6409 276372 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35417" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35417K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35417" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert signbox in FSW string to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Applies Z35413 to the prefix of a Formal SignWriting string, leaving the rest unchanged." } ] } } btzwf7ui7s798804zzos0s5l04ijnkp 276408 276372 2026-05-20T03:31:01Z JJPMaster 6409 Added Z35424 to the approved list of implementations 276408 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35417" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35417K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35424" ], "Z8K5": "Z35417" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert signbox in FSW string to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Applies Z35413 to the prefix of a Formal SignWriting string, leaving the rest unchanged." } ] } } joma44r4hxwpo2jpzgtxo1qb1b96yu4 Z35418 0 83872 276376 2026-05-20T02:46:33Z Theki 2389 276376 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35418" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6064", "Z17K2": "Z35418K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "time" } ] } } ], "Z8K2": "Z6063", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35418" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "calendar model of Wikidata time" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } n7et2e8sf70omirlov77q52c69rm9fk 276378 276376 2026-05-20T02:47:14Z Theki 2389 Added Z35419 to the approved list of implementations 276378 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35418" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6064", "Z17K2": "Z35418K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "time" } ] } } ], "Z8K2": "Z6063", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35419" ], "Z8K5": "Z35418" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "calendar model of Wikidata time" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 11e2gk7qcl2g65axbq8k0iq580qrjho 276380 276378 2026-05-20T02:50:22Z Theki 2389 Added Z35420 to the approved list of test cases 276380 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35418" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6064", "Z17K2": "Z35418K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "time" } ] } } ], "Z8K2": "Z6063", "Z8K3": [ "Z20", "Z35420" ], "Z8K4": [ "Z14", "Z35419" ], "Z8K5": "Z35418" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "calendar model of Wikidata time" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 43twp5lx1ymw5n4psbs3pzoth9vse8v Z35419 0 83873 276377 2026-05-20T02:47:09Z Theki 2389 276377 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35419" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35418", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z22475", "Z22475K1": { "Z1K1": "Z39", "Z39K1": "Z6064K6" }, "Z22475K2": { "Z1K1": "Z18", "Z18K1": "Z35418K1" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "calendar model of Wikidata time, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 5gwilg8vv26bcv5kh2gsnn7nn7c0z60 Z35420 0 83874 276379 2026-05-20T02:50:09Z Theki 2389 276379 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35420" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35418", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35418", "Z35418K1": { "Z1K1": "Z6064", "Z6064K1": { "Z1K1": "Z6061", "Z6061K1": { "Z1K1": "Z20420", "Z20420K1": { "Z1K1": "Z20159", "Z20159K1": { "Z1K1": "Z17813", "Z17813K1": "Z17814" }, "Z20159K2": { "Z1K1": "Z13518", "Z13518K1": "2026" } }, "Z20420K2": { "Z1K1": "Z20342", "Z20342K1": { "Z1K1": "Z16098", "Z16098K1": "Z16105" }, "Z20342K2": { "Z1K1": "Z13518", "Z13518K1": "19" } } }, "Z6061K2": { "Z1K1": "Z6060", "Z6060K1": { "Z1K1": "Z13518", "Z13518K1": "22" }, "Z6060K2": { "Z1K1": "Z13518", "Z13518K1": "47" }, "Z6060K3": { "Z1K1": "Z13518", "Z13518K1": "0" } } }, "Z6064K2": { "Z1K1": "Z6062", "Z6062K1": { "Z1K1": "Z6091", "Z6091K1": "Q7727" } }, "Z6064K3": { "Z1K1": "Z13518", "Z13518K1": "" }, "Z6064K4": { "Z1K1": "Z13518", "Z13518K1": "" }, "Z6064K5": { "Z1K1": "Z16683", "Z16683K1": "Z16662", "Z16683K2": { "Z1K1": "Z13518", "Z13518K1": "4" } }, "Z6064K6": { "Z1K1": "Z6063", "Z6063K1": { "Z1K1": "Z6091", "Z6091K1": "Q1985727" } } } }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z13052", "Z13052K2": { "Z1K1": "Z6063", "Z6063K1": { "Z1K1": "Z6091", "Z6091K1": "Q1985727" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "calendar model is proleptic Gregorian" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } r8vbasxprpiw9hnguvxe512069vhgn8 Talk:Z35411 1 83875 276383 2026-05-20T02:52:18Z Theki 2389 categorize? 276383 wikitext text/x-wiki [[Category:SignWriting]] igy8ilidapprm069gzbnelu7lapz40w Talk:Z35407 1 83876 276384 2026-05-20T02:52:48Z Theki 2389 Created page with "[[Category:SignWriting]]" 276384 wikitext text/x-wiki [[Category:SignWriting]] igy8ilidapprm069gzbnelu7lapz40w Talk:Z35417 1 83877 276385 2026-05-20T02:53:13Z Theki 2389 Created page with "[[Category:SignWriting]]" 276385 wikitext text/x-wiki [[Category:SignWriting]] igy8ilidapprm069gzbnelu7lapz40w Talk:Z35405 1 83878 276386 2026-05-20T02:53:30Z Theki 2389 Created page with "[[Category:SignWriting]]" 276386 wikitext text/x-wiki [[Category:SignWriting]] igy8ilidapprm069gzbnelu7lapz40w Talk:Z35399 1 83879 276387 2026-05-20T02:53:44Z Theki 2389 Created page with "[[Category:SignWriting]]" 276387 wikitext text/x-wiki [[Category:SignWriting]] igy8ilidapprm069gzbnelu7lapz40w Z35421 0 83880 276388 2026-05-20T03:01:07Z JJPMaster 6409 276388 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35421" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35421K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "second parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "third parameter" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35421" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "apply3: common 2nd, list 1st and 3rd" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 89x4n3ohk7xqpjsnv6rgidf18g0ccs1 276389 276388 2026-05-20T03:06:17Z JJPMaster 6409 276389 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35421" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35421K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "second parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "third parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z8", "Z17K2": "Z35421K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "function" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35421" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "apply3: common 2nd, list 1st and 3rd" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 705g75km6078k3o432v28jcajahfgpi 276392 276389 2026-05-20T03:09:23Z JJPMaster 6409 Added Z35422 to the approved list of implementations 276392 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35421" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35421K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "second parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "third parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z8", "Z17K2": "Z35421K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "function" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35422" ], "Z8K5": "Z35421" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "apply3: common 2nd, list 1st and 3rd" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } ahmvrnx4btsb887h3k4qvt5ph0lwjbw 276404 276392 2026-05-20T03:25:31Z JJPMaster 6409 Added Z35423 to the approved list of implementations 276404 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35421" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35421K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "second parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "third parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z8", "Z17K2": "Z35421K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "function" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35422", "Z35423" ], "Z8K5": "Z35421" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "apply3: common 2nd, list 1st and 3rd" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } j031awkt4gls0y8nr5d4facnbiz8q1e 276405 276404 2026-05-20T03:25:47Z JJPMaster 6409 Removed Z35422 from the approved list of implementations 276405 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35421" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "first parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35421K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "second parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z17K2": "Z35421K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "third parameter" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z8", "Z17K2": "Z35421K4", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "function" } ] } } ], "Z8K2": { "Z1K1": "Z7", "Z7K1": "Z881", "Z881K1": "Z1" }, "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35423" ], "Z8K5": "Z35421" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "apply3: common 2nd, list 1st and 3rd" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 1ef1in4gfxe9ztm3zrgecdh0f0ku4gg Z35422 0 83881 276391 2026-05-20T03:09:17Z JJPMaster 6409 276391 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35422" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35421", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z31490", "Z31490K1": { "Z1K1": "Z7", "Z7K1": "Z813", "Z813K1": { "Z1K1": "Z18", "Z18K1": "Z35421K1" } }, "Z31490K2": { "Z1K1": "Z7", "Z7K1": "Z813", "Z813K1": { "Z1K1": "Z18", "Z18K1": "Z35421K3" } }, "Z31490K3": [ "Z1" ], "Z31490K4": { "Z1K1": "Z7", "Z7K1": "Z810", "Z810K1": { "Z1K1": "Z7", "Z7K1": "Z21216", "Z21216K1": { "Z1K1": "Z18", "Z18K1": "Z35421K4" }, "Z21216K2": { "Z1K1": "Z7", "Z7K1": "Z811", "Z811K1": { "Z1K1": "Z18", "Z18K1": "Z35421K1" } }, "Z21216K3": { "Z1K1": "Z18", "Z18K1": "Z35421K2" }, "Z21216K4": { "Z1K1": "Z7", "Z7K1": "Z811", "Z811K1": { "Z1K1": "Z18", "Z18K1": "Z35421K3" } } }, "Z810K2": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z812", "Z812K1": { "Z1K1": "Z18", "Z18K1": "Z35421K1" } }, "Z35421K2": { "Z1K1": "Z18", "Z18K1": "Z35421K2" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z812", "Z812K1": { "Z1K1": "Z18", "Z18K1": "Z35421K3" } }, "Z35421K4": { "Z1K1": "Z18", "Z18K1": "Z35421K4" } } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "apply3: common 2nd, list 1st and 3rd, recurs comp" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } e1i2vspalk11t69mnjczseggzy7391a Translations:Template:Deprecated function/text/1/tok 1198 83882 276396 2026-05-20T03:14:52Z Theki 2389 could be better than "ike", but I'm trying to keep it short instead of going into detail that 「this function is old in a bad way」 or similar 276396 wikitext text/x-wiki pali ni li ike. 6yz5mjmhocv2eql3atqyz7u8p3140kv Template:Deprecated function/text/tok 10 83883 276397 2026-05-20T03:14:53Z Theki 2389 could be better than "ike", but I'm trying to keep it short instead of going into detail that 「this function is old in a bad way」 or similar 276397 wikitext text/x-wiki <noinclude><languages/></noinclude>{{mbox|type=warning|text=pali ni li ike.}} lx6k9a0rgttct63znutzko49z010spa Translations:Template:Shortcut caption/1/tok 1198 83884 276399 2026-05-20T03:24:34Z Theki 2389 Created page with "nimi pi tenpo lili{{#if:{{{1|}}}|s|}}" 276399 wikitext text/x-wiki nimi pi tenpo lili{{#if:{{{1|}}}|s|}} 6fu4xu600o08ug1tkenmbzo76bfrggo Template:Shortcut caption/tok 10 83885 276400 2026-05-20T03:24:34Z Theki 2389 Created page with "nimi pi tenpo lili{{#if:{{{1|}}}|s|}}" 276400 wikitext text/x-wiki <noinclude> <languages /> </noinclude><bdi lang="{{#bcp47:tok}}">nimi pi tenpo lili{{#if:{{{1|}}}|s|}}</bdi><noinclude> {{doc|template:Shortcut caption/doc}} </noinclude> nb6jaxxghp3b8fh4jyuexj58mhr3j6f Category:Templates/tok 14 83886 276401 2026-05-20T03:24:35Z FuzzyBot 207 Automatically creating translation of category used on [[Template:Shortcut caption/tok]] 276401 wikitext text/x-wiki <languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> Templates on Wikifunctions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A list of uncategorized templates is available at [[Special:UncategorizedTemplates]]. </div> [[Category:Contents{{#translation:}}|Templates]] tv7pcrmmnw3c5rfwx6haxyzmla1ysll Category:Contents/tok 14 83887 276402 2026-05-20T03:24:36Z FuzzyBot 207 Automatically creating translation of category used on [[Category:Templates/tok]] 276402 wikitext text/x-wiki <languages/> <span lang="en" dir="ltr" class="mw-content-ltr">Root category for Wikifunctions.</span> ggcoyh2yrhaiw5bbhikqvl31947xaou Z35423 0 83888 276403 2026-05-20T03:24:58Z JJPMaster 6409 new implementation 276403 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35423" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35421", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z31098", "Z31098K1": { "Z1K1": "Z18", "Z18K1": "Z35421K4" }, "Z31098K2": { "Z1K1": "Z18", "Z18K1": "Z35421K1" }, "Z31098K3": { "Z1K1": "Z7", "Z7K1": "Z21389", "Z21389K1": { "Z1K1": "Z18", "Z18K1": "Z35421K2" }, "Z21389K2": { "Z1K1": "Z7", "Z7K1": "Z13633", "Z13633K1": { "Z1K1": "Z7", "Z7K1": "Z12681", "Z12681K1": { "Z1K1": "Z18", "Z18K1": "Z35421K1" } }, "Z13633K2": { "Z1K1": "Z7", "Z7K1": "Z12681", "Z12681K1": { "Z1K1": "Z18", "Z18K1": "Z35421K3" } } } }, "Z31098K4": { "Z1K1": "Z18", "Z18K1": "Z35421K3" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "apply3: common 2nd, list 1st and 3rd, replic comp" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } nm8u4x5pk23gmcsrlbcvcmzti8fc3s7 Z35424 0 83889 276407 2026-05-20T03:30:55Z JJPMaster 6409 276407 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35424" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35417", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "signbox" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "signbox" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35405", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "signbox" } }, "Z35421K4": "Z10193" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert signbox in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } nzft6wmop4uiv26stwhcnkhom0kacxp 276410 276407 2026-05-20T03:32:16Z JJPMaster 6409 276410 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35424" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35417", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "signbox" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "signbox" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35413", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "signbox" } }, "Z35421K4": "Z10193" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert signbox in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } mf434scxkj4kt0n8aqvovducyka3ee9 276411 276410 2026-05-20T03:32:59Z JJPMaster 6409 string casting 276411 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35424" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35417", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "signbox" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "signbox" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35413", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "signbox" } }, "Z35421K4": "Z10193" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert signbox in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 0hl8eguq0m5xtyw8wud23v6j671o2i5 276421 276411 2026-05-20T04:10:32Z JJPMaster 6409 use fallback 276421 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35424" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35417", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "all" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "signbox" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35413", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35417K1" }, "Z35400K2": "all" } }, "Z35421K4": "Z10193" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert signbox in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } fw2qwl39t58iev2cxe4uhcmq8arcww8 Help:Type conversion table/Boolean 12 83890 276409 2026-05-20T03:31:34Z YoshiRulz 10156 Create page 276409 wikitext text/x-wiki {{Help:Type conversion table/preface|Z40|Boolean}} |- | {{Z|10730}} | ⇥ ! {{Z|6}} | colspan="2" | |- | {{Z|22126}} | ⇥ ! rowspan="3" | {{Z|22112}} | ↦ | {{Z|32068}} |- | [[Z22126]] | ⇥ | ↦ | {{Z|29661}} |- | [[Z22126]] | ⇥ | ↦ | {{Z|22131}} |- | {{Z|17053}} | ⇥ ! {{Z|16659}} | ↦ | {{Z|16756}} |- | colspan="2" | ! rowspan="2" | {{Z|16683}} | ↦ | {{Z|17229}} |- | colspan="2" | | ↦ | {{Z|17204}} |} fm9jefp9ugnn7nbengja8cg7wjdddeh Z35425 0 83891 276412 2026-05-20T03:34:41Z JJPMaster 6409 276412 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35425" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35425K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35425" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert spatials in FSW string to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Applies Z35415 to the prefix of a Formal SignWriting string, leaving the rest unchanged." } ] } } 9m5rkxrx2uzfezwlgtgi8qfydfi299j 276414 276412 2026-05-20T03:35:54Z JJPMaster 6409 Added Z35426 to the approved list of implementations 276414 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35425" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": "Z35425K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "string" } ] } } ], "Z8K2": "Z6", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35426" ], "Z8K5": "Z35425" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert spatials in FSW string to SWU" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Applies Z35415 to the prefix of a Formal SignWriting string, leaving the rest unchanged." } ] } } r8f7n7iu4wmdf72ewby52d9rasiomgw Z35426 0 83892 276413 2026-05-20T03:35:35Z JJPMaster 6409 276413 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35426" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35425", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35425K1" }, "Z35400K2": "spatial" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "spatial" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35413", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35425K1" }, "Z35400K2": "spatial" } }, "Z35421K4": "Z10193" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert spatials in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } oi8wvrpvytjz5nrgl8c319517clju9z 276415 276413 2026-05-20T03:36:56Z JJPMaster 6409 fix 276415 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35426" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35425", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35425K1" }, "Z35400K2": "spatial" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "spatial" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35415", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35425K1" }, "Z35400K2": "spatial" } }, "Z35421K4": "Z10193" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert spatials in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 4oh4p5qlmtr6gp7auv36ney6oq380do 276430 276415 2026-05-20T04:38:19Z JJPMaster 6409 well that was dumb 276430 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35426" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35425", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z21394", "Z21394K1": { "Z1K1": "Z7", "Z7K1": "Z18475", "Z18475K1": { "Z1K1": "Z7", "Z7K1": "Z35421", "Z35421K1": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35425K1" }, "Z35400K2": "all" }, "Z35421K2": { "Z1K1": "Z7", "Z7K1": "Z35397", "Z35397K1": "spatial" }, "Z35421K3": { "Z1K1": "Z7", "Z7K1": "Z873", "Z873K1": "Z35415", "Z873K2": { "Z1K1": "Z7", "Z7K1": "Z35400", "Z35400K1": { "Z1K1": "Z18", "Z18K1": "Z35425K1" }, "Z35400K2": "all" } }, "Z35421K4": "Z10193" } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "convert spatials in FSW string to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } gwq6b50fmlmc09g7xcjiqzsxoms7mwj Talk:Z35400 1 83893 276424 2026-05-20T04:21:58Z Theki 2389 Created page with "[[Category:SignWriting]]" 276424 wikitext text/x-wiki [[Category:SignWriting]] igy8ilidapprm069gzbnelu7lapz40w Talk:Z35425 1 83894 276425 2026-05-20T04:22:28Z Theki 2389 Created page with "[[Category:SignWriting]]" 276425 wikitext text/x-wiki [[Category:SignWriting]] igy8ilidapprm069gzbnelu7lapz40w Category:SignWriting 14 83895 276426 2026-05-20T04:25:29Z Theki 2389 Created page with "Functions related to [[abstract:Q1497335|SignWriting]], a writing system for sign languages." 276426 wikitext text/x-wiki Functions related to [[abstract:Q1497335|SignWriting]], a writing system for sign languages. pis782q0xvmtqwudl4mdmn6o0o55cfn Z35427 0 83896 276431 2026-05-20T04:39:19Z JJPMaster 6409 276431 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35427" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35399", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z10174", "Z10174K1": { "Z1K1": "Z7", "Z7K1": "Z24331", "Z24331K1": { "Z1K1": "Z18", "Z18K1": "Z35399K1" } }, "Z10174K2": { "Z1K1": "Z7", "Z7K1": "Z29248", "Z29248K1": { "Z1K1": "Z18", "Z18K1": "Z35399K1" } } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z13351", "Z13351K1": [ "Z8", "Z35425", "Z35417", "Z35411" ], "Z13351K2": { "Z1K1": "Z18", "Z18K1": "Z35399K1" } }, "Z802K3": "" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "FSW to SWU, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 3c7o21qr22bn69omnrphpu2ykr8aes9 Translations:Template:Main page/News/31/de 1198 83897 276439 2026-05-20T06:14:13Z Ameisenigel 44 Created page with "$1: Eine höhere Bedeutung" 276439 wikitext text/x-wiki $1: Eine höhere Bedeutung 4lflkdqlc8nofp4remm7sifze5o2lnq Translations:Wikifunctions:Status updates/120/de 1198 83898 276441 2026-05-20T06:14:34Z Ameisenigel 44 Created page with "$1: Eine höhere Bedeutung" 276441 wikitext text/x-wiki $1: Eine höhere Bedeutung 4lflkdqlc8nofp4remm7sifze5o2lnq Translations:Wikifunctions:How to create implementations/317/en 1198 83899 276444 2026-05-20T06:15:24Z FuzzyBot 207 Importing a new version from external source 276444 wikitext text/x-wiki As of 2026-05, trying to return a list of lists may fail, so you're not able to implement such functions in code. 33n2z9chldyv8xgyp8lt7n90wmq7w26 Translations:Wikifunctions:Human languages/179/en 1198 83900 276468 2026-05-20T06:16:58Z FuzzyBot 207 Importing a new version from external source 276468 wikitext text/x-wiki Hausa, Igbo, Malayalam, Bangla/Bengali and Dagbani are [[$1|focus languages]] for Wikidata's lexicographic dataset, which is an important aspect of [[$2|Abstract Wikipedia]]. 53jnkf7ln6eiyy82tqdmbad6b4ea2kz Translations:Wikifunctions:Programming languages/20/en 1198 83901 276475 2026-05-20T06:20:22Z FuzzyBot 207 Importing a new version from external source 276475 wikitext text/x-wiki [[w:en:Lists of programming languages|Lists of programming languages]] at English Wikipedia. f4w3n73yq1abljkwi67m4cm21ba0kpf Translations:Wikifunctions:Programming languages/21/en 1198 83902 276476 2026-05-20T06:20:22Z FuzzyBot 207 Importing a new version from external source 276476 wikitext text/x-wiki [[$1|Compositions]] are a kind of LISPish language, but aren't covered here. 11oryb19n8ejy5go2am6unfiaixui4x Translations:Wikifunctions:Support for Wikidata content/213/en 1198 83903 276488 2026-05-20T06:21:40Z FuzzyBot 207 Importing a new version from external source 276488 wikitext text/x-wiki As noted in the introductory section, the word "reference" is overloaded. [[$1|<u>Wikidata reference</u>]], (6) above, is a Wikifunctions type that holds references to information sources, and appears in statements imported from Wikidata. The ''Wikidata reference types'', discussed in the next section, are also Wikifunctions types, but refer to Wikidata entities, and contain only Wikidata identifiers. isikqh7jxrgec4fbyym6kxmvocy1ix8 Translations:Wikifunctions:Tools/13/en 1198 83904 276503 2026-05-20T06:22:54Z FuzzyBot 207 Importing a new version from external source 276503 wikitext text/x-wiki [[$1|wikifunctionsanalytics]]: A simplified dump, queryable through [[$2|Quarry]]. kbmeitfu98la8h8bi9k1qwtexodc2qs Translations:Wikifunctions:Tools/14/en 1198 83905 276504 2026-05-20T06:22:55Z FuzzyBot 207 Importing a new version from external source 276504 wikitext text/x-wiki [[$1]]: Tracking Function usage on [[$2|Abstract Wikipedia]]. acdq9af74zp1hvjua6xic73buqm8uvi Translations:Wikifunctions:Type/46/en 1198 83906 276513 2026-05-20T06:23:18Z FuzzyBot 207 Importing a new version from external source 276513 wikitext text/x-wiki lightweight enum bvvd8tl8g8qipeqittm70hjts1aqf0n Z35428 0 83907 276577 2026-05-20T07:52:57Z YoshiRulz 10156 Create function 276577 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35428" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z39", "Z17K2": "Z35428K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "key" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "expression when key not present" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35428" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value by key or else" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } erdvcd9hb3kzvvtc9142i5vknq7wtct 276580 276577 2026-05-20T08:12:24Z YoshiRulz 10156 Added Z35429 and Z35430 to the approved list of test cases 276580 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35428" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z39", "Z17K2": "Z35428K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "key" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "expression when key not present" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35429", "Z35430" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35428" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value by key or else" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } qn88i1693m5ju47nub766i5ldzp01vh 276582 276580 2026-05-20T08:14:21Z YoshiRulz 10156 Added Z35431 to the approved list of implementations 276582 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35428" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z39", "Z17K2": "Z35428K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "key" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "expression when key not present" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35429", "Z35430" ], "Z8K4": [ "Z14", "Z35431" ], "Z8K5": "Z35428" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value by key or else" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 6j40mw97supxllzzvri6tt0dntxd9nl 276584 276582 2026-05-20T08:18:28Z YoshiRulz 10156 Added Z35432 to the approved list of implementations 276584 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35428" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z39", "Z17K2": "Z35428K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "key" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K2", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "object" } ] } }, { "Z1K1": "Z17", "Z17K1": "Z1", "Z17K2": "Z35428K3", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "expression when key not present" } ] } } ], "Z8K2": "Z1", "Z8K3": [ "Z20", "Z35429", "Z35430" ], "Z8K4": [ "Z14", "Z35431", "Z35432" ], "Z8K5": "Z35428" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value by key or else" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } t5gj7lmyk2q6g160uagdtygtizbeis6 Z35429 0 83908 276578 2026-05-20T08:02:10Z YoshiRulz 10156 Create test 276578 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35429" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35428", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35428", "Z35428K1": { "Z1K1": "Z39", "Z39K1": "Z60K2" }, "Z35428K2": "Z1039", "Z35428K3": [ "Z6", "mis" ] }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z889", "Z889K2": [ "Z6", "swh" ], "Z889K3": "Z866" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "(Z60K2, Z1039, [ \"mis\" ]) =\u003E [ \"swh\" ]" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 4tgmsh78pjgfrh0o0t3qidbltepjdj1 Z35430 0 83909 276579 2026-05-20T08:12:09Z YoshiRulz 10156 Create test 276579 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35430" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z35428", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z35428", "Z35428K1": { "Z1K1": "Z39", "Z39K1": "Z60K2" }, "Z35428K2": "Z1015", "Z35428K3": [ "Z6", "mis" ] }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z889", "Z889K2": [ "Z6", "mis" ], "Z889K3": "Z866" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "(Z60K2, Z1015, [ \"mis\" ]) =\u003E [ \"mis\" ]" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } gx3a55gsa4fumoqjjpjn6gna32zpiez Z35431 0 83910 276581 2026-05-20T08:13:40Z YoshiRulz 10156 Create implementation 276581 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35431" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35428", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z30433", "Z30433K1": { "Z1K1": "Z18", "Z18K1": "Z35428K2" }, "Z30433K2": { "Z1K1": "Z18", "Z18K1": "Z35428K1" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z803", "Z803K1": { "Z1K1": "Z18", "Z18K1": "Z35428K1" }, "Z803K2": { "Z1K1": "Z18", "Z18K1": "Z35428K2" } }, "Z802K3": { "Z1K1": "Z18", "Z18K1": "Z35428K3" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value by key or else, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } ae0yg3anxu5n4siftqi3qi12ikprpzn 276585 276581 2026-05-20T08:18:31Z YoshiRulz 10156 Disambiguate en label 276585 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35431" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35428", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z802", "Z802K1": { "Z1K1": "Z7", "Z7K1": "Z30433", "Z30433K1": { "Z1K1": "Z18", "Z18K1": "Z35428K2" }, "Z30433K2": { "Z1K1": "Z18", "Z18K1": "Z35428K1" } }, "Z802K2": { "Z1K1": "Z7", "Z7K1": "Z803", "Z803K1": { "Z1K1": "Z18", "Z18K1": "Z35428K1" }, "Z803K2": { "Z1K1": "Z18", "Z18K1": "Z35428K2" } }, "Z802K3": { "Z1K1": "Z18", "Z18K1": "Z35428K3" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value by key or else, conditional composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } a4pzke58bu8pn6tw4yzi9qafyf9fpp1 Z35432 0 83911 276583 2026-05-20T08:18:09Z YoshiRulz 10156 Create implementation 276583 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35432" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35428", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z850", "Z850K1": { "Z1K1": "Z7", "Z7K1": "Z803", "Z803K1": { "Z1K1": "Z18", "Z18K1": "Z35428K1" }, "Z803K2": { "Z1K1": "Z18", "Z18K1": "Z35428K2" } }, "Z850K2": "Z511", "Z850K3": { "Z1K1": "Z18", "Z18K1": "Z35428K3" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "value by key or else, try-catch composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } gz45uggnqcl64mweo2t5nnu8hwwqwbp Z35433 0 83912 276587 2026-05-20T08:20:46Z YoshiRulz 10156 Create function 276587 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35433" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z4", "Z17K2": "Z35433K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "type" } ] } } ], "Z8K2": "Z8", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14" ], "Z8K5": "Z35433" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "best equality function for Type" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 82ah8q6fr9mshshyp0hfq6h6tffqoqo 276590 276587 2026-05-20T08:22:13Z YoshiRulz 10156 Added Z35434 to the approved list of implementations 276590 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35433" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ "Z17", { "Z1K1": "Z17", "Z17K1": "Z4", "Z17K2": "Z35433K1", "Z17K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "type" } ] } } ], "Z8K2": "Z8", "Z8K3": [ "Z20" ], "Z8K4": [ "Z14", "Z35434" ], "Z8K5": "Z35433" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "best equality function for Type" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } byczq9dn3reqmqwwnfpixvf2niqj7hg Z35434 0 83913 276588 2026-05-20T08:21:43Z YoshiRulz 10156 Create implementation 276588 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35434" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z35433", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z35428", "Z35428K1": { "Z1K1": "Z39", "Z39K1": "Z4K4" }, "Z35428K2": { "Z1K1": "Z18", "Z18K1": "Z35433K1" }, "Z35428K3": "Z13052" } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "best equality function for Type, composition" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 3nrei2hpskvt8saugai7f9wg93bimnx Z35435 0 83914 276609 2026-05-20T10:11:28Z Winston Sung 2672 276609 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35435" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z32212", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z32212", "Z32212K1": { "Z1K1": "Z6091", "Z6091K1": "Q3270129" }, "Z32212K2": { "Z1K1": "Z6091", "Z6091K1": "Q738570" }, "Z32212K3": { "Z1K1": "Z6091", "Z6091K1": "Q8646" }, "Z32212K4": "Z1589" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1589", "Z11K2": "金鐘是香港的中心商務區" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "zh-Hant-HK 金鐘是香港的中心商務區" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } 0q7u30bc4582i8sjmeodyg8gfm39jgn 276610 276609 2026-05-20T10:11:53Z Winston Sung 2672 276610 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35435" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z32212", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z32212", "Z32212K1": { "Z1K1": "Z6091", "Z6091K1": "Q3270129" }, "Z32212K2": { "Z1K1": "Z6091", "Z6091K1": "Q738570" }, "Z32212K3": { "Z1K1": "Z6091", "Z6091K1": "Q8646" }, "Z32212K4": "Z1589" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1589", "Z11K2": "金鐘是香港的核心商業區" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "zh-Hant-HK 金鐘是香港的核心商業區" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } hv7uis06l43yq05si2zb2txlvyd03lw 276611 276610 2026-05-20T10:12:13Z Winston Sung 2672 276611 zobject text/plain { "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z35435" }, "Z2K2": { "Z1K1": "Z20", "Z20K1": "Z32212", "Z20K2": { "Z1K1": "Z7", "Z7K1": "Z32212", "Z32212K1": { "Z1K1": "Z6091", "Z6091K1": "Q3270129" }, "Z32212K2": { "Z1K1": "Z6091", "Z6091K1": "Q738570" }, "Z32212K3": { "Z1K1": "Z6091", "Z6091K1": "Q8646" }, "Z32212K4": "Z1589" }, "Z20K3": { "Z1K1": "Z7", "Z7K1": "Z14392", "Z14392K2": { "Z1K1": "Z11", "Z11K1": "Z1589", "Z11K2": "金鐘是香港的核心商業區。" } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ "Z11", { "Z1K1": "Z11", "Z11K1": "Z1672", "Z11K2": "zh-Hant-HK 金鐘是香港的核心商業區。" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ "Z31" ] }, "Z2K5": { "Z1K1": "Z12", "Z12K1": [ "Z11" ] } } aoqgqqk6jsstikfgw5q59bj7t0iin9g