Modifica di
Modulo:WikidataIB/doc
(sezione)
Vai alla navigazione
Vai alla ricerca
Attenzione:
non hai effettuato l'accesso. Se effettuerai delle modifiche il tuo indirizzo IP sarΓ visibile pubblicamente. Se
accedi
o
crei un'utenza
, le tue modifiche saranno attribuite al tuo nome utente, insieme ad altri benefici.
Controllo anti-spam.
NON
riempirlo!
== Utility functions == === Function getLink === getLink has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid= If there is a sitelink to an article on the local Wiki, it returns a link to the article with the Wikidata label as the displayed text. If there is no sitelink, it returns the label as plain text. If there is no label in the local language, it displays the qid instead. : Wikidata: {{q|Q29016906}} and {{q|Q3621491}} * <code><nowiki>{{#invoke:WikidataIB |getLink |Q29016906}}</nowiki></code> β {{#invoke:WikidataIB |getLink |Q29016906}} * <code><nowiki>{{#invoke:WikidataIB |getLink |Q3621491}}</nowiki></code> β {{#invoke:WikidataIB |getLink |Q3621491}} === Function getLabel === getLabel has the qid of a Wikidata entity passed as the first unnamed parameter or as {{para|qid}} It returns the Wikidata label in the local language for an item by the given qid. If there is no label in the local language, it returns the qid instead. Note that this is the label given to the Wikidata entry in the same language as the current Wiki, if the label exists. : Wikidata: {{q|Q29016906}} and {{q|Q3621491}} * <code><nowiki>{{#invoke:WikidataIB |getLabel |Q29016906}}</nowiki></code> β {{#invoke:WikidataIB |getLabel |Q29016906}} * <code><nowiki>{{#invoke:WikidataIB |getLabel |Q3621491}}</nowiki></code> β {{#invoke:WikidataIB |getLabel |Q3621491}} * <code><nowiki>{{#invoke:WikidataIB |getLabel |Q19805408}}</nowiki></code> β {{#invoke:WikidataIB |getLabel |Q19805408}} === Function label === label has the qid of a Wikidata entity passed as the first unnamed parameter or as {{para|qid}} It returns the Wikidata label in the local language for an item by the given qid or linked to the current page. If there is no label in the local language, it returns an empty string. Note that this is the label given to the Wikidata entry in the same language as the current Wiki, if the label exists. : Wikidata: {{q|Q29016906}} and {{q|Q3621491}} * <code><nowiki>{{#invoke:WikidataIB |label |Q29016906}}</nowiki></code> β {{#invoke:WikidataIB |label |Q29016906}} * <code><nowiki>{{#invoke:WikidataIB |label |Q3621491}}</nowiki></code> β {{#invoke:WikidataIB |label |Q3621491}} * <code><nowiki>{{#invoke:WikidataIB |label |Q19805408}}</nowiki></code> β {{#invoke:WikidataIB |label |Q19805408}} === Function getAT === getAT has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid= If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text, i.e. the article title. If there is no sitelink, it returns nothing. Note that this is the title of the article in the current Wikipedia, if the interlanguage link exists in the Wikidata entry. : Wikidata: {{q|Q29016906}} and {{q|Q3621491}} * <code><nowiki>{{#invoke:WikidataIB |getAT |Q29016906}}</nowiki></code> β {{#invoke:WikidataIB |getAT |Q29016906}} * <code><nowiki>{{#invoke:WikidataIB |getAT |Q3621491}}</nowiki></code> β {{#invoke:WikidataIB |getAT |Q3621491}} === Function getDescription === getDescription has the qid of a Wikidata entity passed as |qid= (it defaults to the associated qid of the current article if omitted). It has a local parameter passed as the first unnamed parameter. Any local parameter passed (other than "Wikidata" or "none") becomes the return value. It returns the article description for the Wikidata entity in plain text if the local parameter is "Wikidata". Nothing is returned if the description doesn't exist or "none" is passed as the local parameter. : Wikidata: {{q|Q29016906}} and {{q|Q3621491}} * <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |wikidata}}</nowiki></code> β {{#invoke:WikidataIB |getDescription |qid=Q29016906 |wikidata}} * <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |A painting}}</nowiki></code> β {{#invoke:WikidataIB |getDescription |qid=Q29016906 |A painting}} * <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |none}}</nowiki></code> β {{#invoke:WikidataIB |getDescription |qid=Q29016906 |none}} * <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |wikidata}}</nowiki></code> β {{#invoke:WikidataIB |getDescription |qid=Q3621491 |wikidata}} * <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |A profession}}</nowiki></code> β {{#invoke:WikidataIB |getDescription |qid=Q3621491 |A profession}} * <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |none}}</nowiki></code> β {{#invoke:WikidataIB |getDescription |qid=Q3621491 |none}} === Function formatDate === formatDate accepts a datetime of the usual format from mw.wikibase.entity:formatPropertyValues, like "1 August 30 BCE" as parameter 1 and formats it according to the df (date format) and bc parameters. * <code><nowiki>{{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BCE |df=dmy}}</nowiki></code> β {{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BCE |df=dmy}} * <code><nowiki>{{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BC |df=mdy}}</nowiki></code> β {{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BC |df=mdy}} * df = "dmy" / "mdy" / "y" - default is "dmy" * bc = "BC" / "BCE" - default is "BCE" === Function checkBlacklist === checkBlacklist allows a test to check whether a named field is allowed. It returns true if the field is not blacklisted (i.e. allowed) It returns false if the field is blacklisted (i.e. disallowed) Example: * <code><nowiki>{{#if:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}</nowiki></code> β {{#if:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}} * <code><nowiki>{{#if:{{#invoke:WikidataIB |checkBlacklist |name=birth_place |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}</nowiki></code> β {{#if:{{#invoke:WikidataIB |checkBlacklist |name=birth_place |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}} === Function emptyor === emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags otherwise it returns the argument unchanged (including leading/trailing space). If the argument could contain "=", then it must be called explicitly: * <code><nowiki>| 1 = whatever-the-argument-is</nowiki></code> In that case, leading and trailing spaces are trimmed. It finds use in infoboxes where it can replace tests like: * <code><nowiki>{{#if: {{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}} | <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> | }}</nowiki></code> with a form that uses just a single call to Wikidata: * <code><nowiki>{{#invoke |WikidataIB |emptyor |1= <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> }}</nowiki></code> === Function labelorid === labelorid is a public function to expose the output of labelOrId(). The Q-number (entity ID) is passed as |qid= or as an unnamed parameter. It returns the Wikidata label for that entity or the qid if no label exists. === Function getQid === * getQid works with the current page and its associated Wikidata entry. * It returns qid, if supplied as the first unnamed parameter or as {{para|qid}}; * failing that, the Wikidata entity ID of the "category's main topic (P301)", if it exists; * failing that, the Wikidata entity ID associated with the current page, if it exists; * otherwise, nothing === Function examine === examine provides a dump of the entire property given in the first unnamed parameter (or in {{para|pid}} as a named alias) from the item given by the parameter 'qid', or from the item corresponding to the current page if qid is not supplied. Both parameters may be unnamed and given in any order. It works in a similar manner to the [[Module:Wikidata|Dump]] function, but only loads a single claim, rather than the whole Wikidata entry. * Example: <code><nowiki>{{#invoke:WikidataIB |examine |qid=Q1396889 |P50}}</nowiki></code> There is a [[Template:Examine]] which acts as a wrapper for the call. * Example: <code><nowiki>{{examine |Q4048254 |P31}}</nowiki></code> β {{examine |Q4048254 |P31}} === Function url2 === url2 takes a parameter url= that is a proper url and formats it for use in an infobox. Examples: {{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= http://www.example.com/ }}</nowiki> }}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= http://www.example.com/path/ }}</nowiki> }}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= {{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}} }}</nowiki> }}{{nowiki template demo|prefix=#:|format=inline|output=nowiki+|code=<nowiki>{{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}}</nowiki> }}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= {{url|http://www.example.com/}} }}</nowiki> }} Comparison with output of {{tl|URL}}: {{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | http://www.example.com/ }}</nowiki> }}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | http://www.example.com/path/ }}</nowiki> }}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | {{wikidata|property|Q23317|P856}} }}</nowiki> }}{{nowiki template demo|prefix=#:|format=inline|output=nowiki+|code=<nowiki>{{wikidata|property|Q23317|P856}}</nowiki>}} ==== See also ==== * {{ml|URL|url}} & {{ml|URL|url2}}
Oggetto:
Per favore tieni presente che tutti i contributi a Tematiche di genere si considerano pubblicati nei termini d'uso della licenza Creative Commons Attribuzione-Condividi allo stesso modo (vedi
Tematiche di genere:Copyright
per maggiori dettagli). Se non desideri che i tuoi testi possano essere modificati e ridistribuiti da chiunque senza alcuna limitazione, non inviarli qui.
Inviando il testo dichiari inoltre, sotto tua responsabilitΓ , che Γ¨ stato scritto da te personalmente oppure Γ¨ stato copiato da una fonte di pubblico dominio o similarmente libera.
Non inviare materiale protetto da copyright senza autorizzazione!
Annulla
Guida
(si apre in una nuova finestra)
Menu di navigazione
Strumenti personali
Accesso non effettuato
discussioni
contributi
entra
Namespace
Modulo
Discussione
italiano
Visite
Leggi
Modifica sorgente
Cronologia
Altro
Navigazione
Pagina principale
Ultime modifiche
Categorie
Principali Categorie
Pagine orfane
Pagine prive di categorie
Semantic Ask
Una pagina a caso
Aiuto su MediaWiki
Modifica Sidebar
Strumenti
Puntano qui
Modifiche correlate
Carica un file
Pagine speciali
Informazioni pagina