Talk:Wikidata/Notes/Inclusion syntax v0.4
Property aliases
editThe use of the identifier of the property like is more stable as the label like . To improve stability it should also work for aliases like . In case a label changes, we could add the old label as alias. In that case the Wikipedia templates and modules still continue to function properly without the need to change it immediately. HenkvD (talk) 14:56, 18 May 2013 (UTC)
- You are correct that IDs are more stable than labels, and I would suggest to use IDs instead of labels -- but labels might be preferred due to their readability. It's a tradeoff. On the other hand, aliases are not necessarily unique, and thus we do not allow them for accessing values. Property labels thought are unique per language. --denny (talk) 14:45, 21 May 2013 (UTC)
- "Property labels thought are unique per language." I'm curious, is that automatically enforced (so there can never be two "capital" properties in the same language)? Superm401 | Talk 05:10, 26 May 2013 (UTC)
- Yes it is enforced. --Lydia Pintscher (WMDE) (talk) 09:00, 26 May 2013 (UTC)
- "Property labels thought are unique per language." I'm curious, is that automatically enforced (so there can never be two "capital" properties in the same language)? Superm401 | Talk 05:10, 26 May 2013 (UTC)
access a different item by label
editAs labels are not unique, I assume you mean article title. --Zolo (talk) 11:07, 19 May 2013 (UTC)
- Thanks for catching this, you are correct. --denny (talk) 14:45, 21 May 2013 (UTC)
Implement Copypaste.py as a parser function
editCould be possible to integrate Copypaste.py tool (here and here) as an inclusion parser function into mediawiki? The tool generates an interwiki list in wiki syntax from the Q number. Such function would be very helpful for Commons (until Commons will be integrated fully-fledged). Such syntax can be something like:
- {{#interwiki|Q183}}
- {{#interwiki|Germany}}
- {{#iw|de:Deutschland}}
Make inclusion human readable
editHave a look at https://www.wikidata.org/wiki/Wikidata_talk:Infoboxes_task_force#Make_embedding_data_in_wikipedia_human_readable --141.58.44.204 19:14, 25 August 2013 (UTC)
Refer to WP page links and titles?
editIs it possible to return the links to Wikipedia pages and titles of those pages for items? This would be very helpful on commons, where we could use it in templates like Commons:Template:Portrait of and make image descriptions interlingual. --Jfhutson (talk) 20:52, 27 October 2013 (UTC)
Accessing qualifiers for statements
editI added the actual version from wikidata to the dewiki article about Mozilla Firefox: https://de.wikipedia.org/w/index.php?title=Mozilla_Firefox&diff=125417237&oldid=125385804 and want to get the qualifier that sais the Version is from 2013-12-10 as well. --Lbenedix (talk) 20:05, 13 December 2013 (UTC)
release a good inclusion syntax now, otherwise wikidata is not used in wikipedia and WILL CERTAINLY die! --92.201.145.65 08:10, 27 February 2014 (UTC)
- I'm going to concur here. I popped into Wikidata to experiment with adding population data just for my hometown, and see if I could incorporate it into the en.wikipedia article. I found that I could invoke the population number, but there is nothing about how to incorporate the "as of" date. Whether the capability isn't there, or whether it just isn't documented, the data can't be used on Wikipedia, since the population data would get updated, but the metadata about that population number is divorced from the data to which it applies. Vanisaac (talk) 09:57, 3 July 2014 (UTC)
- Hi Vanisaac, can you explain this:
- The table tennis player de:Ma Long has a "current world ranking" number ("Aktueller Weltranglistenplatz") in the infobox, with ref
- Look at the wikitext, it's empty?
- Compare de:Vorlage:Infobox Tischtennisspieler and de:Modul:Wikidata
- Compare with the english en:Ma Long and wikitext
- Explain and discuss. --Atlasowa (talk) 11:21, 3 July 2014 (UTC)
- Well, Atlasowa, A) I don't take orders, B) does my comment have anything whatsoever to do with what you are asking?, and C) does my comment indicate in any way any sort of experience that would be germane to your command? Vanisaac (talk) 23:23, 5 July 2014 (UTC)
Seeing that the discussion is way off track, I will reiterate the request to use qualifiers in Wikipedia. Is there a way to incorporate qualifiers in WP articles? Like Vanisaac, I want to use the "point in time" qualifier for population numbers. If this isn't possible yet, this functionality should be added! --P199 (talk) 16:16, 17 July 2014 (UTC)
- It is possible using Lua. --Lydia Pintscher (WMDE) (talk) 16:31, 17 July 2014 (UTC)
- I have zero experience with Lua programming. Can you make a new module for this? Thanks. --P199 (talk) 16:43, 17 July 2014 (UTC)
- It would be great to see an example of a Lua script operating to retrieve and display wikidata data on a wikipedia page. Where could we see this? --Genewiki123 (talk) 23:34, 28 August 2014 (UTC)
- As an aside (perhaps), I'd add that trying to amend the wikidata value for population always results in a range figure, e.g. 47,357±1.
In addition there is no facility (that I can see) for actually adding any qualifier. --Unbuttered Parsnip (talk) 02:06, 13 November 2014 (UTC) - @Lydia Pintscher (WMDE): could you please answer this question? --Ilya (talk) 03:03, 15 October 2015 (UTC)
- As an aside (perhaps), I'd add that trying to amend the wikidata value for population always results in a range figure, e.g. 47,357±1.
- It would be great to see an example of a Lua script operating to retrieve and display wikidata data on a wikipedia page. Where could we see this? --Genewiki123 (talk) 23:34, 28 August 2014 (UTC)
- I have zero experience with Lua programming. Can you make a new module for this? Thanks. --P199 (talk) 16:43, 17 July 2014 (UTC)
@Lydia Pintscher (WMDE):
I'm trying to use {{#invoke:Wikidata|getQualifierValue|P348|P577|FETCH_WIKIDATA}}
in en:Akka (toolkit),
but it returns
Lua error in Module:Wikidata at line 155: attempt to concatenate field 'numeric-id' (a nil value). Backtrace: Module:Wikidata:155: in function "chunk" mw.lua:511: ?
--Ilya (talk) 03:22, 15 October 2015 (UTC)
- @Hoo man: Can you have a look please? --Lydia Pintscher (WMDE) (talk) 14:51, 23 October 2015 (UTC)
- @Ilya: The problem here is that the English Wikipedia's Module:Wikidata assumes all Qualifiers to be of type wikibase-item. Such things should be reported on the English Wikipedia, so that they can be fixed there. Cheers, Hoo man (talk) 17:10, 23 October 2015 (UTC)
Ahh question
editSo, {{#property:Pxxx}} will transclude into "" in two cases:
- The wikipedia article does not have a wikidata item.
- The wikipedia article has a wikidata item, but it does not have Pxxx property.
Is there a way to distinguish between the two, inside a wikipedia inclusion? Thanks Kotz (talk) 16:18, 11 August 2014 (UTC)
- Condition 1 is also a property (Wikimedia article)... Test that this property is defined. verdy_p (talk) 11:47, 17 August 2014 (UTC)
Properties of different items - redirects
editThe proposal to access properties of a different item doesn't deal with redirects. Can we suppose that non redirect page have its own item page and the statements will be included from the target page? Will even multiple redirect be fully functional? Or we need something like
{{#property:capital|of=Great Britain and Northern Ireland|noredirect}}
for a possible item page of the redirect page? --ŠJů (talk) 18:11, 17 August 2014 (UTC)
Inclusion and ParserFunctions
editHi,
I'm not sure if it's the right place but can someone explain me how this syntax works with the ParserFunctions ?
For instance, {{#expr: {{#property:P1082}} / 1000 }} doesn't work anywhere (apparently because of the formatting) but {{#time: Y | {{#property:P569}} }} works on the English Wikipedia but not on the others wikipedias!
And is there an other *simple* way to do that sort of simple calculation ? (it seems too simple to need to be done in Lua).
Cdlt, VIGNERON * discut. 13:41, 9 December 2014 (UTC)
- Output from wd is edited, so you need to unedit it before giving it to an expression:
{{#expr:{{formatnum:{{#property:P1082}}|R}} / 1000 }} --Unbuttered Parsnip (talk) 02:29, 19 December 2014 (UTC)- Ok but how do I unedit a time/date ? Cdlt, VIGNERON * discut. 08:07, 19 December 2014 (UTC)
- And if you're trying to get the year out of a date, in enwiki I think you need {{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y}} - not sure because I don't know what P569 is. --Unbuttered Parsnip (talk) 03:21, 19 December 2014 (UTC)
- My question was in general without any particular plan in mind for any Wikipedia. I was just hoping for a simple way to do a simple thing… (and inwoking a module is not « simple » ; I'm probably asking for too much). FYI: d:Property:P569.
- Cdlt, VIGNERON * discut. 08:07, 19 December 2014 (UTC)
Any projection?
editWondering when the |of=
might be working. --Unbuttered Parsnip (talk) 02:31, 19 December 2014 (UTC)
A question
editIs this the right way to use the property? I have used p18 just for trial.--Vyom25 (talk) 18:35, 17 January 2015 (UTC)
- Method is correct, but you're not seeing anything because parameters should be all lower-case. I'm not sure how to reach wikidata from that page to check database. --Unbuttered Parsnip (talk) 04:51, 12 March 2015 (UTC)
More inclusion possibilities?
editHi, I have a couple of questions:
- Is it possible to include the label of an item? I mean something like {{#label}} or {{#label|of=Q183}} (the last one returning 'Germany').
- If it is possible, can you also get the label in another langauge? Like {{#nl:label}} or something similar.
- Can you choose to use the value of a property other than the one with the preferred rank?
- Is it possible to create a link of the property? E.g. would return [[Berlin]] instead of Berlin.
- Is it possible to include qualifiers and references?
- Can you strip '±1' from numerals?
Thanks. Thayts (talk) 11:29, 7 March 2015 (UTC)
- ("couple" = 2 !)
- (1) That's probably a parser function, not WD, like {{PAGENAME}}
- (3) I think you get all of them as csv list
- (4) just enclose it in [[ ]] -- [[{{#property:capital|of=Q183}}]] (but
|of=
not working). - (6) best not to enter range in the first place. E.g. enter population as 12345+-0
- -- Unbuttered Parsnip (talk) 04:47, 12 March 2015 (UTC)
- Enclosing it in [[ ]] will only work if the page name is unique, otherwise it will create a link to a disambiguation page. --Arctic.gnome (talk) 04:02, 22 April 2015 (UTC)
Order of values
editI understand that inclusion prints the same order (of values) that exists in Wikidata (which is not changeable). Is there a plan for a feature even for simple(r) ordering such as numeric/alphabetic? For example, signatory (P1891) will very often have many values for a given item, so it would be nice to order them in a more logical manner. If this system already exists, that would be even better. Thanks, Hazmat2 (talk) 22:43, 24 May 2015 (UTC)
how to access aliases?
editHow can you retrieve the aliases (alternate names) for a wikidata item for display in Wikipedia?--I9606 (talk) 14:37, 10 September 2015 (UTC)
Nesting
edit{{#property:officeholder|from=Q3337598}} correctly returns the name of the Member of Parliament for Eastleigh Constituency (item Q3337598). But I'd also like to return the political party that officeholder belongs to, which is a property of the officeholder item not the constituency item - so something like this {{#property:P102|from={{#property:officeholder|from=Q3337598}}}} should do the trick. Is there an intention to enable nesting of properties in the inclusion syntax in this way, or equivalent syntax to do the same job? Waggers (talk) 12:55, 2 December 2015 (UTC)
- I also need a way to do this. I do not see the answer in documentation or discussion of existing lua modules. --MCEllis (talk) 01:03, 14 February 2016 (UTC)
- Note: various Wikis now have Lua modules for doing various types of Wikidata queries, e.g. en:Module:Wikidata. --Bdijkstra (talk) 15:42, 12 August 2016 (UTC)
Draft?
editThis has been a draft for 9 years. Can we at some point get actual released documentation of how the #property parser function works? -- Ahecht (TALK
PAGE) 19:41, 2 May 2022 (UTC)