Addshore added a comment. So as we have slowly been creating more and more libraries such as https://github.com/wmde/WikibaseDataModelServices tackling something like this starts to seem easier.
I created a public draft where I simply shove some of my lookup implementations using the Wikidata API into the WikibaseClient: https://gerrit.wikimedia.org/r/#/c/233224/ As this just works, I can now include data from wikidata onto my local test wiki, of course more things need to be considered: 1. The patch above is using my wikibase-api library which can be found at http://github.com/addwiki/wikibase-api. This in turn eventually requires the guzzle framework which can be found at https://packagist.org/packages/guzzle/guzzle and would likely never be approved for use on the wikimedia cluster simply because it is a pile of code that we don't own / maintain ourselves.... 1. The easiest but suckiest way of doing this would be to just fork the Wikibase repo and add the code this needs, but that is ugly etc. 2. Another option would be to factor all of the things this would also need out of WikibaseClient and into a WikibaseClientLib or something similar which could be used in both implementations of the Client! (api and dispatch) 3. Another option would be to provide a way for an extension to override the lookups created in the WikibaseClient class and thus an extension could wrap WikibaseClient overriding these things lookups, this would mean that all of the lovely client code and stay where it is now (although we should seriously push forward with trying to split LIB REPO and CLIENT!!!!!!! https://phabricator.wikimedia.org/T75863 2. Having not worked on Client much I can't say for sure but I presume the data is current retrieved on the parsing of the page and will remain the same until the page is then reparsed. As an initial version this is probably fine and clients can purge their pages to get fresh data, but other ways forward here should be considered: 1. have a maintenance script that reloads all? oldest? loaded information 2. on page load if the infomation is X days old reload from wikidata? 3. As this client heavily depends on the wikibase api being kind of stable we should seriously consider pushing forward with versioning the API https://phabricator.wikimedia.org/T92961 otherwise changes to the API would instantly break all of these API based clients. We could also look at using the restbase api thingy for this??? https://www.mediawiki.org/wiki/RESTBase Other things we need to consider include: - Currently this would not work alongside an actually WikibaseClient installation, right now it would either be one or the other, we would need to think about renaming the propertyparser function in this the extension? and the LUA stuff? - If something like this would get used a lot then of course this results in more requests to our API... a good way of detecting this would be to have the client pass a header that we can easily identify to track the usage..... - We should probably create a PrefetchingEntityLookup in the wikibase-api library to that we can prefecth entitys rather than doing 1 api call for each entity used. **We could also try and implement all of the API stuff within the client itself and continue having a single extension**. The property parser function etc could then be expanded to accept more arguments / handle larger arguments... Currently we can use things like {{#property:https://phabricator.wikimedia.org/P122|from=Q12}} but we could allow {{#property:http://www.wikidata.org/entity/P122|from=http://www.wikidata.org/entity/Q122}} All thoughts and comments welcome of course, sorry for this slightly rambely comment! TASK DETAIL https://phabricator.wikimedia.org/T48556 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Addshore Cc: Tarrow, Addshore, Aklapper, Wikidata-bugs, Qgil, Ricordisamoa, Lydia_Pintscher, Unknown Object (MLST), aude, Malyacko _______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
