Jump to content
Menyu yikuru
Menyu yikuru
move to sidebar
kubisa
Mayendelo
Jani likulu
Vidumbizgano vya chikaya
Vakuchitika vasono
Kusintha kuphya
Jani lililose
Wovwili
To Do
Vyakuti vinozgeke
Vinyake
Mafumbo
Mazgo ghakomi
Helpful Pages (Wovwili)
Need for Fix
Need for Review
Admin Pages
Home pages
Home templates
Kufufuza
Kufufuza
Kaonekelo
Chakupeleka
Panga akaunti
Njila
Vilwelo vyako
Chakupeleka
Panga akaunti
Njila
Pages for logged out editors
learn more
vyakulemba
Pakuchezgela
Kulemba
Module:ResolveEntityId/doc
Sazgapo viyowoyelo
Module
Kudumbizgana
chiTumbuka
Ŵelengani
Kulemba source
Kuona umo mayambilo
Vilwelo
Vilwelo
move to sidebar
kubisa
Vyakuchita
Ŵelengani
Kulemba source
Kuona umo mayambilo
Vya masiku ghose
Ivo vikwiza pano
Vyaku sintha
Kwezgela chinthu
Va jani lino
Penjani URL yakufupikizgika
Sangululani kodi ya QR
Kaonekelo
move to sidebar
kubisa
Chenjezgo:
Mundanjile mu akaunti yinu. Pala mulembenge chilichose IP adilesi yinu waliyose waionenge. Pala
mwanjila
mu akaunti yinu
panji
mwapanga akaunti
, vyakulemba vinu vyose viŵenge mu zina linu, na uwemi unyake.
Anti-spam check. Do
not
fill this in!
{{Module rating |beta}} {{High-risk|~1200000}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> == Usage == Functions similarly to [[:mw:Extension:Wikibase_Client/Lua#mw.wikibase.resolvePropertyId|mw.wikibase.resolvePropertyId]], but for [[:wikidata:|Wikidata]] [[:mw:Extension:Wikibase_Client/Lua#mw.wikibase.entity|entities]] instead of properties. Returns an entity id for the given label or id. This allows using the entity's labels instead of ids in all places. If no entity was found for the label or id, or if the label is ambiguous, a nil value is returned. When attempting to resolve a label, only entities with English Wikipedia sitelinks are considered in the search. If a label exists in Wikidata, but does not have the requisite language sitelink, a nil value is returned. === Call from within a module (_id) === Example calls within a module might look like the following: {| class="wikitable" |+ style="text-align:left"| !Code !! Result !! Notes |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('Q42')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|Q42|'''nil'''}}</code> | "Q42" is a valid Wikidata ID, and a Wikidata items exists with that Id, so it is therefore returned intact |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('Q0')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|Q0|'''nil'''}}</code> | "Q0" is not a valid Wikidata ID, and while the Wikipedia article [[Q0]] exists, it is a disambiguation page, so <code>'''nil'''</code> is returned |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('Q404')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|Q404|'''nil'''}}</code> | "Q404" is a Wikidata redirect to Q395, so the latter is returned |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('Q2147483647')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|Q2147483647|'''nil'''}}</code> | Q2147483647 is a valid Wikidata ID, but no entity exists with that ID, so <code>'''nil'''</code> is returned |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('Douglas Adams')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|Douglas Adams|'''nil'''}}</code> | The article [[Douglas Adams]] exists and has the Wikidata ID "Q42", so that is returned. |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('ThisIsNotARealWikidataItem')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|ThisIsNotARealWikidataItem|'''nil'''}}</code> | "ThisIsNotARealWikidataItem" is not a valid Wikidata ID, and no Wikipedia article exists at [[ThisIsNotARealWikidataItem]], so <code>'''nil'''</code> is returned |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('ThisIsNotARealWikidataItem', 'Wikidata ID not found!')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|ThisIsNotARealWikidataItem|'Wikidata ID not found!'}}</code> | Same as above, but the custom error message <code>Wikidata ID not found!</code> is returned |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('Douglas adams')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|Douglas adams|'''nil'''}}</code> | "Douglas adams" is not a valid Wikidata ID, and while [[Douglas adams]] (with a lower-case "a") exists, it is a redirect to [[Douglas Adams]]. Therefore the Wikidata ID for the latter page is returned |- |<syntaxhighlight lang="lua">local resolveEntityId = require( "Module:ResolveEntityId" )._id id = resolveEntityId('Wikipedia:Village pump (technical)/Archive 1')</syntaxhighlight> |style="vertical-align: mid;"|<code>id</code> = <code>{{#invoke:ResolveEntityId|entityid|Wikipedia:Village pump (technical)/Archive 1|'''nil'''}}</code> | "Wikipedia:Village pump (technical)/Archive 1" is not a valid Wikidata ID, and while [[Wikipedia:Village pump (technical)/Archive 1]] exists, it does not have a Wikidata ID, so <code>'''nil'''</code> is returned |} === Use from within a template (entityid) === The following will return the entity id (or nothing if the ID doesn't exist): <code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|entityid|''id''}}</code> The following will return the entity id (or the alternate text if the ID doesn't exist): <code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|entityid|''id''|''alternate text if ''id'' is '''nil'''''}}</code> === Former _entityid function=== The <code>_entityid</code> function, which required that the frame be passed as the first argument, has been removed from the module because workarounds are no longer needed for [[:phab:T143970]]. <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | | <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Wikidata modules]] }}</includeonly>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Kuleka
Wowili wakalembelo
(julani mu windo lanyuwani)
Preview page with this template
Wikidata entities used in this page
Q2147483647
: Miscellaneous (e.g. aliases, entity existence)
HTTP 404
: Miscellaneous (e.g. aliases, entity existence), Title
Douglas Adams
: Miscellaneous (e.g. aliases, entity existence), Title
Nkhwaska zagwiliskika apa:
Douglas Adams
(
lemba
)
Douglas adams
(
lemba
)
Q0
(
lemba
)
ThisIsNotARealWikidataItem
(
lemba
)
Wikipedia:Village pump (technical)/Archive 1
(
lemba
)
Template:High-risk
(
lemba
)
Template:High-use
(
lemba
)
Template:Module rating
(
lemba
)
Module:High-use
(
lemba
)
Module:Message box
(
lemba
)
Module:Message box/configuration
(
lemba
)
Module:Message box/ombox.css
(
lemba
)
Module:ResolveEntityId
(
lemba
)
Module:Transclusion count
(
lemba
)
Module:Transclusion count/data/R
(
lemba
)
Module:Yesno
(
lemba
)
Kufufuza
Kufufuza
Kulemba
Module:ResolveEntityId/doc
Sazgapo viyowoyelo
Add topic