Module talk:WikidataIB: Difference between revisions

Content deleted Content added
Can't get this working: are extra parameters that have to be enabled
 
Line 1:
{{Permanently protected}}
== Testing ==
{{WPBS|
{{WikiProject Wikidata}}
}}
{{banner holder|text=Page history|1=
{{oldtfdfull|date= 2020 September 15 |result=keep |disc=Module:Wikidata Infobox}}
}}
{{to-do|collapsed=yes}}
{{archives|search=yes}}
{{User:MiszaBot/config
|archiveheader = {{talkarchivenav}}
|maxarchivesize = 75K
|counter = 8
|minthreadsleft = 3
|minthreadstoarchive = 1
|algo = old(60d)
|archive = Module talk:WikidataIB/Archive %(counter)d
}}
 
==Multiple qualifiers==
Let's see how this would work in [[Animal farm]], [[d:Q1396889]].
Is there a way to filter a property with many values by two or more qualifiers? [[User:Serresmap|Serresmap]] ([[User talk:Serresmap|talk]]) 00:18, 10 April 2024 (UTC)
 
:@[[User:Serresmap|Serresmap]]: I don't think so. I recommend using [[Module:Wd]] instead, e.g. <code><nowiki>{{#invoke:wd|properties|Q55|P7295|P518=Q762943|P1365=Q11184}}</nowiki></code>. [[User:LennardHofmann|LennardHofmann]] ([[User talk:LennardHofmann|talk]]) 12:55, 12 April 2024 (UTC)
=== Local parameter ===
<pre>
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |Fred Bloggs}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=author; number_of_pages |name=author}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=author; number_of_pages; |name=author |Freda Bloggs}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=author; number_of_pages |name=author |suppressfields=author}}<
</pre>
 
==Option to get 'raw value'==
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50}}<
There should be an option to get '''raw value''' of a wikidata item using this module, similar to what we get from {{code|{{wikidata{{!}}property{{!}}raw{{!}}...}}}}.
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |Fred Bloggs}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=author; number_of_pages |name=author}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=author; number_of_pages; |name=author |Freda Bloggs}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=author; number_of_pages |name=author |suppressfields=author}}<
 
Absence of this option makes the template difficult to be used in infoboxes which require some wikidata property of a wikidata item which in turn is specified by some property of the given {{para|qid}}.
=== Only sourced ===
<pre>
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |onlysourced=no}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |onlysourced=yes}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P166 |fetchwikidata=ALL |name=awards |onlysourced=}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P166 |fetchwikidata=ALL |name=awards |onlysourced=no}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P166 |fetchwikidata=ALL |name=awards |onlysourced=yes}}<
</pre>
 
This is necessary in order to comply with [[Wikipedia:Wikidata/2018 Infobox RfC | this RFC]] and [[Wikipedia:Wikidata#Appropriate_usage_in_articles|this list of RFCs]] which make it mandatory to use {{tl|Wdib}} with {{para|osd|true}} in infoboxes.
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |onlysourced=no}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |onlysourced=yes}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P166 |fetchwikidata=ALL |name=awards |onlysourced=}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P166 |fetchwikidata=ALL |name=awards |onlysourced=no}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P166 |fetchwikidata=ALL |name=awards |onlysourced=yes}}<
 
An example requirement is {{para|mla}} of {{tl|Infobox Indian Constituency (wd)}}. [[User Talk:Riteze|<span style="color:green;">Riteze</span>]] 08:19, 4 March 2025 (UTC)
=== No icon ===
<pre>
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |noicon=}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |noicon=no}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |noicon=yes}}<
</pre>
 
== open and close quotation mark ==
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |noicon=}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |noicon=no}}<
# >{{#invoke:WikidataIB |getValue |qid=Q1396889 |P50 |fetchwikidata=ALL |name=author |noicon=yes}}<
 
Many of [[Quotation mark]]s have opening and closing, so both open and close quotation mark should be able to specified in [[Module:WikidataIB/titleformats|/titleformats]]. [[User:FlatLanguage|FlatLanguage]] ([[User talk:FlatLanguage|talk]]) 18:54, 26 March 2025 (UTC)
== Coordinates ==
:Please see [[MOS:CURLY]]. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 01:57, 27 March 2025 (UTC)
 
::/titleformats is for i18n, so projects other than enwiki should be considered. --[[User:FlatLanguage|FlatLanguage]] ([[User talk:FlatLanguage|talk]]) 01:59, 27 March 2025 (UTC)
Just to note that it would be nice to be able to set the coordinates to display both inline and in the title (passing "|display=inline,title" to {{tl|coord}}); this module just seems to allow inline coordinates. Thanks. [[User:Mike Peel|Mike Peel]] ([[User talk:Mike Peel|talk]]) 17:37, 18 December 2016 (UTC)
 
== Can't get this working ==
 
{{Wikidata property|P176}}
About [[:en:Prussian P 10]], item: {{Q|Q882458}}. It has P176=Borsig (Company). So Wikidata seems OK.
 
In this case I test:
-<nowiki>{{#invoke:WikidataIB|getValue|qid=Q882458|P176}}</nowiki>-
Returns empty string: -{{#invoke:WikidataIB|getValue|qid=Q882458|P176}}-
 
Also, when previewing in article page itself (no {{para|qid}} used), it returns a blank. Am I missing something? -[[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 17:32, 15 January 2017 (UTC)
 
: Remember that this is designed for use in an infobox, therefore there are extra parameters that have to be enabled otherwise it won't return anything. The call matches the name of the field you're using it in with a list of fields that are to enabled ("whitelisted"). What you call the field doesn't matter as long as it's on the whitelist. So you can use:
:* <code><nowiki>{{#invoke:WikidataIB |getValue |qid=Q882458 |P176 |name=def |fetchwikidata=abd, def, ghi, jkl, etc}}</nowiki></code> → {{#invoke:WikidataIB |getValue |qid=Q882458 |P176 |name=def |fetchwikidata=abd, def, ghi, jkl, etc}}
: And it will return {{Q|P176}} for {{Q|Q882458}}. I'll miss out the qid in the first part of the following examples as you won't need it other than for testing on pages like this.
: Rather than having to list every fieldname on the whitelist, you can use "ALL". So the call you probably want is something like:
:* <code><nowiki>{{#invoke:WikidataIB |getValue |P176 |name=manufacturer |fetchwikidata=ALL}}</nowiki></code> → {{#invoke:WikidataIB |getValue |qid=Q882458 |P176 |name=manufacturer |fetchwikidata=ALL}}
: Although if you're designing an infobox, you'll probably want to pass the whitelist (and blacklist) as parameters so the article editor supplies them once and the infobox passes them to each call in the design. Lets say we give them the names {{para|whitelist}} and {{para|blacklist}}. Then the code in the infobox design for the 'Manufacturer' field would be:
:* <code><nowiki>{{#invoke:WikidataIB |getValue |P176 |name=manufacturer |fetchwikidata={{{whitelist|}}} |suppressfields={{{blacklist|}}} ||{{{manufacturer|}}} }}</nowiki></code>
: The second unnamed parameter allows a local parameter (called 'manufacturer' in this case) to override the Wikidata call as ususal.
: The infobox in use in an article could look something as simple as:
<pre style="margin-left:1.7em; line-height:1.2em;">
{{infobox something
| whitelist = ALL
}}
</pre>
Does that make sense? Let me know if you're still having problems. Cheers --[[User:RexxS|RexxS]] ([[User talk:RexxS|talk]]) 02:02, 16 January 2017 (UTC)