TL;DR: The ONLY practical solution today it to use Lua. This sucks,but it works and scale well [in WP sense] - hewiki uses it heavily in infoboxs - to show list of actors in movies, or musical band members etc.
Long version: Actually, specifically for list of presidents you don't need bot. Here is how to do it in Lua more or less (in pseudo code): local countryEntity = mw.wikibase.getEntity('Q30') --note: you can get the country from property/current entity to be generic local presidents= countryEntity:getBestStatements('P6') --note: you can get this as a parameter local output = '' for i, property in ipairs(propertyVals) do local propValue = property.mainsnak and property.mainsnak.datavalue -- parse it to the desired output... end
(A real world usage example: https://he.wikipedia.org/wiki/%D7%99%D7%97%D7%99%D7%93%D7%94:PropertyLink?us... in function: getProperty)
Why this is good: 1. It is the only practical way to query wikidata from Wikipedia. [bots aren't practical - 1. They are less accessible to common users. 2. Some use cases requires to run the query and update every 4/5 years when list of governors is updated] 2. It is generic enough to work in different countries and different lists 3. Users can easily use it with with syntax such as {{#invoke:LuaModule|listOf|Q30|P6}} or as templates, and are unaware to the implementation
Why it sucks: 1. Because it is ugly Lua code 2. This just moves the problem to Wikidata [have to maintain Q30.P6 using bots/humans instead of queries] 3. It is limited to simple lists (you can't have list of Republican presidents - because it requires additional filters and you don't want to create new property for it) 4. Internationalization - What if yi Wikipedia wants to create list of governors of some small country where there are no yi labels for the presidents? The list would be partially in yi partially in en - is this desired behavior? or they can show only presidents who have label in yi - but this would give partial data - is this the desired behavior? [Probably the correct solution is to do show the fallback labels in en, but add some tracking category for pages requires label translation or [translate me] links)
On Fri, Dec 16, 2016 at 7:35 AM, Stas Malyshev smalyshev@wikimedia.org wrote:
Hi!
Sure, but I'm not really worried about potential false positives. I'm worried that we're building a giant write-only data store.
Fortunately, we are not doing that.
Unless you're talking about pulling a small set of values, in which case Lua/templates are probably the best venue.
I'm not sure what small means here. We have about 46 U.S. Presidents, is that small enough? Which Lua functions and templates could I use?
No, list of presidents is not small enough. Lua right now can fetch specific data from specific item. Which is OK if you know the item and what you're getting (e.g. infoboxes, etc.) but not good for lists of items, especially with complicated conditions. That use case currently needs external tools - like bots.
Wikidata began in October 2012. I thought it might take till 2014 or even 2015 to get querying capability into a usable state, but we're now
looking
Please do not confuse your particular use case with querying not be usable at all. It is definitely usable and being used by many people for many things. Generating lists directly from wiki template is not supported yet, and we're working on it. I'm sorry that your use case is not supported and you're feeling disappointed. But we do have query capability and it can be used and is being used for many other things.
Of course, contributions - in any form, query development, code development, design, frontend, backend, data contributions, etc. - are always welcome.
to even contribute to it when it feels like putting data into a giant system that you can't really get back out. I love Magnus and I have a ton
Again, this is not correct - you can read data back out and there are several ways you can use query functionality for it right now. The way you want to do it is not supported - yet - but there are many other ways. Which we are constantly improving. But we can't do everything at once. Please be patient, please contribute with what you can, and we'll get there. -- Stas Malyshev smalyshev@wikimedia.org
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l