Mediawiki and Wikidata - mediawiki

What does it mean:
"On a page that is connected to a Wikidata item via the interwiki links, you can use the function by adding the label of the property you want in your language or the P-number of the property. The code has to be added in the wikicode.
{{#statements:member of political party}} or {{#statements:P102}} will return the "member of political party" value.
"?
As far as I understood interwiki links are simply a special kind of link, they don't act on page level and they don't modify the behaviour of the page.
https://www.wikidata.org/wiki/Wikidata:How_to_use_data_on_Wikimedia_projects#Direct_access

Every Wikipedia article can be connected to a Wikidata item. Interwiki links these days are mostly automatically generated between articles in different languages connected to the same Wikidata item. {{#statements}} and similar functions pull information from the connected Wikidata item.
Non-Wikimedia wikis do not have similar features currently; Wikidata integration requires direct database access.

Related

URL to an unnamed part of a web page

I'd like to refer to a specific part of a web page which I am not the author of, and which is not tagged with the NAME attribute. The specification of the part I have in mind could be made, e.g., as the location a certain word appears, and which could be manually reached via a FIND operation. I imagine something like
http://somesite.com#search-for:foo-bar
Is there some feature in HTML allowing for this?
No.
You can only link to elements with an id and a elements with a name.

Infobox company, website parameter autocalculated?

Check this company infobox on Microsoft wiki page on the right hand side
at https://en.wikipedia.org/wiki/Microsoft
Clearly it has parameter website with value as www.microsoft.com
but when I try to see its wiki source code. I dont see any reference to this key value pair. Why is that? Is it autocalculated?
After subsidiary it has directly footnote section as follows.
| subsid = [[List of mergers and acquisitions by Microsoft|List of Microsoft subsidiaries]]
| footnotes ={{cite web|url=http://www.microsoft.com/en-us/Investor/annual-reports.aspx|title=Microsoft Corporation Annual
What am I missing here
If a Wikipedia article doesn't specify a value for the website (or homepage) parameter, the infobox_company template will try to retrieve this data from Wikidata.
It does this by using the {{#property}} parser function and querying for the value of the official website (P856) property on the Wikidata item that's linked to the article on which the infobox appears.
So, in order for this to work, an article must have a linked Wikidata item, and that item must have a value for the above property.

How to get the name of a Wikidata item within wikicode?

Let's say I have a Wikidata item QID Q19675, and want to get the name of that item in Spanish within the wikicode of an unrelated Mediawiki page.
While getting a property like P281 postal code is easy (just write {{#property:P281|from=Q19675}}), how to get the name, which for some reason is not a normal property?
Unlike this question, this time I am not looking for a REST API, but for a Mediawiki wikicode expression.
You can use the Lua function mw.wikibase.label to get the label in the local language. If you're on a wiki that has a copy of the Wikidata template Label (e.g. the English Wikipedia), you can use that directly: {{label|Q19675}}.
If you want the label in a language other than local, use mw.wikibase.entity:getLabel.

Getting talk page title using mediawiki API

Is there any way to fetch the talk page title of a given page title through MediaWiki API?
I know that I can get talkid using prop=info. But the problem is that there is no pageid for a talk page that does not exist yet. Also there are some obvious ways to get talk page title by adding a prefix to subject title, but it seems to me that they are all language/setup dependent...
leo's answer: So, given a title, that might not exist, you want to know what the talk page would be if the page was created, in a wiki with custom namespaces that you do not know? Then I would just have grabbed the list of all namespaces from the API: http://www.mediawiki.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces, and looked my prefix up there. The talk page namespace will be in NS+1.
(Posted as community wiki so that this question isn't listed as unanswered.)

mediawiki api. how to chose page from response

When I make api query sometimes I have list with few pages. For example
http://en.wikipedia.org/wiki/Ask gives a lot of pages, I need website "Ask.com, a web search engine, formerly Ask Jeeves"
can I make query only for some category ("websites")?
How I can check category for each page in response?
Thanks
There is no trivial way to do what you're asking. You could do something like this:
Get the list of pages the disambiguation page list. You could do this by listing the links on that page (action=query&prop=links).
Get the categories of all the pages from the previous step and use that to decide which one is the one you're looking for. This is not that simple, because Ask.com is not directly in Category:Websites, it's in one of its subcategories.
I have list with few pages, for example http://en.wikipedia.org/wiki/Ask
The problem is that you're not getting a list of pages, you just are getting an ordinary page which is in the disambiguation pages category. To get the list, you need to get the links in that page.
can I make query only for some category ("websites")?
No, mediawiki does not support that.
How I can check category for each page in response?
Use the links property as a title list generator and get the categories of each page in the response. In your case, that would be http://en.wikipedia.org/w/api.php?action=query&titles=Ask&generator=links&prop=categories (don't forget to continue the query).
If you are OK with "full-text search" for "ask",
you can do that like this:
http://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrsearch=ask%20incategory:%22Online%20companies%22&prop=info
As you can see, "search" text is [ask incategory:"Online companies"]
The same solution also can be seen at:
Wikipedia API: how to search for a term in a specific category